try to work around the ambiguity of 0 and null pointers
This commit is contained in:
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user