diff --git a/src/atom.cpp b/src/atom.cpp index a206408c43..6faffd105c 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2128,7 +2128,7 @@ void Atom::add_molecule(int narg, char **arg) if (narg < 1) utils::missing_cmd_args(FLERR, "molecule", error); if (find_molecule(arg[0]) >= 0) - error->all(FLERR,(int) 0, "Reuse of molecule template ID {}", arg[0]); + error->all(FLERR, Error::ARGZERO, "Reuse of molecule template ID {}", arg[0]); // 1st molecule in set stores nset = # of mols, others store nset = 0 // ifile = count of molecules in set diff --git a/src/error.cpp b/src/error.cpp index 946cc19fd6..f8c1eaefd8 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -130,6 +130,7 @@ void Error::all(const std::string &file, int line, int failed, const std::string // add text about the input following the error message if (failed > NOLASTLINE) mesg += utils::point_to_error(input, failed); + if (failed == ARGZERO) mesg += utils::point_to_error(input, 0); if (me == 0) utils::logmesg(lmp,mesg); utils::flush_buffers(lmp); @@ -162,6 +163,7 @@ void Error::one(const std::string &file, int line, int failed, const std::string std::string mesg = fmt::format("ERROR on proc {}: {} ({}:{})\n", me, str, truncpath(file), line); if (failed > NOPOINTER) mesg += utils::point_to_error(input, failed); + if (failed > ARGZERO) mesg += utils::point_to_error(input, 0); utils::logmesg(lmp,mesg); if (universe->nworlds > 1) diff --git a/src/error.h b/src/error.h index 0c446667e0..ba1bd655d0 100644 --- a/src/error.h +++ b/src/error.h @@ -29,6 +29,7 @@ class Error : protected Pointers { static constexpr int NOPOINTER = -2; static constexpr int NOLASTLINE = -3; + static constexpr int ARGZERO = -99; // regular error calls diff --git a/src/molecule.cpp b/src/molecule.cpp index 2b8c347a9d..20bb72ef07 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -58,7 +58,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : id = utils::strdup(arg[0]); if (!utils::is_id(id)) - error->all(FLERR, (int) 0, + error->all(FLERR, Error::ARGZEO, "Molecule template ID {} must have only alphanumeric or underscore" " characters", id);