compute_rdf: direct type label support

type label that is the same as the keyword ('cutoff') will break things. if syntax is otherwise 'correct', then will throw a syntax error. perhaps could run through typelabels to check first?
This commit is contained in:
Jacob Gissinger
2024-05-12 16:11:36 -04:00
parent c324afeaf1
commit f007be620a
2 changed files with 26 additions and 14 deletions

View File

@ -102,10 +102,20 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) :
} else {
iarg = 4;
for (int ipair = 0; ipair < npairs; ipair++) {
utils::bounds(FLERR,arg[iarg],1,atom->ntypes,ilo[ipair],ihi[ipair],error);
utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,jlo[ipair],jhi[ipair],error);
if (ilo[ipair] > ihi[ipair] || jlo[ipair] > jhi[ipair])
error->all(FLERR,"Illegal compute rdf command");
utils::bounds_typelabel(FLERR, arg[iarg], 1, atom->ntypes, ilo[ipair], ihi[ipair], error, lmp, Atom::ATOM);
utils::bounds_typelabel(FLERR, arg[iarg+1], 1, atom->ntypes, jlo[ipair], jhi[ipair], error, lmp, Atom::ATOM);
// switch i,j if i > j, if wildcards were not used
if ( (ilo[ipair] == ihi[ipair]) &&
(jlo[ipair] == jhi[ipair]) &&
(ilo[ipair] > jlo[ipair]) ) {
jlo[ipair] = ihi[ipair];
ilo[ipair] = jhi[ipair];
ihi[ipair] = ilo[ipair];
jhi[ipair] = jlo[ipair];
}
iarg += 2;
}
}