update / correct suffix handling in fix pair
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
.. index:: fix pair
|
.. index:: fix pair
|
||||||
|
|
||||||
fix pair command
|
fix pair command
|
||||||
=======================
|
================
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
""""""
|
""""""
|
||||||
@ -47,7 +47,12 @@ These are example use cases:
|
|||||||
The *N* argument determines how often the fix is invoked.
|
The *N* argument determines how often the fix is invoked.
|
||||||
|
|
||||||
The *pstyle* argument is the name of the pair style. It can be a
|
The *pstyle* argument is the name of the pair style. It can be a
|
||||||
sub-style used in a :doc:`pair_style hybrid <pair_hybrid>` command.
|
sub-style used in a :doc:`pair_style hybrid <pair_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
|
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
|
per-atom quantity which the pair style must recognize as an extraction
|
||||||
|
|||||||
@ -36,11 +36,20 @@ FixPair::FixPair(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (nevery < 1) error->all(FLERR,"Illegal fix pair every value: {}", nevery);
|
if (nevery < 1) error->all(FLERR,"Illegal fix pair every value: {}", nevery);
|
||||||
|
|
||||||
pairname = utils::strdup(arg[4]);
|
pairname = utils::strdup(arg[4]);
|
||||||
if(lmp->suffix) {
|
char *cptr;
|
||||||
strcat(pairname,"/");
|
int nsub = 0;
|
||||||
strcat(pairname,lmp->suffix);
|
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);
|
if (pstyle == nullptr) error->all(FLERR,"Pair style {} for fix pair not found", pairname);
|
||||||
|
|
||||||
nfield = (narg-5) / 2;
|
nfield = (narg-5) / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user