diff --git a/doc/src/fix_pair.rst b/doc/src/fix_pair.rst index abb44718cd..44c91f18ee 100644 --- a/doc/src/fix_pair.rst +++ b/doc/src/fix_pair.rst @@ -1,7 +1,7 @@ .. index:: fix pair fix pair command -======================= +================ Syntax """""" @@ -47,7 +47,12 @@ These are example use cases: The *N* argument determines how often the fix is invoked. The *pstyle* argument is the name of the pair style. It can be a -sub-style used in a :doc:`pair_style hybrid ` command. +sub-style used in a :doc:`pair_style hybrid ` command. If +there are multiple sub-styles using the same pair style, then *pstyle* +should be specified as "style:N", where *N* is the number of the +instance of the pair style you wish monitor (e.g., the first or second). +For example, *pstyle* could be specified as "pace/extrapolation" or +"amoeba" or "eam:1" or "eam:2". One or more *name/flag* pairs of arguments follow. Each *name* is a per-atom quantity which the pair style must recognize as an extraction diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index bd389f6632..db7b24dfea 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -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;