update / correct suffix handling in fix pair

This commit is contained in:
Axel Kohlmeyer
2023-01-03 14:15:12 -05:00
parent a3572b61d8
commit bcb5285ef9
2 changed files with 20 additions and 6 deletions

View File

@ -36,11 +36,20 @@ FixPair::FixPair(LAMMPS *lmp, int narg, char **arg) :
if (nevery < 1) error->all(FLERR,"Illegal fix pair every value: {}", nevery);
pairname = utils::strdup(arg[4]);
if(lmp->suffix) {
strcat(pairname,"/");
strcat(pairname,lmp->suffix);
char *cptr;
int nsub = 0;
if ((cptr = strchr(pairname,':'))) {
*cptr = '\0';
nsub = utils::inumeric(FLERR,cptr+1,false,lmp);
}
pstyle = force->pair_match(pairname,1,0);
if (lmp->suffix_enable) {
if (lmp->suffix)
pstyle = force->pair_match(fmt::format("{}/{}",pairname,lmp->suffix),1,nsub);
if ((pstyle == nullptr) && lmp->suffix2)
pstyle = force->pair_match(fmt::format("{}/{}",pairname,lmp->suffix2),1,nsub);
}
if (pstyle == nullptr) pstyle = force->pair_match(pairname,1,nsub);
if (pstyle == nullptr) error->all(FLERR,"Pair style {} for fix pair not found", pairname);
nfield = (narg-5) / 2;