Skip to content
Snippets Groups Projects
Commit 69a9f1bf authored by jrgissing's avatar jrgissing
Browse files

molecule templates sanity checks

parent e7773808
No related branches found
No related tags found
No related merge requests found
...@@ -771,8 +771,8 @@ void Molecule::bonds(int flag, char *line) ...@@ -771,8 +771,8 @@ void Molecule::bonds(int flag, char *line)
error->all(FLERR,"Invalid Bonds section in molecule file"); error->all(FLERR,"Invalid Bonds section in molecule file");
itype += boffset; itype += boffset;
if (atom1 <= 0 || atom1 > natoms || if ((atom1 <= 0) || (atom1 > natoms) ||
atom2 <= 0 || atom2 > natoms) (atom2 <= 0) || (atom2 > natoms) || (atom1 == atom2))
error->one(FLERR,"Invalid atom ID in Bonds section of molecule file"); error->one(FLERR,"Invalid atom ID in Bonds section of molecule file");
if (itype <= 0) if (itype <= 0)
error->one(FLERR,"Invalid bond type in Bonds section of molecule file"); error->one(FLERR,"Invalid bond type in Bonds section of molecule file");
...@@ -829,9 +829,10 @@ void Molecule::angles(int flag, char *line) ...@@ -829,9 +829,10 @@ void Molecule::angles(int flag, char *line)
error->all(FLERR,"Invalid Angles section in molecule file"); error->all(FLERR,"Invalid Angles section in molecule file");
itype += aoffset; itype += aoffset;
if (atom1 <= 0 || atom1 > natoms || if ((atom1 <= 0) || (atom1 > natoms) ||
atom2 <= 0 || atom2 > natoms || (atom2 <= 0) || (atom2 > natoms) ||
atom3 <= 0 || atom3 > natoms) (atom3 <= 0) || (atom3 > natoms) ||
(atom1 == atom2) || (atom1 == atom3) || (atom2 == atom3))
error->one(FLERR,"Invalid atom ID in Angles section of molecule file"); error->one(FLERR,"Invalid atom ID in Angles section of molecule file");
if (itype <= 0) if (itype <= 0)
error->one(FLERR,"Invalid angle type in Angles section of molecule file"); error->one(FLERR,"Invalid angle type in Angles section of molecule file");
...@@ -902,10 +903,12 @@ void Molecule::dihedrals(int flag, char *line) ...@@ -902,10 +903,12 @@ void Molecule::dihedrals(int flag, char *line)
error->all(FLERR,"Invalid Dihedrals section in molecule file"); error->all(FLERR,"Invalid Dihedrals section in molecule file");
itype += doffset; itype += doffset;
if (atom1 <= 0 || atom1 > natoms || if ((atom1 <= 0) || (atom1 > natoms) ||
atom2 <= 0 || atom2 > natoms || (atom2 <= 0) || (atom2 > natoms) ||
atom3 <= 0 || atom3 > natoms || (atom3 <= 0) || (atom3 > natoms) ||
atom4 <= 0 || atom4 > natoms) (atom4 <= 0) || (atom4 > natoms) ||
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
error->one(FLERR, error->one(FLERR,
"Invalid atom ID in dihedrals section of molecule file"); "Invalid atom ID in dihedrals section of molecule file");
if (itype <= 0) if (itype <= 0)
...@@ -989,10 +992,12 @@ void Molecule::impropers(int flag, char *line) ...@@ -989,10 +992,12 @@ void Molecule::impropers(int flag, char *line)
error->all(FLERR,"Invalid Impropers section in molecule file"); error->all(FLERR,"Invalid Impropers section in molecule file");
itype += ioffset; itype += ioffset;
if (atom1 <= 0 || atom1 > natoms || if ((atom1 <= 0) || (atom1 > natoms) ||
atom2 <= 0 || atom2 > natoms || (atom2 <= 0) || (atom2 > natoms) ||
atom3 <= 0 || atom3 > natoms || (atom3 <= 0) || (atom3 > natoms) ||
atom4 <= 0 || atom4 > natoms) (atom4 <= 0) || (atom4 > natoms) ||
(atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) ||
(atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4))
error->one(FLERR, error->one(FLERR,
"Invalid atom ID in impropers section of molecule file"); "Invalid atom ID in impropers section of molecule file");
if (itype <= 0) if (itype <= 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment