forked from lijiext/lammps
reset_mol_ids: unique created computes
This commit is contained in:
parent
c9773fc288
commit
6fc2ab07ef
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue