Unverified Commit 7bf2b997 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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.
parent 2b8f300c
Loading
Loading
Loading
Loading
+22 −0
Original line number Original line Diff line number Diff line
@@ -196,6 +196,28 @@ void Force::init()
  if (angle) angle->init();
  if (angle) angle->init();
  if (dihedral) dihedral->init();
  if (dihedral) dihedral->init();
  if (improper) improper->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");
  }
}
}


/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */