git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2351 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2009-01-08 21:46:20 +00:00
parent 3609f51fe0
commit 500847d45c
12 changed files with 200 additions and 175 deletions

View File

@ -152,23 +152,30 @@ Pair *Force::new_pair(const char *style)
}
/* ----------------------------------------------------------------------
return ptr to current pair class or hybrid sub-class if it contains word
return ptr to current pair class or hybrid sub-class
if exact, then style name must be exact match to word
if not exact, style name must contain word
else return NULL
------------------------------------------------------------------------- */
Pair *Force::pair_match(const char *word)
Pair *Force::pair_match(const char *word, int exact)
{
if (strstr(pair_style,word)) return pair;
if (exact && strcmp(pair_style,word) == 0) return pair;
else if (!exact && strstr(pair_style,word)) return pair;
else if (strcmp(pair_style,"hybrid") == 0) {
PairHybrid *hybrid = (PairHybrid *) pair;
for (int i = 0; i < hybrid->nstyles; i++) {
if (strstr(hybrid->keywords[i],word))
if (exact && strcmp(hybrid->keywords[i],word) == 0)
return hybrid->styles[i];
else if (!exact && strstr(hybrid->keywords[i],word))
return hybrid->styles[i];
}
} else if (strcmp(pair_style,"hybrid/overlay") == 0) {
PairHybridOverlay *hybrid = (PairHybridOverlay *) pair;
for (int i = 0; i < hybrid->nstyles; i++) {
if (strstr(hybrid->keywords[i],word))
if (exact && strcmp(hybrid->keywords[i],word) == 0)
return hybrid->styles[i];
else if (!exact && strstr(hybrid->keywords[i],word))
return hybrid->styles[i];
}
}