diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 2e59b11aea4f7b4e41e0dc098cf167709aa4fc97..4752002ac9319d4096fbeb5f1a3f1c4ae5d6ef83 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -75,6 +75,8 @@ void CreateBonds::command(int narg, char **arg) btype = force->inumeric(FLERR,arg[1]); batom1 = force->tnumeric(FLERR,arg[2]); batom2 = force->tnumeric(FLERR,arg[3]); + if (batom1 == batom2) + error->all(FLERR,"Illegal create_bonds command"); iarg = 4; } else if (strcmp(arg[0],"single/angle") == 0) { style = SANGLE; @@ -83,6 +85,8 @@ void CreateBonds::command(int narg, char **arg) aatom1 = force->tnumeric(FLERR,arg[2]); aatom2 = force->tnumeric(FLERR,arg[3]); aatom3 = force->tnumeric(FLERR,arg[4]); + if ((aatom1 == aatom2) || (aatom1 == aatom3) || (aatom2 == aatom3)) + error->all(FLERR,"Illegal create_bonds command"); iarg = 5; } else if (strcmp(arg[0],"single/dihedral") == 0) { style = SDIHEDRAL; @@ -92,6 +96,9 @@ void CreateBonds::command(int narg, char **arg) datom2 = force->tnumeric(FLERR,arg[3]); datom3 = force->tnumeric(FLERR,arg[4]); datom4 = force->tnumeric(FLERR,arg[5]); + if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) || + (datom2 == datom3) || (datom2 == datom4) || (datom3 == datom4)) + error->all(FLERR,"Illegal create_bonds command"); iarg = 6; } else error->all(FLERR,"Illegal create_bonds command");