Tweaked error messages

This commit is contained in:
Aidan Thompson
2022-06-19 09:58:01 -06:00
parent eb69bb28b8
commit de4558aa07
6 changed files with 74 additions and 49 deletions

View File

@ -35,7 +35,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
radelem(nullptr), wjelem(nullptr), sinnerelem(nullptr), dinnerelem(nullptr)
{
// code common to all SNAP computes
// begin code common to all SNAP computes
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
@ -160,12 +160,15 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
if (switchinnerflag && !(sinnerflag && dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword",
style);
if (!switchinnerflag && (sinnerflag || dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag,
wselfallflag, nelements, switchinnerflag);

View File

@ -37,7 +37,7 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) :
arg += nargbase;
narg -= nargbase;
// code common to all SNAP computes
// begin code common to all SNAP computes
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
@ -61,22 +61,25 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) :
// process required arguments
memory->create(radelem, ntypes + 1, "sna/grid:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/grid:wjelem");
memory->create(radelem, ntypes + 1, "sna/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/atom:wjelem");
rcutfac = utils::numeric(FLERR, arg[3], false, lmp);
rfac0 = utils::numeric(FLERR, arg[4], false, lmp);
twojmax = utils::inumeric(FLERR, arg[5], false, lmp);
for (int i = 0; i < ntypes; i++) radelem[i + 1] = utils::numeric(FLERR, arg[6 + i], false, lmp);
for (int i = 0; i < ntypes; i++)
wjelem[i + 1] = utils::numeric(FLERR, arg[6 + ntypes + i], false, lmp);
radelem[i + 1] =
utils::numeric(FLERR, arg[6 + i], false, lmp);
for (int i = 0; i < ntypes; i++)
wjelem[i + 1] =
utils::numeric(FLERR, arg[6 + ntypes + i], false, lmp);
// construct cutsq
double cut;
cutmax = 0.0;
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/grid:cutsq");
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/atom:cutsq");
for (int i = 1; i <= ntypes; i++) {
cut = 2.0 * radelem[i] * rcutfac;
if (cut > cutmax) cutmax = cut;
@ -157,14 +160,17 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) :
}
if (switchinnerflag && !(sinnerflag && dinnerflag))
error->all(FLERR,
"Illegal compute {} command: switchinnerflag = 1, missing sinner/dinner keyword",
style);
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword",
style);
if (!switchinnerflag && (sinnerflag || dinnerflag))
error->all(FLERR,
"Illegal compute {} command: switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag,
wselfallflag, nelements, switchinnerflag);

View File

@ -37,7 +37,7 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) :
arg += nargbase;
narg -= nargbase;
// code common to all SNAP computes
// begin code common to all SNAP computes
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
@ -61,23 +61,25 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) :
// process required arguments
memory->create(radelem, ntypes + 1,
"sna/grid/local:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/grid/local:wjelem");
memory->create(radelem, ntypes + 1, "sna/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/atom:wjelem");
rcutfac = utils::numeric(FLERR, arg[3], false, lmp);
rfac0 = utils::numeric(FLERR, arg[4], false, lmp);
twojmax = utils::inumeric(FLERR, arg[5], false, lmp);
for (int i = 0; i < ntypes; i++) radelem[i + 1] = utils::numeric(FLERR, arg[6 + i], false, lmp);
for (int i = 0; i < ntypes; i++)
wjelem[i + 1] = utils::numeric(FLERR, arg[6 + ntypes + i], false, lmp);
radelem[i + 1] =
utils::numeric(FLERR, arg[6 + i], false, lmp);
for (int i = 0; i < ntypes; i++)
wjelem[i + 1] =
utils::numeric(FLERR, arg[6 + ntypes + i], false, lmp);
// construct cutsq
double cut;
cutmax = 0.0;
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/grid/local:cutsq");
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/atom:cutsq");
for (int i = 1; i <= ntypes; i++) {
cut = 2.0 * radelem[i] * rcutfac;
if (cut > cutmax) cutmax = cut;
@ -158,14 +160,17 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) :
}
if (switchinnerflag && !(sinnerflag && dinnerflag))
error->all(FLERR,
"Illegal compute {} command: switchinnerflag = 1, missing sinner/dinner keyword",
style);
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword",
style);
if (!switchinnerflag && (sinnerflag || dinnerflag))
error->all(FLERR,
"Illegal compute {} command: switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag,
wselfallflag, nelements, switchinnerflag);

View File

@ -34,7 +34,8 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snad(nullptr),
radelem(nullptr), wjelem(nullptr), sinnerelem(nullptr), dinnerelem(nullptr)
{
// code common to all SNAP computes
// begin code common to all SNAP computes
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
@ -58,8 +59,8 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
// process required arguments
memory->create(radelem, ntypes + 1, "snad/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "snad/atom:wjelem");
memory->create(radelem, ntypes + 1, "sna/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/atom:wjelem");
rcutfac = utils::numeric(FLERR, arg[3], false, lmp);
rfac0 = utils::numeric(FLERR, arg[4], false, lmp);
@ -76,7 +77,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
double cut;
cutmax = 0.0;
memory->create(cutsq, ntypes + 1, ntypes + 1, "snad/atom:cutsq");
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/atom:cutsq");
for (int i = 1; i <= ntypes; i++) {
cut = 2.0 * radelem[i] * rcutfac;
if (cut > cutmax) cutmax = cut;
@ -159,12 +160,15 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
if (switchinnerflag && !(sinnerflag && dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword",
style);
if (!switchinnerflag && (sinnerflag || dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag,
wselfallflag, nelements, switchinnerflag);
@ -174,7 +178,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
if (quadraticflag) nvalues += (ncoeff * (ncoeff + 1)) / 2;
// end code common to all SNAP computes
yoffset = nvalues;
zoffset = 2*nvalues;
size_peratom_cols = 3*nvalues*atom->ntypes;

View File

@ -41,7 +41,7 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
array_flag = 1;
extarray = 0;
// code common to all SNAP computes
// begin code common to all SNAP computes
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
@ -65,8 +65,8 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
// process required arguments
memory->create(radelem, ntypes + 1, "snap:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "snap:wjelem");
memory->create(radelem, ntypes + 1, "sna/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/atom:wjelem");
rcutfac = utils::numeric(FLERR, arg[3], false, lmp);
rfac0 = utils::numeric(FLERR, arg[4], false, lmp);
@ -83,7 +83,7 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
double cut;
cutmax = 0.0;
memory->create(cutsq, ntypes + 1, ntypes + 1, "snap:cutsq");
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/atom:cutsq");
for (int i = 1; i <= ntypes; i++) {
cut = 2.0 * radelem[i] * rcutfac;
if (cut > cutmax) cutmax = cut;
@ -166,12 +166,15 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) :
if (switchinnerflag && !(sinnerflag && dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword",
style);
if (!switchinnerflag && (sinnerflag || dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag,
wselfallflag, nelements, switchinnerflag);

View File

@ -34,7 +34,8 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snav(nullptr),
radelem(nullptr), wjelem(nullptr), sinnerelem(nullptr), dinnerelem(nullptr)
{
// code common to all SNAP computes
// begin code common to all SNAP computes
double rfac0, rmin0;
int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag;
@ -58,8 +59,8 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
// process required arguments
memory->create(radelem, ntypes + 1, "snav/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "snav/atom:wjelem");
memory->create(radelem, ntypes + 1, "sna/atom:radelem"); // offset by 1 to match up with types
memory->create(wjelem, ntypes + 1, "sna/atom:wjelem");
rcutfac = utils::numeric(FLERR, arg[3], false, lmp);
rfac0 = utils::numeric(FLERR, arg[4], false, lmp);
@ -76,7 +77,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
double cut;
cutmax = 0.0;
memory->create(cutsq, ntypes + 1, ntypes + 1, "snav/atom:cutsq");
memory->create(cutsq, ntypes + 1, ntypes + 1, "sna/atom:cutsq");
for (int i = 1; i <= ntypes; i++) {
cut = 2.0 * radelem[i] * rcutfac;
if (cut > cutmax) cutmax = cut;
@ -159,12 +160,15 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
if (switchinnerflag && !(sinnerflag && dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 1, missing sinner/dinner keyword",
style);
if (!switchinnerflag && (sinnerflag || dinnerflag))
error->all(
FLERR,
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword");
"Illegal compute {} command:, style switchinnerflag = 0, unexpected sinner/dinner keyword",
style);
snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag,
wselfallflag, nelements, switchinnerflag);
@ -174,8 +178,8 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
if (quadraticflag) nvalues += (ncoeff * (ncoeff + 1)) / 2;
// end code common to all SNAP computes
size_peratom_cols = 6*nvalues*atom->ntypes;
size_peratom_cols = 6*nvalues*atom->ntypes;
comm_reverse = size_peratom_cols;
peratom_flag = 1;