update suffix handling to be consistent (also with pending fix pair changes)

This commit is contained in:
Axel Kohlmeyer
2023-01-03 14:16:28 -05:00
parent 73300b080b
commit e48e5ad965
3 changed files with 14 additions and 17 deletions

View File

@ -120,7 +120,7 @@ The *pstyle* argument is the name of the pair style. If
:doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is used, :doc:`pair_style hybrid or hybrid/overlay <pair_hybrid>` is used,
*pstyle* should be a sub-style name. If there are multiple *pstyle* should be a sub-style name. If there are multiple
sub-styles using the same pair style, then *pstyle* should be specified sub-styles using the same pair style, then *pstyle* should be specified
as "style:N", where :math:`N` is which instance of the pair style you wish to as "style:N", where *N* is which instance of the pair style you wish to
adapt (e.g., the first or second). For example, *pstyle* could be adapt (e.g., the first or second). For example, *pstyle* could be
specified as "soft" or "lubricate" or "lj/cut:1" or "lj/cut:2". The specified as "soft" or "lubricate" or "lj/cut:1" or "lj/cut:2". The
*pparam* argument is the name of the parameter to change. This is the *pparam* argument is the name of the parameter to change. This is the

View File

@ -201,23 +201,18 @@ void ComputeFEP::init()
pairflag = 1; pairflag = 1;
Pair *pair = nullptr; Pair *pair = nullptr;
if (lmp->suffix_enable) { if (lmp->suffix_enable) {
if (lmp->suffix) { if (lmp->suffix)
auto pstyle = fmt::format("{}/{}", pert->pstyle, lmp->suffix); pair = force->pair_match(fmt::format("{}/{}", pert->pstyle, lmp->suffix), 1);
pair = force->pair_match(pstyle, 1); if ((pair == nullptr) && lmp->suffix2)
} pair = force->pair_match(fmt::format("{}/{}", pert->pstyle, lmp->suffix2), 1);
if ((pair == nullptr) && lmp->suffix2) {
auto pstyle = fmt::format("{}/{}", pert->pstyle, lmp->suffix2);
pair = force->pair_match(pstyle, 1);
}
} }
if (pair == nullptr) pair = force->pair_match(pert->pstyle, 1); if (pair == nullptr) pair = force->pair_match(pert->pstyle, 1);
if (pair == nullptr) if (pair == nullptr) error->all(FLERR, "Compute fep pair style {} not found", pert->pstyle);
error->all(FLERR, "compute fep pair style {} does not exist", pert->pstyle);
void *ptr = pair->extract(pert->pparam, pert->pdim); void *ptr = pair->extract(pert->pparam, pert->pdim);
if (ptr == nullptr) if (ptr == nullptr)
error->all(FLERR, "compute fep pair style param {} not supported", pert->pparam); error->all(FLERR, "Compute fep pair style param {} not supported", pert->pparam);
pert->array = (double **) ptr; pert->array = (double **) ptr;

View File

@ -357,12 +357,14 @@ void FixAdapt::init()
nsub = utils::inumeric(FLERR,cptr+1,false,lmp); nsub = utils::inumeric(FLERR,cptr+1,false,lmp);
} }
if (lmp->suffix_enable) if (lmp->suffix_enable) {
if (lmp->suffix)
ad->pair = force->pair_match(fmt::format("{}/{}",pstyle,lmp->suffix),1,nsub); ad->pair = force->pair_match(fmt::format("{}/{}",pstyle,lmp->suffix),1,nsub);
if ((ad->pair == nullptr) && lmp->suffix2)
ad->pair = force->pair_match(fmt::format("{}/{}",pstyle,lmp->suffix2),1,nsub);
}
if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub); if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub);
if (ad->pair == nullptr) if (ad->pair == nullptr) error->all(FLERR,"Fix adapt pair style {} not found", pstyle);
error->all(FLERR,"Fix adapt pair style does not exist");
void *ptr = ad->pair->extract(ad->pparam,ad->pdim); void *ptr = ad->pair->extract(ad->pparam,ad->pdim);
if (ptr == nullptr) if (ptr == nullptr)