refactor expand_types to return int

This commit is contained in:
Jacob Gissinger
2024-04-17 18:56:28 -04:00
parent e84540c626
commit b3e03d5188
5 changed files with 25 additions and 15 deletions

View File

@ -89,9 +89,7 @@ void CreateAtoms::command(int narg, char **arg)
// parse arguments
if (narg < 2) utils::missing_cmd_args(FLERR, "create_atoms", error);
char *typestr = utils::expand_type(FLERR, arg[0], Atom::ATOM, lmp);
ntype = utils::inumeric(FLERR, typestr?typestr:arg[0], false, lmp);
delete[] typestr;
ntype = utils::expand_type_int(FLERR, arg[0], Atom::ATOM, lmp);
const char *meshfile;
int iarg;
@ -165,9 +163,7 @@ void CreateAtoms::command(int narg, char **arg)
if (strcmp(arg[iarg], "basis") == 0) {
if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "create_atoms basis", error);
int ibasis = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
char *typestr = utils::expand_type(FLERR, arg[iarg + 2], Atom::ATOM, lmp);
int itype = utils::inumeric(FLERR, typestr?typestr:arg[iarg + 2], false, lmp);
delete[] typestr;
int itype = utils::expand_type_int(FLERR, arg[iarg + 2], Atom::ATOM, lmp);
if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes)
error->all(FLERR, "Out of range basis setting '{} {}' in create_atoms command", ibasis,
itype);