correct parsing of arguments with nmax appended at the end
This commit is contained in:
@ -38,16 +38,11 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
nmaxval = MAXSMALLINT;
|
nmaxval = MAXSMALLINT;
|
||||||
nindex = 0;
|
nindex = 0;
|
||||||
|
|
||||||
int iarg = 4;
|
|
||||||
if (strcmp(arg[iarg], "nmax") == 0) {
|
|
||||||
nmaxval = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
|
||||||
if (nmaxval < 1) error->all(FLERR, "Invalid nmax value");
|
|
||||||
iarg += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse values
|
// parse values
|
||||||
|
|
||||||
|
int iarg = 4;
|
||||||
values.clear();
|
values.clear();
|
||||||
|
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
ArgInfo argi(arg[iarg]);
|
ArgInfo argi(arg[iarg]);
|
||||||
|
|
||||||
@ -61,10 +56,23 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]);
|
error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]);
|
||||||
|
|
||||||
if (val.which == ArgInfo::NONE) break;
|
if (val.which == ArgInfo::NONE) break;
|
||||||
|
|
||||||
values.push_back(val);
|
values.push_back(val);
|
||||||
++iarg;
|
++iarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (iarg < narg) {
|
||||||
|
|
||||||
|
if (strcmp(arg[iarg], "nmax") == 0) {
|
||||||
|
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix vector nmax", error);
|
||||||
|
nmaxval = utils::bnumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||||
|
if (nmaxval < 1) error->all(FLERR, "Invalid nmax value");
|
||||||
|
iarg += 2;
|
||||||
|
} else {
|
||||||
|
error->all(FLERR, "Unknown fix vector keyword: {}", arg[iarg]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// setup and error check
|
// setup and error check
|
||||||
// for fix inputs, check that fix frequency is acceptable
|
// for fix inputs, check that fix frequency is acceptable
|
||||||
// this fix produces either a global vector or array
|
// this fix produces either a global vector or array
|
||||||
|
|||||||
Reference in New Issue
Block a user