improve error messages

This commit is contained in:
Axel Kohlmeyer
2022-09-25 17:36:31 -04:00
parent ccafdf54fd
commit cb92a1553c
3 changed files with 16 additions and 22 deletions

View File

@ -239,7 +239,7 @@ void PairPACE::allocate()
void PairPACE::settings(int narg, char **arg) void PairPACE::settings(int narg, char **arg)
{ {
if (narg > 3) error->all(FLERR, "Illegal pair_style command."); if (narg > 3) utils::missing_cmd_args(FLERR, "pair_style pace", error);
// ACE potentials are parameterized in metal units // ACE potentials are parameterized in metal units
if (strcmp("metal", update->unit_style) != 0) if (strcmp("metal", update->unit_style) != 0)
@ -259,7 +259,7 @@ void PairPACE::settings(int narg, char **arg)
chunksize = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); chunksize = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
} else } else
error->all(FLERR, "Illegal pair_style command"); error->all(FLERR, "Unknown pair_style pace keyword: {}", arg[iarg]);
} }
if (comm->me == 0) { if (comm->me == 0) {
@ -350,8 +350,8 @@ void PairPACE::coeff(int narg, char **arg)
void PairPACE::init_style() void PairPACE::init_style()
{ {
if (atom->tag_enable == 0) error->all(FLERR, "Pair style PACE requires atom IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Pair style pace requires atom IDs");
if (force->newton_pair == 0) error->all(FLERR, "Pair style PACE requires newton pair on"); if (force->newton_pair == 0) error->all(FLERR, "Pair style pace requires newton pair on");
// request a full neighbor list // request a full neighbor list
neighbor->add_request(this, NeighConst::REQ_FULL); neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -270,12 +270,12 @@ void PairPACEExtrapolation::compute(int eflag, int vflag)
void PairPACEExtrapolation::allocate() void PairPACEExtrapolation::allocate()
{ {
allocated = 1; allocated = 1;
int n = atom->ntypes; int np1 = atom->ntypes + 1;
memory->create(setflag, n + 1, n + 1, "pair:setflag"); memory->create(setflag, np1, np1, "pair:setflag");
memory->create(cutsq, n + 1, n + 1, "pair:cutsq"); memory->create(cutsq, np1, np1, "pair:cutsq");
memory->create(map, n + 1, "pair:map"); memory->create(map, np1, "pair:map");
memory->create(scale, n + 1, n + 1, "pair:scale"); memory->create(scale, np1, np1, "pair:scale");
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -284,14 +284,10 @@ void PairPACEExtrapolation::allocate()
void PairPACEExtrapolation::settings(int narg, char **arg) void PairPACEExtrapolation::settings(int narg, char **arg)
{ {
if (narg > 0) { if (narg > 0) error->all(FLERR, "Pair style pace/extrapolation supports no keywords");
error->all(FLERR,
"Illegal pair_style command. Correct form:\n\tpair_style pace/extrapolation ");
}
if (comm->me == 0) { if (comm->me == 0)
utils::logmesg(lmp, "ACE/AL version: {}.{}.{}\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY); utils::logmesg(lmp, "ACE/AL version: {}.{}.{}\n", VERSION_YEAR, VERSION_MONTH, VERSION_DAY);
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -301,10 +297,7 @@ void PairPACEExtrapolation::settings(int narg, char **arg)
void PairPACEExtrapolation::coeff(int narg, char **arg) void PairPACEExtrapolation::coeff(int narg, char **arg)
{ {
if (narg < 5) if (narg < 5) utils::missing_cmd_args(FLERR, "pair_coeff", error);
error->all(FLERR,
"Incorrect args for pair coefficients. Correct form:\npair_coeff * * "
"<potential.yaml> <potential.asi> elem1 elem2 ...");
if (!allocated) allocate(); if (!allocated) allocate();
@ -401,8 +394,9 @@ void PairPACEExtrapolation::coeff(int narg, char **arg)
void PairPACEExtrapolation::init_style() void PairPACEExtrapolation::init_style()
{ {
if (atom->tag_enable == 0) error->all(FLERR, "Pair style PACE requires atom IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Pair style pace/extrapolation requires atom IDs");
if (force->newton_pair == 0) error->all(FLERR, "Pair style PACE requires newton pair on"); if (force->newton_pair == 0)
error->all(FLERR, "Pair style pace/extrapolation requires newton pair on");
// request a full neighbor list // request a full neighbor list
neighbor->add_request(this, NeighConst::REQ_FULL); neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -363,7 +363,7 @@ int FixPair::modify_param(int narg, char **arg) {
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg], "every") == 0) { if (strcmp(arg[iarg], "every") == 0) {
nevery = utils::inumeric(FLERR, arg[iarg+1], false, lmp); nevery = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
if (nevery < 1) error->all(FLERR, "Illegal fix_modify pair command"); if (nevery < 1) error->all(FLERR, "Illegal fix_modify pair every value: {}", nevery);
iarg += 2; iarg += 2;
processed_args+=2; processed_args+=2;
} else } else