Commit f7aa01d7 authored by jrgissing's avatar jrgissing
Browse files

bond/react: convert group-ID to group-ID-prefix

enables consistent syntax when using custom groups
parent 0c7c344e
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -24,11 +24,11 @@ common_keyword = {stabilization} :l
  {stabilization} values = {no} or {yes} {group-ID} {xmax}
    {no} = no reaction site stabilization
    {yes} = perform reaction site stabilization
      {group-ID} = user-assigned ID for all non-reacting atoms (group created internally)
      {group-ID} = user-assigned prefix for the dynamic group of non-reacting atoms
      {xmax} = xmax value that is used by an internally created "nve/limit"_fix_nve_limit.html integrator :pre
react = mandatory argument indicating new reaction specification :l
  react-ID = user-assigned name for the reaction :l
  react-group-ID = only atoms in this group are available for the reaction :l
  react-group-ID = only atoms in this group are considered for the reaction :l
  Nevery = attempt reaction every this many steps :l
  Rmin = bonding pair atoms must be separated by more than Rmin to initiate reaction (distance units) :l
  Rmax = bonding pair atoms must be separated by less than Rmax to initiate reaction (distance units) :l
@@ -51,7 +51,7 @@ react = mandatory argument indicating new reaction specification :l

molecule mol1 pre_reacted_topology.txt
molecule mol2 post_reacted_topology.txt
fix 5 all bond/react stabilization no react myrxn1 all 1 0 3.25 mol1 mol2 map_file.txt :pre
fix 5 all bond/react react myrxn1 all 1 0 3.25 mol1 mol2 map_file.txt :pre

molecule mol1 pre_reacted_rxn1.txt
molecule mol2 post_reacted_rxn1.txt
@@ -60,7 +60,7 @@ molecule mol4 post_reacted_rxn2.txt
fix 5 all bond/react stabilization yes nvt_grp .03 &
  react myrxn1 all 1 0 3.25 mol1 mol2 map_file_rxn1.txt prob 0.50 12345 &
  react myrxn2 all 1 0 2.75 mol3 mol4 map_file_rxn2.txt prob 0.25 12345
fix 6 nvt_grp nvt temp 300 300 100 # set thermostat after bond/react :pre
fix 6 nvt_grp_REACT nvt temp 300 300 100 # set thermostat after bond/react :pre

[Description:]

@@ -104,20 +104,22 @@ during the simulation.

The group-ID set using the {stabilization} keyword can be an existing
static group or a previously-unused group-ID. It cannot be specified
as 'all'. If the group-ID is previously unused, fix bond/react command
creates a "dynamic group"_group.html of this name that is initialized
to include all atoms. If the group-ID is that of an existing static
group, the group is converted into a dynamic group, whose atoms are
limited to those belonging to the original static group. In either
case, this dynamic group-ID should then be used by a subsequent
system-wide time integrator such as nvt, npt, or nve, as shown in the
second example above. The time integration command should be placed
after the fix bond/react command due to the internal dynamic grouping
performed by fix bond/react. By specifying an existing group, you may
thermostat non-reacting parts of your system separately.
as 'all'. If the group-ID is previously unused, the fix bond/react
command creates a "dynamic group"_group.html that is initialized to
include all atoms. If the group-ID is that of an existing static
group, the group is used as the parent group of new,
internally-created dynamic group. In both cases, this new dynamic
group is named by appending '_REACT' to the group-ID, e.g.
nvt_grp_REACT. By specifying an existing group, you may thermostat
constant-topology parts of your system separately. The dynamic group
contains only non-reacting atoms at a given timestep, and therefore
should be used by a subsequent system-wide time integrator such as
nvt, npt, or nve, as shown in the second example above. The time
integration command should be placed after the fix bond/react command
due to the internal dynamic grouping performed by fix bond/react.

NOTE: If the group-ID is an existing static group, react-group-IDs
should also be specified as this group, or a subset.
should also be specified as this static group, or a subset.

NOTE: If the group-ID is previously unused, the internally created
group applies to all atoms in the system, i.e. you should generally
+19 −19
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :

  fix1 = NULL;
  fix2 = NULL;
  fix3 = NULL;

  if (narg < 8) error->all(FLERR,"Illegal fix bond/react command: "
                           "too few arguments");
@@ -433,11 +434,9 @@ FixBondReact::~FixBondReact()
    if (id_fix1 == NULL && modify->nfix) modify->delete_fix(id_fix1);
    delete [] id_fix1;

    if (custom_exclude_flag == 0) {
    if (id_fix3 == NULL && modify->nfix) modify->delete_fix(id_fix3);
    delete [] id_fix3;
  }
  }

  if (id_fix2 == NULL && modify->nfix) modify->delete_fix(id_fix2);
  delete [] id_fix2;
@@ -512,14 +511,14 @@ void FixBondReact::post_constructor()
      ifix = modify->find_fix(id_fix3);
      if (ifix == -1) {
        char **newarg = new char*[6];
        newarg[0] = (char *) "bond_react_stabilization_internal";
        newarg[0] = (char *) id_fix3;
        newarg[1] = (char *) "all"; // group ID is ignored
        newarg[2] = (char *) "property/atom";
        newarg[3] = (char *) "i_statted_tags";
        newarg[4] = (char *) "ghost";
        newarg[5] = (char *) "yes";
        modify->add_fix(6,newarg);
        fix2 = modify->fix[modify->nfix-1];
        fix3 = modify->fix[modify->nfix-1];
        delete [] newarg;
      }

@@ -527,17 +526,17 @@ void FixBondReact::post_constructor()
      statted_id = new char[len];
      strcpy(statted_id,"statted_tags");

      // if static group exists, duplicate it, use duplicate as parent group
      // original will be converted into dynamic per-atom property group
      if (igroup != -1) {
        char **newarg;
        newarg = new char*[3];
        newarg[0] = (char *) "exclude_PARENT_group";
        newarg[1] = (char *) "union";
        newarg[2] = exclude_group;
        group->assign(3,newarg);
        delete [] newarg;
      }
      // if static group exists, use as parent group
      // also, rename dynamic exclude_group by appending '_REACT'
      char *exclude_PARENT_group;
      int n = strlen(exclude_group) + 1;
      exclude_PARENT_group = new char[n];
      strcpy(exclude_PARENT_group,exclude_group);
      n += strlen("_REACT");
      delete [] exclude_group;
      exclude_group = new char[n];
      strcpy(exclude_group,exclude_PARENT_group);
      strcat(exclude_group,"_REACT");

      group->find_or_create(exclude_group);
      char **newarg;
@@ -545,16 +544,17 @@ void FixBondReact::post_constructor()
      newarg[0] = exclude_group;
      newarg[1] = (char *) "dynamic";
      if (igroup == -1) newarg[2] = (char *) "all";
      else newarg[2] = (char *) "exclude_PARENT_group";
      else newarg[2] = (char *) exclude_PARENT_group;
      newarg[3] = (char *) "property";
      newarg[4] = (char *) "statted_tags";
      group->assign(5,newarg);
      delete [] newarg;
      delete [] exclude_PARENT_group;

      // on to statted_tags (system-wide thermostat)
      // intialize per-atom statted_flags to 1
      // (only if not already initialized by restart)
      if (fix2->restart_reset != 1) {
      if (fix3->restart_reset != 1) {
        int flag;
        int index = atom->find_custom("statted_tags",flag);
        int *i_statted_tags = atom->ivector[index];
+3 −3
Original line number Diff line number Diff line
@@ -78,9 +78,9 @@ class FixBondReact : public Fix {
  class Molecule *onemol; // pre-reacted molecule template
  class Molecule *twomol; // post-reacted molecule template
  Fix *fix1;              // nve/limit used to relax reaction sites
  Fix *fix2;              // properties/atom used to indicate 1) indicate relaxing atoms
                          //                                  2) system-wide thermostat
                          //                                  3) to which 'react' atom belongs
  Fix *fix2;              // properties/atom used to indicate 1) relaxing atoms
                          //                                  2) to which 'react' atom belongs
  Fix *fix3;              // property/atom used for system-wide thermostat
  class RanMars **random;
  class NeighList *list;