make sure the one_coeff flag is applied to sub-styles

since the check for Pair::one_coeff was moved to the Input class (to
reduce redundant code), hybrid substyles could "escape" that requirement.
Thus checks have to be added to the hybrid coeff() methods.
This commit is contained in:
Axel Kohlmeyer
2021-09-28 04:39:46 -04:00
parent 9d5aa757c3
commit b3c8f85ff9
3 changed files with 16 additions and 1 deletions

View File

@ -474,6 +474,12 @@ void PairHybridScaled::coeff(int narg, char **arg)
arg[2 + multflag] = arg[1];
arg[1 + multflag] = arg[0];
// ensure that one_coeff flag is honored
if (!none && styles[m]->one_coeff)
if ((strcmp(arg[0],"*") != 0) || (strcmp(arg[1],"*") != 0))
error->all(FLERR,"Incorrect args for pair coefficients");
// invoke sub-style coeff() starting with 1st remaining arg
if (!none) styles[m]->coeff(narg - 1 - multflag, &arg[1 + multflag]);