From fc32826cd7cdf509d34e25747c7a0ff1811ba348 Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sun, 12 May 2024 16:44:24 -0400 Subject: [PATCH] more uses of bounds_typelabel --- src/atom.cpp | 10 +++------- src/set.cpp | 6 +----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 7edf4760d2..c51be44d1d 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1956,18 +1956,14 @@ void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) if (mass == nullptr) error->all(file,line, "Cannot set per-type atom mass for atom style {}", atom_style); - char *typestr = utils::expand_type(file, line, arg[0], Atom::ATOM, lmp); - const std::string str = typestr ? typestr : arg[0]; - delete[] typestr; - int lo, hi; - utils::bounds(file, line, str, 1, ntypes, lo, hi, error); + utils::bounds_typelabel(file, line, arg[0], 1, ntypes, lo, hi, error, lmp, Atom::ATOM); if ((lo < 1) || (hi > ntypes)) - error->all(file, line, "Invalid atom type {} for atom mass", str); + error->all(file, line, "Invalid atom type {} for atom mass", arg[0]); const double value = utils::numeric(FLERR, arg[1], false, lmp); if (value <= 0.0) - error->all(file, line, "Invalid atom mass value {} for type {}", value, str); + error->all(file, line, "Invalid atom mass value {} for type {}", value, arg[0]); for (int itype = lo; itype <= hi; itype++) { mass[itype] = value; diff --git a/src/set.cpp b/src/set.cpp index 5f06f18a42..1a81cd32ba 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -740,11 +740,7 @@ void Set::selection(int n) else select[i] = 0; } else if (style == TYPE_SELECT) { - if (char *typestr = utils::expand_type(FLERR, id, Atom::ATOM, lmp)) { - delete[] id; - id = typestr; - } - utils::bounds(FLERR,id,1,atom->ntypes,nlo,nhi,error); + utils::bounds_typelabel(FLERR,id,1,atom->ntypes,nlo,nhi,error,lmp,Atom::ATOM); int *type = atom->type; for (int i = 0; i < n; i++)