apply utils::is_type() to labelmap command
This commit is contained in:
@ -142,9 +142,8 @@ void LabelMap::modify_lmap(int narg, char **arg)
|
||||
if ((itype < 1) || (itype > ntypes))
|
||||
error->all(FLERR, "Labelmap {} type {} must be within 1-{}", tlabel, itype, ntypes);
|
||||
std::string slabel = utils::trim(arg[iarg++]);
|
||||
if (isdigit(slabel[0]) || (slabel[0] == '#') || (slabel[0] == '*'))
|
||||
error->all(FLERR, "Label {} for {} type {} must not start with a number, a '#', or a '*'",
|
||||
slabel, tlabel, itype);
|
||||
if (utils::is_type(slabel) != 1)
|
||||
error->all(FLERR, "Type label string {} for {} type {} is invalid", slabel, tlabel, itype);
|
||||
int found = search(slabel, (*labels_map));
|
||||
if ((found != -1) && (found != itype))
|
||||
error->all(FLERR, "The {} type label {} is already in use for type {}", tlabel, slabel,
|
||||
|
||||
@ -117,11 +117,13 @@ TEST_F(SetTest, NoBoxAtoms)
|
||||
command("labelmap atom 0 C1"););
|
||||
TEST_FAILURE(".*ERROR: Labelmap atom type 5 must be within 1-4.*",
|
||||
command("labelmap atom 5 C1"););
|
||||
TEST_FAILURE(".*ERROR: Label 1C for atom type 1 must not start with a number.*",
|
||||
TEST_FAILURE(".*ERROR: Type label string 1C for atom type 1 is invalid.*",
|
||||
command("labelmap atom 1 1C"););
|
||||
TEST_FAILURE(".*ERROR: Label #C for atom type 1 must not start with a number, a '#', or.*",
|
||||
TEST_FAILURE(".*ERROR: Type label string #C for atom type 1 is invalid.*",
|
||||
command("labelmap atom 1 '#C'"););
|
||||
TEST_FAILURE(".*ERROR: Label \\*C for atom type 1 must not start with a number, a '#', or.*",
|
||||
TEST_FAILURE(".*ERROR: Type label string CA CB for atom type 1 is invalid.*",
|
||||
command("labelmap atom 1 ' CA CB '"););
|
||||
TEST_FAILURE(".*ERROR: Type label string \\*C for atom type 1 is invalid.*",
|
||||
command("labelmap atom 1 *C"););
|
||||
TEST_FAILURE(".*ERROR: The atom type label N2 is already in use for type 2.*",
|
||||
command("labelmap atom 1 N2"););
|
||||
|
||||
Reference in New Issue
Block a user