correctly check for index and dimensionality

This commit is contained in:
Axel Kohlmeyer
2021-01-31 22:13:43 -05:00
parent 99184eb653
commit d5e6bcd9d3
5 changed files with 12 additions and 10 deletions

View File

@ -150,11 +150,11 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
ArgInfo argi(arg[3]); ArgInfo argi(arg[3]);
which = argi.get_type(); which = argi.get_type();
argindex = argi.get_dim(); argindex = argi.get_index1();
cfvid = argi.copy_name(); cfvid = argi.copy_name();
if ((which == ArgInfo::UNKNOWN) || (which == ArgInfo::NONE) if ((which == ArgInfo::UNKNOWN) || (which == ArgInfo::NONE)
|| (argindex > 1)) || (argi.get_dim() > 1))
error->all(FLERR,"Illegal compute chunk/atom command"); error->all(FLERR,"Illegal compute chunk/atom command");
} }

View File

@ -69,11 +69,11 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
ArgInfo argi(arg[iarg], ArgInfo::COMPUTE|ArgInfo::FIX); ArgInfo argi(arg[iarg], ArgInfo::COMPUTE|ArgInfo::FIX);
which[nvalues] = argi.get_type(); which[nvalues] = argi.get_type();
argindex[nvalues] = argi.get_dim(); argindex[nvalues] = argi.get_index1();
ids[nvalues] = argi.copy_name(); ids[nvalues] = argi.copy_name();
if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE) if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE)
|| (argindex[nvalues] > 1)) || (argi.get_dim() > 1))
error->all(FLERR,"Illegal compute chunk/spread/atom command"); error->all(FLERR,"Illegal compute chunk/spread/atom command");
nvalues++; nvalues++;

View File

@ -85,11 +85,11 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) :
ArgInfo argi(arg[iarg]); ArgInfo argi(arg[iarg]);
which[nvalues] = argi.get_type(); which[nvalues] = argi.get_type();
argindex[nvalues] = argi.get_dim(); argindex[nvalues] = argi.get_index1();
ids[nvalues] = argi.copy_name(); ids[nvalues] = argi.copy_name();
if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE) if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE)
|| (argindex[nvalues] > 1)) || (argi.get_dim() > 1))
error->all(FLERR,"Illegal compute reduce/chunk command"); error->all(FLERR,"Illegal compute reduce/chunk command");
nvalues++; nvalues++;

View File

@ -56,12 +56,14 @@ ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) :
ArgInfo argi(arg[iarg]); ArgInfo argi(arg[iarg]);
which[nvalues] = argi.get_type(); which[nvalues] = argi.get_type();
argindex[nvalues] = argi.get_dim(); argindex[nvalues] = argi.get_index1();
ids[nvalues] = argi.copy_name(); ids[nvalues] = argi.copy_name();
if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE) if ((which[nvalues] == ArgInfo::UNKNOWN) || (which[nvalues] == ArgInfo::NONE)
|| (argindex[nvalues] > 1)) || (argi.get_dim() > 1))
error->all(FLERR,"Illegal compute slice command"); error->all(FLERR,"Illegal compute slice command");
nvalues++;
} }
// setup and error check // setup and error check

View File

@ -99,11 +99,11 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
ArgInfo argi(arg[i]); ArgInfo argi(arg[i]);
which[i] = argi.get_type(); which[i] = argi.get_type();
argindex[i] = argi.get_dim(); argindex[i] = argi.get_index1();
ids[i] = argi.copy_name(); ids[i] = argi.copy_name();
if ((which[i] == ArgInfo::UNKNOWN) || (which[i] == ArgInfo::NONE) if ((which[i] == ArgInfo::UNKNOWN) || (which[i] == ArgInfo::NONE)
|| (argindex[i] > 1)) || (argi.get_dim() > 1))
error->all(FLERR,"Illegal fix ave/atom command"); error->all(FLERR,"Illegal fix ave/atom command");
} }
} }