diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 57bc42cffd..a1154c9221 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -171,7 +171,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) { // default delete reset_mol_ids; reset_mol_ids = new ResetMolIDs(lmp); - reset_mol_ids->create_computes(group->names[igroup]); + reset_mol_ids->create_computes(id,group->names[igroup]); iarg += 2; } if (strcmp(arg[iarg+1],"no") == 0) { diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index efeb6a672a..1461a49f32 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -116,7 +116,7 @@ void ResetMolIDs::command(int narg, char **arg) // create computes - create_computes(groupid); + create_computes(NULL,groupid); // reset molecule IDs @@ -140,22 +140,23 @@ void ResetMolIDs::command(int narg, char **arg) create computes used by reset_mol_ids ------------------------------------------------------------------------- */ -void ResetMolIDs::create_computes(char *groupid) +void ResetMolIDs::create_computes(char *fixid, char *groupid) { int igroup = group->find(groupid); if (igroup == -1) error->all(FLERR,"Could not find reset_mol_ids group ID"); groupbit = group->bitmask[igroup]; // create instances of compute fragment/atom, compute reduce (if needed), - // and compute chunk/atom. all use the group-ID for this command + // and compute chunk/atom. all use the group-ID for this command. + // 'fixid' allows for creating independent instances of the computes - idfrag = "reset_mol_ids_FRAGMENT_ATOM"; + idfrag = fmt::format("{}_reset_mol_ids_FRAGMENT_ATOM",fixid); if (singleflag) modify->add_compute(fmt::format("{} {} fragment/atom single yes",idfrag,groupid)); else modify->add_compute(fmt::format("{} {} fragment/atom single no",idfrag,groupid)); - idchunk = "reset_mol_ids_CHUNK_ATOM"; + idchunk = fmt::format("{}_reset_mol_ids_CHUNK_ATOM",fixid); if (compressflag) modify->add_compute(fmt::format("{} {} chunk/atom molecule compress yes", idchunk,groupid)); diff --git a/src/reset_mol_ids.h b/src/reset_mol_ids.h index 62543f6eda..9d2dd24bc8 100644 --- a/src/reset_mol_ids.h +++ b/src/reset_mol_ids.h @@ -30,7 +30,7 @@ class ResetMolIDs : protected Pointers { ResetMolIDs(class LAMMPS *); ~ResetMolIDs(); void command(int, char **); - void create_computes(char *); + void create_computes(char *, char *); void reset(); private: