Commit 996c62f4 authored by jrgissing's avatar jrgissing
Browse files

fix bond/react: generalized classical chemical reactions

parent 3d63c29a
Loading
Loading
Loading
Loading
+206 −0
Original line number Diff line number Diff line
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

fix bond/react command :h3

[Syntax:]

fix ID group-ID bond/react common_keyword values ...
  react react-ID react-group-ID Nevery Rmin template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values ...
  react react-ID react-group-ID Nevery Rmin template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values ...
  react react-ID react-group-ID Nevery Rmin template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values ...
  ... :pre

ID, group-ID are documented in "fix"_fix.html command. Group-ID is ignored. :ulb,l
bond/react = style name of this fix command :l
zero or more common keyword/value pairs may be appended directly after 'bond/react' :l
these apply to all reaction specifications (below) :l
common_keyword = {stabilization}
  {stabilization} values = group-ID xmax
    group-ID = user-assigned ID of an internally-created dynamic group that excludes reacting atoms, and can be used by a subsequent time integration fix such as nvt, npt, or nve (cannot be 'all')
  {xmax} value = distance
    distance = xmax value that is used by an internally created "nve/limit"_nve_limit.html integrator
react = mandatory argument indicating new reaction specification
  react-ID = user-assigned name for the reaction
  react-group-ID = only atoms in this group are available for the reaction
  Nevery = attempt reaction every this many steps :l
  Rmin = bonding pair atoms separated by less than Rmin can initiate reaction (distance units) :l
  template-ID(pre-reacted) = ID of a molecule template containing pre-reaction topology :l
  template-ID(post-reacted) = ID of a molecule template containing post-reaction topology :l
  map_file = name of file specifying corresponding atomIDs in the pre- and post-reacted templates :l
  zero or more individual keyword/value pairs may be appended to each react argument :l
  individual_keyword = {prob} or {stabilize_steps} :l
    {prob} values = fraction seed
      fraction = initiate reaction with this probability if otherwise eligible
      seed = random number seed (positive integer)
    {stabilize_steps} value = timesteps
      timesteps = number of timesteps to apply internally created nve/limit:pre
:ule

[Examples:]

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

molecule mol1 pre_reacted_rxn1.txt
molecule mol2 post_reacted_rxn1.txt
molecule mol3 pre_reacted_rxn2.txt
molecule mol4 post_reacted_rxn2.txt
fix 5 all bond/react stabilization yes nvt_grp .03 &
  react myrxn1 all 1 3.25 mol1 mol2 map_file_rxn1.txt prob 0.50 12345 &
  react myrxn2 all 1 2.75 mol3 mol4 map_file_rxn2.txt prob 0.25 12345
fix 6 nvt_grp nvt temp 300 300 100 # system-wide thermostat must be defined after bond/react :pre

[Description:]

Initiate complex covalent bonding (topology) changes. These topology changes will be referred to as "reactions" throughout this documentation. Topology changes are defined in pre- and post-reaction molecule templates and can include creation and deletion of bonds, angles, dihedrals, impropers, bond-types, angle-types, dihedral-types, atom-types, or atomic charges.

Fix bond/react does not use quantum mechanical (eg. fix qmmm) or pairwise bond-order potential (eg. Tersoff or AIREBO) methods to determine bonding changes a priori. Rather, it uses a distance-based probabilistic criteria to effect predetermined topology changes in simulations using standard force fields.

This fix was created to facilitate the dynamic creation of polymeric, amorphous or highly-crosslinked systems. A suggested workflow for using this fix is: 1) identify a reaction to be simulated 2) build a molecule template of the reaction site before the reaction has occurred 3) build a molecule template of the reaction site after the reaction has occurred 4) create a map that relates the template-atom-IDs of each atom between pre- and post-reaction molecule templates 5) fill a simulation box with molecules and run a simulation with fix/bond react.

Only one 'fix bond/react' command can be used at a time. Multiple reactions can be simultaneously applied by specifying multiple 'react' arguments to a single 'fix bond/react' command. This syntax is necessary because the ‘common keywords’ are applied to all reactions.

The {stabilization} keyword enables reaction site stabilization. Reaction site stabilization is performed by including reacting atoms in an internally created fix "nve/limit"_fix_nve_limit.html time integrator for a set number of timesteps given by the {stabilize_steps} keyword. While reacting atoms are being time integrated by the internal nve/limit, they are prevented from being involved in any new reactions. The {xmax} value keyword should typically be set to the maximum distance that non-reacting atoms move during the simulation.

The group-ID set using the {stabilization} keyword should be a previously unused group-ID. The fix bond/react command creates a "dynamic group"_group.html of this name that excludes reacting atoms. This dynamic group-ID should then be used by a subsequent system-wide time integrator, as shown in the second example above. It is necessary to place the time integration command after the fix bond/react command due to the internal dynamic grouping performed by fix bond/react.

The following comments pertain to each 'react' argument:

A check for possible new reaction sites is performed every Nevery timesteps.

Two conditions must be met for a reaction to occur. First a bonding atom pair must be identified. Second, the topology surrounding the bonding atom pair must match the topology of the pre-reaction template. If both these conditions are met, the reaction site is modified to match the post-reaction template.

A bonding atom pair will be identified if several conditions are met. First, a pair of atoms within the specified react-group-ID of type typei and typej must be within a distance Rmin of each other. The atom types typei and typej are specified in the pre- and post-reaction templates. The distance calculation uses the pair neighbor list, therefore bonded neighbor exclusions may prevent a reaction between 1st, 2nd or 3rd bonded neighbor atoms. If multiple bonding atom pairs are identified for an atom, the closest bonding atom partner is set as its "nearest" bonding partner. Then, if both an atomi and atomj 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.

The pre-reacted molecule template is specified by a molecule command. This molecule template file contains a sample reaction site and its surrounding topology. As described below, the bonding atom pairs of the pre-reacted template are specified by atom ID in the map file. The pre-reacted molecule template should contain as few atoms as possible while still completely describing the topology of all atoms affected by the reaction. For example, if the force field contains dihedrals, the pre-reacted template should contain any atom within three bonds of reacting atoms.

Some atoms in the pre-reacted template that are not reacting may have missing topology with respect to the simulation. For example, the pre-reacted template may contain an atom that would connect to the rest of a long polymer chain. These are referred to as edge atoms, and are also specified in the map file.

Note that some care must be taken when a building a molecule template for a given simulation. All atom types in the pre-reacted template must be the same as those of a potential reaction site in the simulation. A detailed discussion of matching molecule template atom types with the simulation is provided on the "molecule"_molecule.html command page.

The post-reacted molecule template contains a sample of the reaction site and its surrounding topology after the reaction has occurred. It must contain the same number of atoms as the pre-reacted template. A one-to-one correspondence between the atom IDs in the pre- and post-reacted templates is specified in the map file as described below. Note that during a reaction, an atom, bond, etc. type may change to one that was previously not present in the simulation. These new types must also be defined during the setup of a given simulation. A discussion of correctly handling this is also provided on the "molecule"_molecule.html command page.

The map file is a text document with the following format:

Format of the map file

A map file has a header and a body. The header appears first. The first line of the header is always skipped; it typically contains a description of the file.  Lines can have a trailing comment starting with '#' that is ignored. If the line is blank (only whitespace after comment is deleted), it is skipped. If the line contains a header keyword, the corresponding value(s) is read from the line. If it doesn’t contain a header keyword, the line begins the body of the file.

The header contains one mandatory keyword and one optional keyword. The mandatory keyword is 'equivalences' and the optional keyword is 'edgeIDs.' These specify the number of atoms in the pre- and post-reacted templates and the number of edge atoms in pre-reacted template, respectively.

The body contains two mandatory sections and one optional section. The first section begins with the keyword 'BondingIDs' and lists the atom IDs of the bonding atom pair in the pre-reacted molecule template. The second mandatory section begins with the keyword 'Equivalences' and lists a one-to-one correspondence between atom IDs of the pre- and post-reacted templates. The optional section begins with the keyword 'EdgeIDs' and list the atom IDs of edge atoms in the pre-reacted molecule template.

Format of the header of the map file

These are the recognized header keywords. Header lines can come in any order. The value(s) are read from the beginning of the line. Thus the keyword 'equivalences' should be in a line like "25 equivalences."

equivalences = # of atoms in the pre- and post-reacted molecule templates
edgeIDs = # of edge atoms in the pre-reacted molecule template

The edgeIDs keyword is optional.

Format of the body of the map file

These are the section keywords for the body of the file.

BondingIDs, EdgeIDs = list of atom IDs of bonding and edge atoms in the pre-reacted molecule template

Equivalences = a two column list where the first column is an atom ID of the pre-reacted
molecule template, and the second column is the corresponding atom ID of the post-reacted
molecule template

The bondingIDs section will always contain two atom IDs, corresponding to the bonding atom pairs of the pre-reacted map file. The Equivalences section will contain as many rows as there are atoms in the pre- and post-reacted molecule templates. The edgeIDs section is optional, but would contain an atom ID for each edge atom in the pre-reacted molecule template.

A sample map file is given below:

---------------
this is a map file

2 edgeIDs
7 equivalences

BondingIDs

3
5

EdgeIDs

1
7

Equivalences

1   1
2   2
3   3
4   4
5   5
6   6
7   7
---------------

Once a reaction site has been successfully identified, data structures within LAMMPS that store bond topology are updated to reflect the post-reacted molecule template. All force fields with fixed bonds, angles, dihedrals or impropers are supported.

A few capabilities to note: 1) You may specify as many 'react' arguments as desired. For example, you could break down a complicated reaction mechanism into several reaction steps, each defined by a fix bond/react. 2) While typically a bond is formed between the bonding atom pairs specified in the pre-reacted molecule template, this is not required. 3) By reversing the order of the pre- and post-reacted molecule template in another fix bond/react command, you can allow for the possibility of one or more reverse reactions.

The optional keywords deal with the probability of a given reaction occurring as well as the stable equilibration of each reaction site as it occurs.

The {prob} keyword can affect whether an eligible reaction actually occurs. The fraction setting must be a value between 0.0 and 1.0. A uniform random number between 0.0 and 1.0 is generated and the eligible reaction only occurs if the random number is less than the fraction.

The {stabilize_steps} keyword allows for the specification of how many timesteps a reaction site is stabilized before being returned to the overall system thermostat.

In order to produce the most physical behavior, this 'reaction site equilibration time' should be tuned to be as small as possible while retaining stability for a given system or reaction step. After a limited number of case studies, this number has been set to a default of 60 timesteps. Ideally, it should be individually tuned for each fix bond/react. Note that in some situations, decreasing rather than increasing this parameter will result in an increase in stability.

A few other considerations:

It may be beneficial to ensure reacting atoms are at a certain temperature before being released to the overall thermostat. For this, you can use the internally-created dynamic group named "bond_react_MASTER_group." For example, adding the following command would thermostat the group of all atoms currently involved in a reaction:

fix 1 bond_react_MASTER_group temp/rescale 1 300 300 10 1

NOTE: This command must be added after the fix bond/react command, and will apply to all reaction specifications.

Computationally, each timestep this fix operates, it loops over neighbor lists and computes distances between pairs of atoms in the list. It also communicates between neighboring processors to coordinate which bonds are created. All of these operations increase the cost of a timestep. Thus you should be cautious about invoking this fix too frequently.

You can dump out snapshots of the current bond topology via the dump local command.

:line

[Restart, fix_modify, output, run start/stop, minimize info:]

No information about this fix is written to "binary restart files"_restart.html.  None of the "fix_modify"_fix_modify.html options are relevant to this fix.

This fix computes one statistic for each 'react' argument that it stores in a global vector, of length 'number of react arguments', that can be accessed by various "output commands"_Section_howto.html#howto_15. The vector values calculated by this fix are "intensive".

These is 1 quantity for each react argument:

(1) cumulative # of reactions occurred :ul

No parameter of this fix can be used with the {start/stop} keywords of the "run"_run.html command.  This fix is not invoked during "energy minimization"_minimize.html.

[Restrictions:]

This fix is part of the MC package.  It is only enabled if LAMMPS was built with that package.  See the "Making LAMMPS"_Section_start.html#start_3 section for more info.

[Related commands:]

"fix bond/create"_fix_bond_create.html,
"fix bond/break"_fix_bond_break.html, "fix
bond/swap"_fix_bond_swap.html, "dump local"_dump.html,
"special_bonds"_special_bonds.html

[Default:]

The option defaults are stabilization = no, stabilize_steps = 60

:line

:link(Gissinger)
[(Gissinger)] Gissinger, Jensen and Wise, Polymer, 128, 211 (2017).
+51 −0
Original line number Diff line number Diff line
# Jake practice run

units real

boundary p p p

atom_style full

log testing_log

kspace_style pppm 1.0e-2 # actually, this appears required to make LAMMPS to check 1-3 neighbors

pair_style lj/class2/coul/long 8.5

angle_style class2

bond_style class2

dihedral_style class2

improper_style class2

read_data tiny_nylon.data

velocity all create 300.0 4928459 dist gaussian

molecule mol1 rxn1_stp1_unreacted.data_template
molecule mol2 rxn1_stp1_reacted.data_template
molecule mol3 rxn1_stp2_unreacted.data_template
molecule mol4 rxn1_stp2_reacted.data_template

thermo 50

dump 1 all xyz 1 test_vis.xyz

fix myrxns all bond/react stabilization yes statted_grp .03 &
  react rxn1 all 1 2.9 mol1 mol2 rxn1_stp1_map &
  react rxn2 all 1 5 mol3 mol4 rxn1_stp2_map

fix 1 statted_grp nvt temp 300 300 100

fix 4 bond_react_MASTER_group temp/rescale 1 300 300 10 1

thermo_style custom step temp press density f_myrxns[1] f_myrxns[2]

restart 100 restart1 restart2

run 10000

write_restart restart_longrun
write_data restart_longrun.data
+35 −0
Original line number Diff line number Diff line
this is a marvellous superimpose file

2 edgeIDs
18 equivalences

BondingIDs

10
1

EdgeIDs

16
8

Equivalences

1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
10	10
11	11
12	12
13	13
14	14
15	15
16	16
17	17
18	18
+189 −0
Original line number Diff line number Diff line
LAMMPS data file. msi2lmp v3.9.6 / 11 Sep 2014 / CGCMM for rxn1_stp1_reacted

18 atoms           
17 bonds           
31 angles           
39 dihedrals           
20 impropers           

Types

1 9
2 1
3 1
4 8
5 8
6 4
7 4
8 1
9 1
10 2
11 6
12 3
13 4
14 4
15 5
16 1
17 4
18 4

Charges

1 -0.300000
2 0.000000
3 0.000000
4 0.000000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.300000
11 0.000000
12 0.000000
13 0.000000
14 0.000000
15 0.000000
16 0.000000
17 0.000000
18 0.000000

Coords

1 -5.522237 -0.752722 1.631158
2 -5.170398 -0.545733 0.178130
3 -6.469695 -0.553072 -0.648889
4 -6.052076 -1.721152 1.744648
5 -6.183059 0.071387 1.971497
6 -4.489340 -1.389197 -0.173156
7 -4.637591 0.453703 0.051252
8 -5.618658 0.138919 4.386107
9 -4.669492 -0.989819 3.943591
10 -4.270194 -0.766405 2.474102
11 -3.348470 -1.875393 2.024289
12 -3.569794 0.564183 2.345995
13 -5.201079 -1.993301 4.044219
14 -3.736682 -0.984819 4.598305
15 -4.255402 1.370923 2.679069
16 -6.136394 -0.339866 -2.136775
17 -6.996331 -1.555519 -0.517408
18 -7.153308 0.284949 -0.289930

Bonds

1 11 1 2
2 12 1 4
3 12 1 5
4 13 1 10
5 2 2 3
6 1 2 6
7 1 2 7
8 2 3 16
9 1 3 17
10 1 3 18
11 2 8 9
12 4 9 10
13 1 9 13
14 1 9 14
15 5 10 11
16 3 10 12
17 6 12 15

Angles

1 17 2 1 4
2 17 2 1 5
3 18 2 1 10
4 19 4 1 5
5 20 4 1 10
6 20 5 1 10
7 21 1 2 3
8 22 1 2 6
9 22 1 2 7
10 2 3 2 6
11 2 3 2 7
12 1 6 2 7
13 3 2 3 16
14 2 2 3 17
15 2 2 3 18
16 2 16 3 17
17 2 16 3 18
18 1 17 3 18
19 8 8 9 10
20 2 8 9 13
21 2 8 9 14
22 23 13 9 10
23 23 14 9 10
24 1 13 9 14
25 6 9 10 11
26 4 9 10 12
27 24 1 10 9
28 25 11 10 12
29 26 1 10 11
30 27 1 10 12
31 7 10 12 15

Dihedrals

1 19 4 1 2 3
2 20 4 1 2 6
3 20 4 1 2 7
4 19 5 1 2 3
5 20 5 1 2 6
6 20 5 1 2 7
7 21 10 1 2 3
8 22 10 1 2 6
9 22 10 1 2 7
10 23 2 1 10 9
11 24 2 1 10 11
12 25 2 1 10 12
13 26 4 1 10 9
14 27 4 1 10 11
15 28 4 1 10 12
16 26 5 1 10 9
17 27 5 1 10 11
18 28 5 1 10 12
19 29 1 2 3 16
20 30 1 2 3 17
21 30 1 2 3 18
22 4 16 3 2 6
23 2 6 2 3 17
24 2 6 2 3 18
25 4 16 3 2 7
26 2 7 2 3 17
27 2 7 2 3 18
28 10 8 9 10 11
29 8 8 9 10 12
30 31 8 9 10 1
31 11 13 9 10 11
32 9 13 9 10 12
33 32 13 9 10 1
34 11 14 9 10 11
35 9 14 9 10 12
36 32 14 9 10 1
37 6 9 10 12 15
38 7 11 10 12 15
39 33 1 10 12 15

Impropers

1 1 2 1 4 5
2 1 2 1 4 10
3 1 2 1 5 10
4 1 4 1 5 10
5 1 1 2 3 6
6 1 1 2 3 7
7 1 1 2 6 7
8 1 3 2 6 7
9 1 2 3 16 17
10 1 2 3 16 18
11 1 2 3 17 18
12 1 16 3 17 18
13 1 8 9 13 10
14 1 8 9 14 10
15 1 8 9 13 14
16 1 13 9 14 10
17 1 9 10 11 12
18 1 1 10 9 11
19 1 1 10 9 12
20 1 1 10 11 12
+160 −0
Original line number Diff line number Diff line
LAMMPS data file. msi2lmp v3.9.6 / 11 Sep 2014 / CGCMM for rxn1_stp1_unreacted

18 atoms           
16 bonds           
25 angles           
23 dihedrals           
14 impropers           

Types

1 7
2 1
3 1
4 8
5 8
6 4
7 4
8 1
9 1
10 2
11 6
12 3
13 4
14 4
15 5
16 1
17 4
18 4

Charges

1 -0.300000
2 0.000000
3 0.000000
4 0.000000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.300000
11 0.000000
12 0.000000
13 0.000000
14 0.000000
15 0.000000
16 0.000000
17 0.000000
18 0.000000

Coords

1 -4.922858 -0.946982 1.146055
2 -5.047195 -0.935267 -0.358173
3 -6.526281 -0.755366 -0.743523
4 -5.282604 0.020447 1.552710
5 -3.860697 -1.095850 1.428305
6 -4.662382 -1.920900 -0.781524
7 -4.433977 -0.072765 -0.784071
8 -5.506279 0.202610 4.825816
9 -4.449177 -0.844592 4.423366
10 -4.103916 -0.749629 2.925195
11 -3.376249 -1.886171 2.245643
12 -4.493235 0.477214 2.137199
13 -4.849053 -1.888877 4.663994
14 -3.491823 -0.662913 5.018510
15 -5.020777 1.189745 2.805427
16 -3.964987 2.900602 -1.551341
17 -4.460694 2.836102 0.668882
18 -4.828494 3.219656 -0.122111

Bonds

1 14 1 2
2 10 1 4
3 10 1 5
4 2 2 3
5 1 2 6
6 1 2 7
7 2 3 16
8 1 3 17
9 1 3 18
10 2 8 9
11 4 9 10
12 1 9 13
13 1 9 14
14 5 10 11
15 3 10 12
16 6 12 15

Angles

1 15 2 1 4
2 15 2 1 5
3 16 4 1 5
4 28 1 2 3
5 14 1 2 6
6 14 1 2 7
7 2 3 2 6
8 2 3 2 7
9 1 6 2 7
10 3 2 3 16
11 2 2 3 17
12 2 2 3 18
13 2 16 3 17
14 2 16 3 18
15 1 17 3 18
16 8 8 9 10
17 2 8 9 13
18 2 8 9 14
19 23 13 9 10
20 23 14 9 10
21 1 13 9 14
22 6 9 10 11
23 4 9 10 12
24 25 11 10 12
25 7 10 12 15

Dihedrals

1 34 4 1 2 3
2 35 4 1 2 6
3 35 4 1 2 7
4 34 5 1 2 3
5 35 5 1 2 6
6 35 5 1 2 7
7 36 1 2 3 16
8 12 1 2 3 17
9 12 1 2 3 18
10 4 16 3 2 6
11 2 6 2 3 17
12 2 6 2 3 18
13 4 16 3 2 7
14 2 7 2 3 17
15 2 7 2 3 18
16 10 8 9 10 11
17 8 8 9 10 12
18 11 13 9 10 11
19 9 13 9 10 12
20 11 14 9 10 11
21 9 14 9 10 12
22 6 9 10 12 15
23 7 11 10 12 15

Impropers

1 6 2 1 4 5
2 11 9 10 11 12
3 1 1 2 3 6
4 1 1 2 3 7
5 1 1 2 6 7
6 1 3 2 6 7
7 1 2 3 16 17
8 1 2 3 16 18
9 1 2 3 17 18
10 1 16 3 17 18
11 1 8 9 13 10
12 1 8 9 14 10
13 1 8 9 13 14
14 1 13 9 14 10
Loading