Unverified Commit c8f113f4 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1333 from jrgissing/bond/react-revert_bond_forming_behavior

Bond/react: revert bond-forming reaction behavior
parents 14667749 d0897973
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -146,18 +146,18 @@ A bonding atom pair will be identified if several conditions are met.
First, a pair of atoms I,J within the specified react-group-ID of type
itype and jtype must be separated by a distance between {Rmin} and
{Rmax}. It is possible that multiple bonding atom pairs are
identified: if the bonding atoms in the pre-reacted template are not
1-2, 1-3, or 1-4 neighbors, the closest bonding atom partner is set as
its bonding partner; otherwise, the farthest potential partner is
chosen. Then, if both an atom I and atom J have each other as their
nearest bonding partners, these two atoms are identified as the
bonding atom pair of the reaction site. Once this unique bonding atom
pair is identified for each reaction, there could two or more
reactions that involve a given atom on the same timestep. If this is
the case, only one such reaction is permitted to occur. This reaction
is chosen randomly from all potential reactions. This capability
allows e.g. for different reaction pathways to proceed from identical
reaction sites with user-specified probabilities.
identified: if the bonding atoms in the pre-reacted template are  1-2
neighbors, i.e. directly bonded, the farthest bonding atom partner is
set as its bonding partner; otherwise, the closest potential partner
is chosen. Then, if both an atom I and atom J have each other as their
bonding partners, these two atoms are identified as the bonding atom
pair of the reaction site. Once this unique bonding atom pair is
identified for each reaction, there could two or more reactions that
involve a given atom on the same timestep. If this is the case, only
one such reaction is permitted to occur. This reaction is chosen
randomly from all potential reactions. This capability allows e.g. for
different reaction pathways to proceed from identical reaction sites
with user-specified probabilities.

The pre-reacted molecule template is specified by a molecule command.
This molecule template file contains a sample reaction site and its
+21 −10
Original line number Diff line number Diff line
@@ -1022,6 +1022,7 @@ void FixBondReact::close_partner()
      rsq = delx*delx + dely*dely + delz*delz;
      if (rsq >= cutsq[rxnID][1] || rsq <= cutsq[rxnID][0]) continue;

      if (closeneigh[rxnID] == 0) {
        if (rsq > distsq[i1][0]) {
          partner[i1] = tag[i2];
          distsq[i1][0] = rsq;
@@ -1030,6 +1031,16 @@ void FixBondReact::close_partner()
          partner[i2] = tag[i1];
          distsq[i2][0] = rsq;
        }
      } else {
        if (rsq < distsq[i1][1]) {
          partner[i1] = tag[i2];
          distsq[i1][1] = rsq;
        }
        if (rsq < distsq[i2][1]) {
          partner[i2] = tag[i1];
          distsq[i2][1] = rsq;
        }
      }
    }
  }
}
@@ -3027,7 +3038,7 @@ int FixBondReact::pack_reverse_comm(int n, int first, double *buf)

  for (i = first; i < last; i++) {
    buf[m++] = ubuf(partner[i]).d;
    if (closeneigh[rxnID] < 0)
    if (closeneigh[rxnID] != 0)
      buf[m++] = distsq[i][1];
    else
      buf[m++] = distsq[i][0];
@@ -3046,7 +3057,7 @@ void FixBondReact::unpack_reverse_comm(int n, int *list, double *buf)
  if (commflag != 1) {
    for (i = 0; i < n; i++) {
      j = list[i];
      if (closeneigh[rxnID] < 0)
      if (closeneigh[rxnID] != 0)
        if (buf[m+1] < distsq[j][1]) {
        partner[j] = (tagint) ubuf(buf[m++]).i;
          distsq[j][1] = buf[m++];