\(\renewcommand{\AA}{\text{Å}}\)

# fix bond/create command

# fix bond/create/angle command

## Syntax

    fix ID group-ID style Nevery itype jtype Rmin bondtype keyword values ...

- ID, group-ID are documented in fix command

- style = bond/create or bond/create/angle

- Nevery = attempt bond creation every this many steps

- itype,jtype = atoms of itype can bond to atoms of jtype (1-Ntypes or type label)

- Rmin = two atoms separated by less than Rmin can bond (distance units)

- bondtype = type of created bonds (integer or type label)

- zero or more keyword/value pairs may be appended to args

- keyword = iparam or jparam or prob or atype or dtype or itype or aconstrain or molecule

      iparam values = maxbond, newtype
        maxbond = max # of bonds of bondtype the itype atom can have
        newtype = change the itype atom to this type when maxbonds exist (1-Ntypes or type label)
      jparam values = maxbond, newtype
        maxbond = max # of bonds of bondtype the jtype atom can have
        newtype = change the jtype atom to this type when maxbonds exist (1-Ntypes or type label)
      prob values = fraction seed
        fraction = create a bond with this probability if otherwise eligible
        seed = random number seed (positive integer)
      atype value = angletype
        angletype = type of created angles (integer or type label)
      dtype value = dihedraltype
        dihedraltype = type of created dihedrals (integer or type label)
      itype value = impropertype
        impropertype = type of created impropers (integer or type label)
      aconstrain value = amin amax
        amin = minimal angle at which new bonds can be created
        amax = maximal angle at which new bonds can be created
      molecule value = off or inter or intra
        off = allow both inter- and intramolecular reactions (default)
        inter = search for reactions between molecules with different IDs
        intra = search for reactions within the same molecule

## Examples

    fix 5 all bond/create 10 1 2 0.8 1
    fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3
    fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3 atype 1 dtype 2
    fix 5 all bond/create 10 13 25 7 28 iparam 1 15 jparam 1 27 prob 0.2 91322 molecule inter
    fix 5 all bond/create/angle 10 1 2 1.122 1 aconstrain 120 180 prob 1 4928459 iparam 2 1 jparam 2 2

    labelmap atom 1 c1 2 n2
    labelmap bond 1 c1-n2
    fix 5 all bond/create 10 c1 n2 0.8 c1-n2

## Description

Create bonds between pairs of atoms as a simulation runs according to specified criteria. This can be used to model the cross-linking of polymers, the formation of a percolation network, etc. In this context, a bond means an interaction between a pair of atoms computed by the bond_style command. Once the bond is created it will be permanently in place. Optionally, the creation of a bond can also create angle, dihedral, and improper interactions that the bond is part of. See the discussion of the atype, dtype, and itype keywords below.

This process is different than a pair-wise bond-order potential such as Tersoff or AIREBO, which infer bonds and many-body interactions based on the current geometry of a small cluster of atoms and effectively create and destroy bonds and higher-order many-body interactions from time step to time step as the atoms move.

A check for possible new bonds is performed every Nevery time steps. If two atoms \(i\) and \(j\) are within a distance Rmin of each other, atom \(i\) is of type itype, atom \(j\) is of type jtype, and both \(i\) and \(j\) are in the specified fix group, then if a bond does not already exist between atoms \(i\) and \(j\), and if both \(i\) and \(j\) meet their respective maxbond requirements (explained below), then \(i\) and \(j\) are labeled as a “possible” bond pair.

If several atoms are close to an atom, it may have multiple possible bond partners. Every atom checks its list of possible bond partners and labels the closest such partner as its “sole” bond partner. After this is done, if atom \(i\) has atom \(j\) as its sole partner and atom \(j\) has atom \(i\) as its sole partner, then the \(i,j\) bond is “eligible” to be formed.

Note that these rules mean that an atom will only be part of at most one created bond on a given time step. It also means that if atom \(i\) chooses atom \(j\) as its sole partner, but atom \(j\) chooses atom \(k\) as its sole partner (because \(R_{jk} < R_{ij}\)), then atom \(i\) will not form a bond on this time step, even if it has other possible bond partners.

It is permissible to have itype = jtype. Rmin must be \(\leq\) the pair-wise cutoff distance between itype and jtype atoms, as defined by the pair_style command.

The iparam and jparam keywords can be used to limit the bonding functionality of the participating atoms. Each atom keeps track of how many bonds of bondtype it already has. If atom \(i\) of type itype already has maxbond bonds (as set by the iparam keyword), then it will not form any more, and likewise for atom \(j\). If maxbond is set to 0, then there is no limit on the number of bonds that can be formed with that atom.

The newtype value for iparam and jparam can be used to change the atom type of atom \(i\) or \(j\) when it reaches maxbond number of bonds of type bondtype. This means it can now interact in a pair-wise fashion with other atoms in a different way by specifying different pair_coeff coefficients. If you do not wish the atom type to change, simply specify newtype as itype or jtype.

The prob keyword can also affect whether an eligible bond is actually created. 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 bond is only created if the random number is less than fraction.

The molecule keyword can be used to force the reaction to be intermolecular, intramolecular or either. When the value is set to off, molecule IDs are not considered when searching for reactions (default). When the value is set to inter, atoms must have different molecule IDs in order to be considered for the reaction. When the value is set to intra, only atoms with the same molecule ID are considered for the reaction.

The aconstrain keyword is only available with the fix bond/create/angle command. It allows one to specify minimum and maximum angles amin and amax, respectively, between the two prospective bonding partners and a third particle that is already bonded to one of the two partners. Such a criterion can be important when new angles are defined together with the formation of a new bond. Without a restriction on the permissible angle, and for stiffer angle potentials, very large energies can arise and lead to unphysical behavior.

Any bond that is created is assigned a bond type of bondtype.

When a bond is created, data structures within LAMMPS that store bond topologies are updated to reflect the creation. If the bond is part of new 3-body (angle) or 4-body (dihedral, improper) interactions, you can choose to create new angles, dihedrals, and impropers as well using the atype, dtype, and itype keywords. All of these changes typically affect pair-wise interactions between atoms that are now part of new bonds, angles, etc.

Note

One data structure that is not updated when a bond breaks are the molecule IDs stored by each atom. Even though two molecules become one molecule due to the created bond, all atoms in the new molecule retain their original molecule IDs.

If the atype keyword is used and if an angle potential is defined via the angle_style command, then any new 3-body interactions inferred by the creation of a bond will create new angles of type angletype, with parameters assigned by the corresponding angle_coeff command. Likewise, the dtype and itype keywords will create new dihedrals and impropers of type dihedraltype and impropertype.

Note

To create a new bond, the internal LAMMPS data structures that store this information must have space for it. When LAMMPS is initialized from a data file, the list of bonds is scanned and the maximum number of bonds per atom is tallied. If some atom will acquire more bonds than this limit as this fix operates, then the “extra bond per atom” parameter must be set to allow for it. Ditto for “extra angle per atom”, “extra dihedral per atom”, and “extra improper per atom” if angles, dihedrals, or impropers are being added when bonds are created. See the read_data or create_box command for more details. Note that a data file with no atoms can be used if you wish to add non-bonded atoms via the create atoms command (e.g., for a percolation simulation).

Note

LAMMPS stores and maintains a data structure with a list of the first, second, and third neighbors of each atom (within the bond topology of the system) for use in weighting pair-wise interactions for bonded atoms. Note that adding a single bond always adds a new first neighbor but may also induce many new second and third neighbors, depending on the molecular topology of your system. The “extra special per atom” parameter must typically be set to allow for the new maximum total size (first + second + third neighbors) of this per-atom list. There are two ways to do this. See the read_data or create_box commands for details.

Note

Even if you do not use the atype, dtype, or itype keywords, the list of topological neighbors is updated for atoms affected by the new bond. This in turn affects which neighbors are considered for pair-wise interactions, using the weighting rules set by the special_bonds command. Consider a new bond created between atoms \(i\) and \(j\). If \(j\) has a bonded neighbor \(k\), then \(k\) becomes a second neighbor of \(i\). Even if the atype keyword is not used to create angle \(\angle ijk\), the pair-wise interaction between \(i\) and \(k\) could potentially be turned off or weighted by the 1–3 weighting specified by the special_bonds command. This is the case even if the “angle yes” option was used with that command. The same is true for third neighbors (1–4 interactions), the dtype keyword, and the “dihedral yes” option used with the special_bonds command.

Note that even if your simulation starts with no bonds, you must define a bond_style and use the bond_coeff command to specify coefficients for the bondtype. Similarly, if new atom types are specified by the iparam or jparam keywords, they must be within the range of atom types allowed by the simulation and pair-wise coefficients must be specified for the new types.

Computationally, each time step this fix is invoked, 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. Moreover, if any bonds are created, neighbor lists must be immediately updated on the same time step. This is to ensure that any pair-wise interactions that should be turned “off” due to a bond creation, because they are now excluded by the presence of the bond and the settings of the special_bonds command, will be immediately recognized. All of these operations increase the cost of a time step. 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.

Note

Creating a bond typically alters the energy of a system. You should be careful not to choose bond creation criteria that induce a dramatic change in energy. For example, if you define a very stiff harmonic bond and create it when two atoms are separated by a distance far from the equilibrium bond length, then the two atoms will oscillate dramatically when the bond is formed. More generally, you may need to thermostat your system to compensate for energy changes resulting from created bonds (and angles, dihedrals, impropers).

## Dump image info

Added in version 11Feb2026.

Fixes bond/create and bond/create/angle support the fix keyword of dump image. The fixes will pass geometry information about atoms involved in a created bond to dump image so that these atoms can be highlighted in the visualization as additional spheres. For how long those additional spheres will be shown depends on the value of the vizsteps setting (default is 1000) which can be changed by using the fix_modify command. If an atom is involved in the creation of multiple bonds, the check on showing the additional graphics depends on the timestep of its last bond creation.

The color of the additional spheres is by default that of the atoms when using color styles “type” or “element”. With color style “const” the default value of “white” can be changed using dump_modify fcolor. The transparency is by default fully opaque and can be changed with dump_modify ftrans.

The fflag1 setting of dump image fix has no effect.

The fflag2 setting allows you to set the radius of the added spheres, since the radius is set to zero internally.

## Restart, fix_modify, output, run start/stop, minimize info

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

This fix computes two statistics which it stores in a global vector of length 2, which can be accessed by various output commands. The vector values calculated by this fix are “intensive”.

The two quantities in the global vector are

> 1. number of bonds created on the most recent creation time step

> 2. cumulative number of bonds created

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

## Restrictions

This fix is part of the MC package. It is only enabled if LAMMPS was built with that package. See the Build package doc page for more info.

## Related commands

fix bond/break, fix bond/react, fix bond/swap, dump local, special_bonds

## Default

The option defaults are iparam = (0,itype), jparam = (0,jtype), and prob = 1.0.