better place for error check

This commit is contained in:
Jacob Gissinger
2024-08-15 19:09:16 -04:00
parent 27bf4d7974
commit c68ea4fe1e

View File

@ -486,10 +486,6 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
get_molxspecials();
read_map_file(i);
fclose(fp);
if (ncreate == 0 && onemol->natoms != twomol->natoms)
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
iatomtype[i] = onemol->type[ibonding[i]-1];
jatomtype[i] = onemol->type[jbonding[i]-1];
find_landlocked_atoms(i);
@ -3967,6 +3963,11 @@ void FixBondReact::read_map_file(int myrxn)
} else break;
}
if (ncreate == 0 && onemol->natoms != twomol->natoms)
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
// grab keyword and skip next line
parse_keyword(0,line,keyword);