print warnings if force styles and topology data are inconsistent

print a warning if there are bonds/angles/dihedrals/impropers in the
bond topology, but no corresponding style defined.
print an additional warning when special bonds scaling factors
for this kind of interaction is not 1.0 and thus the neighbor list
for pair styles may be affected, too.
This commit is contained in:
Axel Kohlmeyer
2019-10-11 16:18:02 +02:00
parent 2b8f300ce8
commit 7bf2b99785

View File

@ -196,6 +196,28 @@ void Force::init()
if (angle) angle->init();
if (dihedral) dihedral->init();
if (improper) improper->init();
// print warnings if topology and force field are inconsistent
if (comm->me == 0) {
if (!bond && (atom->nbonds > 0)) {
error->warning(FLERR,"Bonds are defined but no bond style is set");
if ((special_lj[1] != 1.0) || (special_coul[1] != 1.0))
error->warning(FLERR,"1-2 special neighbor interactions != 1.0");
}
if (!angle && (atom->nangles > 0)) {
error->warning(FLERR,"Angles are defined but no angle style is set");
if ((special_lj[2] != 1.0) || (special_coul[2] != 1.0))
error->warning(FLERR,"1-3 special neighbor interactions != 1.0");
}
if (!dihedral && (atom->ndihedrals > 0)) {
error->warning(FLERR,"Dihedrals are defined but no dihedral style is set");
if ((special_lj[3] != 1.0) || (special_coul[3] != 1.0))
error->warning(FLERR,"1-4 special neighbor interactions != 1.0");
}
if (!improper && (atom->nimpropers > 0))
error->warning(FLERR,"Impropers are defined but no improper style is set");
}
}
/* ---------------------------------------------------------------------- */