<p>Set a fix that will be applied to a group of atoms. In LAMMPS, a
“fix” is any operation that is applied to the system during
timestepping or minimization. Examples include updating of atom
positions and velocities due to time integration, controlling
temperature, applying constraint forces to atoms, enforcing boundary
conditions, computing diagnostics, etc. There are dozens of fixes
defined in LAMMPS and new ones can be added; see <aclass="reference internal"href="Section_modify.html"><spanclass="doc">this section</span></a> for a discussion.</p>
<p>Fixes perform their operations at different stages of the timestep.
If 2 or more fixes operate at the same stage of the timestep, they are
invoked in the order they were specified in the input script.</p>
<p>The ID of a fix can only contain alphanumeric characters and
underscores.</p>
<p>Fixes can be deleted with the <aclass="reference internal"href="unfix.html"><spanclass="doc">unfix</span></a> command.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">The <aclass="reference internal"href="unfix.html"><spanclass="doc">unfix</span></a> command is the only way to turn off a
fix; simply specifying a new fix with a similar style will not turn
off the first one. This is especially important to realize for
integration fixes. For example, using a <aclass="reference internal"href="fix_nve.html"><spanclass="doc">fix nve</span></a>
command for a second run after using a <aclass="reference internal"href="fix_nh.html"><spanclass="doc">fix nvt</span></a> command
for the first run, will not cancel out the NVT time integration
invoked by the “fix nvt” command. Thus two time integrators would be
in place!</p>
</div>
<p>If you specify a new fix with the same ID and style as an existing
fix, the old fix is deleted and the new one is created (presumably
with new settings). This is the same as if an “unfix” command were
first performed on the old fix, except that the new fix is kept in the
same order relative to the existing fixes as the old one originally
was. Note that this operation also wipes out any additional changes
made to the old fix via the <aclass="reference internal"href="fix_modify.html"><spanclass="doc">fix_modify</span></a> command.</p>
<p>The <aclass="reference internal"href="fix_modify.html"><spanclass="doc">fix modify</span></a> command allows settings for some
fixes to be reset. See the doc page for individual fixes for details.</p>
<p>Some fixes store an internal “state” which is written to binary
restart files via the <aclass="reference internal"href="restart.html"><spanclass="doc">restart</span></a> or
<aclass="reference internal"href="write_restart.html"><spanclass="doc">write_restart</span></a> commands. This allows the fix to
continue on with its calculations in a restarted simulation. See the
<aclass="reference internal"href="read_restart.html"><spanclass="doc">read_restart</span></a> command for info on how to re-specify
a fix in an input script that reads a restart file. See the doc pages
for individual fixes for info on which ones can be restarted.</p>
<hrclass="docutils"/>
<p>Some fixes calculate one of three styles of quantities: global,
per-atom, or local, which can be used by other commands or output as
described below. A global quantity is one or more system-wide values,
e.g. the energy of a wall interacting with particles. A per-atom
quantity is one or more values per atom, e.g. the displacement vector
for each atom since time 0. Per-atom values are set to 0.0 for atoms
not in the specified fix group. Local quantities are calculated by
each processor based on the atoms it owns, but there may be zero or
more per atoms.</p>
<p>Note that a single fix may produces either global or per-atom or local
quantities (or none at all), but never more than one of these.</p>
<p>Global, per-atom, and local quantities each come in three kinds: a
single scalar value, a vector of values, or a 2d array of values. The
doc page for each fix describes the style and kind of values it
produces, e.g. a per-atom vector. Some fixes produce more than one
kind of a single style, e.g. a global scalar and a global vector.</p>
<p>When a fix quantity is accessed, as in many of the output commands
discussed below, it can be referenced via the following bracket
notation, where ID is the ID of the fix:</p>
<tableborder="1"class="docutils">
<colgroup>
<colwidth="23%"/>
<colwidth="77%"/>
</colgroup>
<tbodyvalign="top">
<trclass="row-odd"><td>f_ID</td>
<td>entire scalar, vector, or array</td>
</tr>
<trclass="row-even"><td>f_ID[I]</td>
<td>one element of vector, one column of array</td>
</tr>
<trclass="row-odd"><td>f_ID[I][J]</td>
<td>one element of array</td>
</tr>
</tbody>
</table>
<p>In other words, using one bracket reduces the dimension of the
quantity once (vector -> scalar, array -> vector). Using two brackets
reduces the dimension twice (array -> scalar). Thus a command that
uses scalar fix values as input can also process elements of a vector
or array.</p>
<p>Note that commands and <aclass="reference internal"href="variable.html"><spanclass="doc">variables</span></a> which use fix
quantities typically do not allow for all kinds, e.g. a command may
require a vector of values, not a scalar. This means there is no
ambiguity about referring to a fix quantity as f_ID even if it
produces, for example, both a scalar and vector. The doc pages for
various commands explain the details.</p>
<hrclass="docutils"/>
<p>In LAMMPS, the values generated by a fix can be used in several ways:</p>
<ulclass="simple">
<li>Global values can be output via the <aclass="reference internal"href="thermo_style.html"><spanclass="doc">thermo_style custom</span></a> or <aclass="reference internal"href="fix_ave_time.html"><spanclass="doc">fix ave/time</span></a> command.
Or the values can be referenced in a <aclass="reference internal"href="variable.html"><spanclass="doc">variable equal</span></a> or
<li>Per-atom values can be output via the <aclass="reference internal"href="dump.html"><spanclass="doc">dump custom</span></a> command.
Or they can be time-averaged via the <aclass="reference internal"href="fix_ave_atom.html"><spanclass="doc">fix ave/atom</span></a>
command or reduced by the <aclass="reference internal"href="compute_reduce.html"><spanclass="doc">compute reduce</span></a>
command. Or the per-atom values can be referenced in an <aclass="reference internal"href="variable.html"><spanclass="doc">atom-style variable</span></a>.</li>
<li>Local values can be reduced by the <aclass="reference internal"href="compute_reduce.html"><spanclass="doc">compute reduce</span></a> command, or histogrammed by the <aclass="reference internal"href="fix_ave_histo.html"><spanclass="doc">fix ave/histo</span></a> command.</li>
</ul>
<p>See this <aclass="reference internal"href="Section_howto.html#howto-15"><spanclass="std std-ref">howto section</span></a> for a summary of
various LAMMPS output options, many of which involve fixes.</p>
<p>The results of fixes that calculate global quantities can be either
“intensive” or “extensive” values. Intensive means the value is
independent of the number of atoms in the simulation,
e.g. temperature. Extensive means the value scales with the number of
atoms in the simulation, e.g. total rotational kinetic energy.
<aclass="reference internal"href="thermo_style.html"><spanclass="doc">Thermodynamic output</span></a> will normalize extensive
values by the number of atoms in the system, depending on the
“thermo_modify norm” setting. It will not normalize intensive values.
If a fix value is accessed in another way, e.g. by a
<aclass="reference internal"href="variable.html"><spanclass="doc">variable</span></a>, you may want to know whether it is an
intensive or extensive value. See the doc page for individual fixes
for further info.</p>
<hrclass="docutils"/>
<p>Each fix style has its own documentation page which describes its
arguments and what it does, as listed below. Here is an alphabetic
list of fix styles available in LAMMPS. They are also given in more
compact form in the Fix section of <aclass="reference internal"href="Section_commands.html#cmd-5"><spanclass="std std-ref">this page</span></a>.</p>
<p>There are also additional fix styles (not listed here) submitted by
users which are included in the LAMMPS distribution. The list of
these with links to the individual styles are given in the fix section
of <aclass="reference internal"href="Section_commands.html#cmd-5"><spanclass="std std-ref">this page</span></a>.</p>
<ulclass="simple">
<li><aclass="reference internal"href="fix_adapt.html"><spanclass="doc">adapt</span></a> - change a simulation parameter over time</li>
<li><aclass="reference internal"href="fix_addforce.html"><spanclass="doc">addforce</span></a> - add a force to each atom</li>
<li><aclass="reference internal"href="fix_append_atoms.html"><spanclass="doc">append/atoms</span></a> - append atoms to a running simulation</li>
<li><aclass="reference internal"href="fix_atom_swap.html"><spanclass="doc">atom/swap</span></a> - Monte Carlo atom type swapping</li>
<li><aclass="reference internal"href="fix_aveforce.html"><spanclass="doc">aveforce</span></a> - add an averaged force to each atom</li>
<li><aclass="reference internal"href="fix_indent.html"><spanclass="doc">indent</span></a> - impose force due to an indenter</li>
<li><aclass="reference internal"href="fix_langevin.html"><spanclass="doc">langevin</span></a> - Langevin temperature control</li>
<li><aclass="reference internal"href="fix_lineforce.html"><spanclass="doc">lineforce</span></a> - constrain atoms to move in a line</li>
<li><aclass="reference internal"href="fix_momentum.html"><spanclass="doc">momentum</span></a> - zero the linear and/or angular momentum of a group of atoms</li>
<li><aclass="reference internal"href="fix_move.html"><spanclass="doc">move</span></a> - move atoms in a prescribed fashion</li>
<li><aclass="reference internal"href="fix_nph_asphere.html"><spanclass="doc">nph/asphere</span></a> - NPH for aspherical particles</li>
<li><aclass="reference internal"href="fix_nve_body.html"><spanclass="doc">nph/body</span></a> - NPH for body particles</li>
<li><aclass="reference internal"href="fix_nph_sphere.html"><spanclass="doc">nph/sphere</span></a> - NPH for spherical particles</li>
<li><aclass="reference internal"href="fix_nh.html"><spanclass="doc">npt</span></a> - constant NPT time integration via Nose/Hoover</li>
<li><aclass="reference internal"href="fix_npt_asphere.html"><spanclass="doc">npt/asphere</span></a> - NPT for aspherical particles</li>
<li><aclass="reference internal"href="fix_nve_body.html"><spanclass="doc">npt/body</span></a> - NPT for body particles</li>
<li><aclass="reference internal"href="fix_npt_sphere.html"><spanclass="doc">npt/sphere</span></a> - NPT for spherical particles</li>
<li><aclass="reference internal"href="fix_nve.html"><spanclass="doc">nve</span></a> - constant NVE time integration</li>
<li><aclass="reference internal"href="fix_nve_asphere.html"><spanclass="doc">nve/asphere</span></a> - NVE for aspherical particles</li>
<li><aclass="reference internal"href="fix_nve_asphere_noforce.html"><spanclass="doc">nve/asphere/noforce</span></a> - NVE for aspherical particles without forces”</li>
<li><aclass="reference internal"href="fix_nve_body.html"><spanclass="doc">nve/body</span></a> - NVE for body particles</li>
<li><aclass="reference internal"href="fix_nve_limit.html"><spanclass="doc">nve/limit</span></a> - NVE with limited step length</li>
<li><aclass="reference internal"href="fix_nve_line.html"><spanclass="doc">nve/line</span></a> - NVE for line segments</li>
<li><aclass="reference internal"href="fix_nve_noforce.html"><spanclass="doc">nve/noforce</span></a> - NVE without forces (v only)</li>
<li><aclass="reference internal"href="fix_nve_sphere.html"><spanclass="doc">nve/sphere</span></a> - NVE for spherical particles</li>
<li><aclass="reference internal"href="fix_nve_tri.html"><spanclass="doc">nve/tri</span></a> - NVE for triangles</li>
<li><aclass="reference internal"href="fix_nh.html"><spanclass="doc">nvt</span></a> - constant NVT time integration via Nose/Hoover</li>
<li><aclass="reference internal"href="fix_nvt_asphere.html"><spanclass="doc">nvt/asphere</span></a> - NVT for aspherical particles</li>
<li><aclass="reference internal"href="fix_nve_body.html"><spanclass="doc">nvt/body</span></a> - NVT for body particles</li>
<li><aclass="reference internal"href="fix_nvt_sllod.html"><spanclass="doc">nvt/sllod</span></a> - NVT for NEMD with SLLOD equations</li>
<li><aclass="reference internal"href="fix_nvt_sphere.html"><spanclass="doc">nvt/sphere</span></a> - NVT for spherical particles</li>
<li><aclass="reference internal"href="fix_oneway.html"><spanclass="doc">oneway</span></a> - constrain particles on move in one direction</li>
<li><aclass="reference internal"href="fix_orient.html"><spanclass="doc">orient/bcc</span></a> - add grain boundary migration force for BCC</li>
<li><aclass="reference internal"href="fix_orient.html"><spanclass="doc">orient/fcc</span></a> - add grain boundary migration force for FCC</li>
<li><aclass="reference internal"href="fix_planeforce.html"><spanclass="doc">planeforce</span></a> - constrain atoms to move in a plane</li>
<li><aclass="reference internal"href="fix_poems.html"><spanclass="doc">poems</span></a> - constrain clusters of atoms to move as coupled rigid bodies</li>
<li><aclass="reference internal"href="fix_pour.html"><spanclass="doc">pour</span></a> - pour new atoms/molecules into a granular simulation domain</li>
<li><aclass="reference internal"href="fix_press_berendsen.html"><spanclass="doc">press/berendsen</span></a> - pressure control by Berendsen barostat</li>
<li><aclass="reference internal"href="fix_print.html"><spanclass="doc">print</span></a> - print text and variables during a simulation</li>
<li><aclass="reference internal"href="fix_qeq_comb.html"><spanclass="doc">qeq/comb</span></a> - charge equilibration for COMB potential <aclass="reference internal"href="fix_qeq.html"><spanclass="doc">qeq/dynamic</span></a> - charge equilibration via dynamic method <aclass="reference internal"href="fix_qeq.html"><spanclass="doc">qeq/fire</span></a> - charge equilibration via FIRE minimizer <aclass="reference internal"href="fix_qeq.html"><spanclass="doc">qeq/point</span></a> - charge equilibration via point method <aclass="reference internal"href="fix_qeq.html"><spanclass="doc">qeq/shielded</span></a> - charge equilibration via shielded method <aclass="reference internal"href="fix_qeq.html"><spanclass="doc">qeq/slater</span></a> - charge equilibration via Slater method <aclass="reference internal"href="fix_shake.html"><spanclass="doc">rattle</span></a> - RATTLE constraints on bonds and/or angles</li>
<li><aclass="reference internal"href="fix_reax_bonds.html"><spanclass="doc">reax/bonds</span></a> - write out ReaxFF bond information <aclass="reference internal"href="fix_recenter.html"><spanclass="doc">recenter</span></a> - constrain the center-of-mass position of a group of atoms</li>
<li><aclass="reference internal"href="fix_restrain.html"><spanclass="doc">restrain</span></a> - constrain a bond, angle, dihedral</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid</span></a> - constrain one or more clusters of atoms to move as a rigid body with NVE integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/nph</span></a> - constrain one or more clusters of atoms to move as a rigid body with NPH integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/npt</span></a> - constrain one or more clusters of atoms to move as a rigid body with NPT integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/nve</span></a> - constrain one or more clusters of atoms to move as a rigid body with alternate NVE integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/nvt</span></a> - constrain one or more clusters of atoms to move as a rigid body with NVT integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/small</span></a> - constrain many small clusters of atoms to move as a rigid body with NVE integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/small/nph</span></a> - constrain many small clusters of atoms to move as a rigid body with NPH integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/small/npt</span></a> - constrain many small clusters of atoms to move as a rigid body with NPT integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/small/nve</span></a> - constrain many small clusters of atoms to move as a rigid body with alternate NVE integration</li>
<li><aclass="reference internal"href="fix_rigid.html"><spanclass="doc">rigid/small/nvt</span></a> - constrain many small clusters of atoms to move as a rigid body with NVT integration</li>
<li><aclass="reference internal"href="fix_setforce.html"><spanclass="doc">setforce</span></a> - set the force on each atom</li>
<li><aclass="reference internal"href="fix_shake.html"><spanclass="doc">shake</span></a> - SHAKE constraints on bonds and/or angles</li>
<li><aclass="reference internal"href="fix_spring.html"><spanclass="doc">spring</span></a> - apply harmonic spring force to group of atoms</li>
<li><aclass="reference internal"href="fix_spring_chunk.html"><spanclass="doc">spring/chunk</span></a> - apply harmonic spring force to each chunk of atoms</li>
<li><aclass="reference internal"href="fix_spring_rg.html"><spanclass="doc">spring/rg</span></a> - spring on radius of gyration of group of atoms</li>
<li><aclass="reference internal"href="fix_spring_self.html"><spanclass="doc">spring/self</span></a> - spring from each atom to its origin</li>
<li><aclass="reference internal"href="fix_store_force.html"><spanclass="doc">store/force</span></a> - store force on each atom</li>
<li><aclass="reference internal"href="fix_store_state.html"><spanclass="doc">store/state</span></a> - store attributes for each atom</li>
<li><aclass="reference internal"href="fix_temp_berendsen.html"><spanclass="doc">temp/berendsen</span></a> - temperature control by Berendsen thermostat</li>
<li><aclass="reference internal"href="fix_temp_csvr.html"><spanclass="doc">temp/csld</span></a> - canonical sampling thermostat with Langevin dynamics</li>
<li><aclass="reference internal"href="fix_temp_csvr.html"><spanclass="doc">temp/csvr</span></a> - canonical sampling thermostat with Hamiltonian dynamics</li>
<li><aclass="reference internal"href="fix_temp_rescale.html"><spanclass="doc">temp/rescale</span></a> - temperature control by velocity rescaling</li>
<li><aclass="reference internal"href="fix_tfmc.html"><spanclass="doc">tfmc</span></a> - perform force-bias Monte Carlo with time-stamped method</li>
<li><aclass="reference internal"href="fix_thermal_conductivity.html"><spanclass="doc">thermal/conductivity</span></a> - Muller-Plathe kinetic energy exchange for thermal conductivity calculation</li>
<li><aclass="reference internal"href="fix_tmd.html"><spanclass="doc">tmd</span></a> - guide a group of atoms to a new configuration</li>
<li><aclass="reference internal"href="fix_ttm.html"><spanclass="doc">ttm</span></a> - two-temperature model for electronic/atomic coupling</li>
<li><aclass="reference internal"href="fix_wall_region.html"><spanclass="doc">wall/region</span></a> - use region surface as wall</li>
<li><aclass="reference internal"href="fix_wall_srd.html"><spanclass="doc">wall/srd</span></a> - slip/no-slip wall for SRD particles</li>
</ul>
</div>
<divclass="section"id="restrictions">
<h2>Restrictions</h2>
<p>Some fix styles are part of specific packages. They are only enabled
if LAMMPS was built with that package. See the <aclass="reference internal"href="Section_start.html#start-3"><spanclass="std std-ref">Making LAMMPS</span></a> section for more info on packages.
The doc pages for individual fixes tell if it is part of a package.</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.