turn some warnings into errors and produce better error messages
This commit is contained in:
@ -126,17 +126,9 @@ ComputeBornMatrix::ComputeBornMatrix(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
numflag = 0;
|
numflag = 0;
|
||||||
numdelta = 0.0;
|
numdelta = 0.0;
|
||||||
|
|
||||||
pairflag = 0;
|
pairflag = bondflag = angleflag = dihedflag = impflag = 0;
|
||||||
bondflag = 0;
|
|
||||||
angleflag = 0;
|
|
||||||
dihedflag = 0;
|
|
||||||
impflag = 0;
|
|
||||||
if (narg == 3) {
|
if (narg == 3) {
|
||||||
pairflag = 1;
|
pairflag = bondflag = angleflag = dihedflag = impflag = 1;
|
||||||
bondflag = 1;
|
|
||||||
angleflag = 1;
|
|
||||||
dihedflag = 1;
|
|
||||||
impflag = 1;
|
|
||||||
} else {
|
} else {
|
||||||
int iarg = 3;
|
int iarg = 3;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
@ -174,60 +166,62 @@ ComputeBornMatrix::ComputeBornMatrix(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
||||||
if (force->pair) {
|
if (force->pair) {
|
||||||
if (force->pair->born_matrix_enable == 0)
|
if (force->pair->born_matrix_enable == 0)
|
||||||
if (comm->me == 0) error->warning(FLERR, "Pair style does not support compute born/matrix");
|
error->all(FLERR, "Pair style {} does not support compute born/matrix", force->pair_style);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
pairflag = 0;
|
pairflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bondflag) {
|
if (bondflag) {
|
||||||
if (numflag)
|
if (numflag)
|
||||||
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
||||||
if (force->bond) {
|
if (force->bond) {
|
||||||
if (force->bond->born_matrix_enable == 0) {
|
if (force->bond->born_matrix_enable == 0)
|
||||||
if (comm->me == 0) error->warning(FLERR, "Bond style does not support compute born/matrix");
|
error->all(FLERR, "Bond style {} does not support compute born/matrix", force->bond_style);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
bondflag = 0;
|
bondflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angleflag) {
|
if (angleflag) {
|
||||||
if (numflag)
|
if (numflag)
|
||||||
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
||||||
if (force->angle) {
|
if (force->angle) {
|
||||||
if (force->angle->born_matrix_enable == 0) {
|
if (force->angle->born_matrix_enable == 0)
|
||||||
if (comm->me == 0) error->warning(FLERR, "Angle style does not support compute born/matrix");
|
error->all(FLERR, "Angle style {} does not support compute born/matrix",
|
||||||
}
|
force->angle_style);
|
||||||
} else {
|
} else {
|
||||||
angleflag = 0;
|
angleflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dihedflag) {
|
if (dihedflag) {
|
||||||
if (numflag)
|
if (numflag)
|
||||||
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
||||||
if (force->dihedral) {
|
if (force->dihedral) {
|
||||||
if (force->dihedral->born_matrix_enable == 0) {
|
if (force->dihedral->born_matrix_enable == 0)
|
||||||
if (comm->me == 0)
|
error->all(FLERR, "Dihedral style {} does not support compute born/matrix",
|
||||||
error->warning(FLERR, "Dihedral style does not support compute born/matrix");
|
force->dihedral_style);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dihedflag = 0;
|
dihedflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (impflag) {
|
if (impflag) {
|
||||||
if (numflag)
|
if (numflag)
|
||||||
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags");
|
||||||
if (force->improper) {
|
if (force->improper) {
|
||||||
if (force->improper->born_matrix_enable == 0) {
|
if (force->improper->born_matrix_enable == 0)
|
||||||
if (comm->me == 0)
|
error->all(FLERR, "Improper style {} does not support compute born/matrix",
|
||||||
error->warning(FLERR, "Improper style does not support compute born/matrix");
|
force->improper_style);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
impflag = 0;
|
impflag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force->kspace) {
|
if (force->kspace) {
|
||||||
if (!numflag) error->warning(FLERR, "KSPACE contribution not supported by compute born/matrix");
|
if (!numflag && (comm->me == 0))
|
||||||
|
error->all(FLERR, "KSpace contribution not supported by compute born/matrix");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize some variables
|
// Initialize some variables
|
||||||
|
|||||||
Reference in New Issue
Block a user