From 1f0194a2188c763d38842fbb22ddc05fa4dfe8ba Mon Sep 17 00:00:00 2001 From: Sieds Lykles <93992551+S-Lykles@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:50:03 +0100 Subject: [PATCH] Add template compatibility check to create_atoms mol --- src/create_atoms.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 03b3c7b78c..3718b6deb1 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -175,6 +175,7 @@ void CreateAtoms::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg], "mol") == 0) { if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "create_atoms mol", error); + int molecular = atom->molecular; int imol = atom->find_molecule(arg[iarg + 1]); if (imol == -1) error->all(FLERR, "Molecule template ID {} for create_atoms does not exist", arg[iarg + 1]); @@ -183,6 +184,9 @@ void CreateAtoms::command(int narg, char **arg) "Only the first set will be used."); mode = MOLECULE; onemol = atom->molecules[imol]; + if ((molecular == Atom::TEMPLATE) && (onemol != atom->avec->onemols[0])) + error->all(FLERR, "When using atom style template, create_atoms must use the same " + "molecule template as the atom style"); molseed = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); iarg += 3; } else if (strcmp(arg[iarg], "units") == 0) {