Use utils::logical() to parse arguments.

This commit is contained in:
jkelowitt
2022-06-28 16:52:57 -06:00
parent e8c2dcc693
commit 4db7f91c48
2 changed files with 7 additions and 12 deletions

View File

@ -240,13 +240,8 @@ void PairSW::settings(int narg, char ** arg)
while (iarg < narg) {
if (strcmp(arg[iarg],"threebody") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style command");
if (strcmp(arg[iarg+1], "on") == 0) {
threebody_flag = true;
one_coeff = 1;
} else if (strcmp(arg[iarg+1], "off") == 0) {
threebody_flag = false;
one_coeff = 0; // Allow for multiple pair_coeff's
} else error->all(FLERR,"Illegal pair_style command");
threebody_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
one_coeff = threebody_flag;
iarg += 2;
} else error->all(FLERR,"Illegal pair_style command");
}

View File

@ -48,11 +48,11 @@ class PairSW : public Pair {
};
protected:
double cutmax; // max cutoff for all elements
Param *params; // parameter set for an I-J-K interaction
int maxshort; // size of short neighbor list array
int *neighshort; // short neighbor list array
bool threebody_flag; // whether to run threebody loop
double cutmax; // max cutoff for all elements
Param *params; // parameter set for an I-J-K interaction
int maxshort; // size of short neighbor list array
int *neighshort; // short neighbor list array
int threebody_flag; // whether to run threebody loop
void settings(int, char **) override;
virtual void allocate();