"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

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

:line

fix command :h3

[Syntax:]

fix ID group-ID style args :pre

ID = user-assigned name for the fix
group-ID = ID of the group of atoms to apply the fix to
style = one of a long list of possible style names (see below)
args = arguments used by a particular style :ul

[Examples:]

fix 1 all nve
fix 3 all nvt temp 300.0 300.0 0.01
fix mine top setforce 0.0 NULL 0.0 :pre

[Description:]

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 hundreds of fixes
defined in LAMMPS and new ones can be added; see the
"Modify"_Modify.html doc page for details.

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.

The ID of a fix can only contain alphanumeric characters and
underscores.

Fixes can be deleted with the "unfix"_unfix.html command.

NOTE: The "unfix"_unfix.html 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 "fix nve"_fix_nve.html
command for a second run after using a "fix nvt"_fix_nh.html 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!

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 "fix_modify"_fix_modify.html command.

The "fix modify"_fix_modify.html command allows settings for some
fixes to be reset.  See the doc page for individual fixes for details.

Some fixes store an internal "state" which is written to binary
restart files via the "restart"_restart.html or
"write_restart"_write_restart.html commands.  This allows the fix to
continue on with its calculations in a restarted simulation.  See the
"read_restart"_read_restart.html 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.

:line

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.

Note that a single fix can produce either global or per-atom or local
quantities (or none at all), but not both global and per-atom.  It can
produce local quantities in tandem with global or per-atom quantities.
The fix doc page will explain.

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.

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:

f_ID | entire scalar, vector, or array
f_ID\[I\] | one element of vector, one column of array
f_ID\[I\]\[J\] | one element of array :tb(s=|)

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.

Note that commands and "variables"_variable.html 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.

:line

In LAMMPS, the values generated by a fix can be used in several ways:

Global values can be output via the "thermo_style
custom"_thermo_style.html or "fix ave/time"_fix_ave_time.html command.
Or the values can be referenced in a "variable equal"_variable.html or
"variable atom"_variable.html command. :ulb,l

Per-atom values can be output via the "dump custom"_dump.html command.
Or they can be time-averaged via the "fix ave/atom"_fix_ave_atom.html
command or reduced by the "compute reduce"_compute_reduce.html
command.  Or the per-atom values can be referenced in an "atom-style
variable"_variable.html. :l

Local values can be reduced by the "compute
reduce"_compute_reduce.html command, or histogrammed by the "fix
ave/histo"_fix_ave_histo.html command. :l
:ule

See the "Howto output"_Howto_output.html doc page for a summary of
various LAMMPS output options, many of which involve fixes.

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.
"Thermodynamic output"_thermo_style.html 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
"variable"_variable.html, you may want to know whether it is an
intensive or extensive value.  See the doc page for individual fixes
for further info.

:line

Each fix style has its own doc 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 listed in more compact form
on the "Commands fix"_Commands_fix.html doc page.

There are also additional accelerated fix styles included in the
LAMMPS distribution for faster performance on CPUs, GPUs, and KNLs.
The individual style names on the "Commands fix"_Commands_fix.html doc
page are followed by one or more of (g,i,k,o,t) to indicate which
accelerated styles exist.

"adapt"_fix_adapt.html - change a simulation parameter over time
"adapt/fep"_fix_adapt_fep.html - enhanced version of fix adapt
"addforce"_fix_addforce.html - add a force to each atom
"addtorque"_fix_addtorque.html - add a torque to a group of atoms
"append/atoms"_fix_append_atoms.html - append atoms to a running simulation
"atc"_fix_atc.html - initiates a coupled MD/FE simulation
"atom/swap"_fix_atom_swap.html - Monte Carlo atom type swapping
"ave/atom"_fix_ave_atom.html - compute per-atom time-averaged quantities
"ave/chunk"_fix_ave_chunk.html - compute per-chunk time-averaged quantities
"ave/correlate"_fix_ave_correlate.html - compute/output time correlations
"ave/correlate/long"_fix_ave_correlate_long.html -
"ave/histo"_fix_ave_histo.html - compute/output time-averaged histograms
"ave/histo/weight"_fix_ave_histo.html - weighted version of fix ave/histo
"ave/time"_fix_ave_time.html - compute/output global time-averaged quantities
"aveforce"_fix_aveforce.html - add an averaged force to each atom
"balance"_fix_balance.html - perform dynamic load-balancing
"bocs"_fix_bocs.html - NPT style time integration with pressure correction
"bond/break"_fix_bond_break.html - break bonds on the fly
"bond/create"_fix_bond_create.html - create bonds on the fly
"bond/react"_fix_bond_react.html - apply topology changes to model reactions
"bond/swap"_fix_bond_swap.html - Monte Carlo bond swapping
"box/relax"_fix_box_relax.html - relax box size during energy minimization
"client/md"_fix_client_md.html - MD client for client/server simulations
"cmap"_fix_cmap.html - enables CMAP cross-terms of the CHARMM force field
"colvars"_fix_colvars.html - interface to the collective variables "Colvars" library
"controller"_fix_controller.html - apply control loop feedback mechanism
"deform"_fix_deform.html - change the simulation box size/shape
"deposit"_fix_deposit.html - add new atoms above a surface
"dpd/energy"_fix_dpd_energy.html - constant energy dissipative particle dynamics
"drag"_fix_drag.html - drag atoms towards a defined coordinate
"drude"_fix_drude.html - part of Drude oscillator polarization model
"drude/transform/direct"_fix_drude_transform.html -  part of Drude oscillator polarization model
"drude/transform/inverse"_fix_drude_transform.html -  part of Drude oscillator polarization model
"dt/reset"_fix_dt_reset.html - reset the timestep based on velocity, forces
"edpd/source"_fix_dpd_source.html - add heat source to eDPD simulations
"efield"_fix_efield.html - impose electric field on system
"ehex"_fix_ehex.html - enhanced heat exchange algorithm
"electron/stopping"_fix_electron_stopping.html - electronic stopping power as a friction force
"enforce2d"_fix_enforce2d.html - zero out z-dimension velocity and force
"eos/cv"_fix_eos_cv.html -
"eos/table"_fix_eos_table.html -
"eos/table/rx"_fix_eos_table_rx.html -
"evaporate"_fix_evaporate.html - remove atoms from simulation periodically
"external"_fix_external.html - callback to an external driver program
"ffl"_fix_ffl.html - apply a Fast-Forward Langevin equation thermostat
"filter/corotate"_fix_filter_corotate.html - implement corotation filter to allow larger timesteps with r-RESPA
"flow/gauss"_fix_flow_gauss.html - Gaussian dynamics for constant mass flux
"freeze"_fix_freeze.html - freeze atoms in a granular simulation
"gcmc"_fix_gcmc.html - grand canonical insertions/deletions
"gld"_fix_gld.html - generalized Langevin dynamics integrator
"gle"_fix_gle.html - generalized Langevin equation thermostat
"gravity"_fix_gravity.html - add gravity to atoms in a granular simulation
"grem"_fix_grem.html - implements the generalized replica exchange method
"halt"_fix_halt.html - terminate a dynamics run or minimization
"heat"_fix_heat.html - add/subtract momentum-conserving heat
"hyper/global"_fix_hyper_global.html - global hyperdynamics
"hyper/local"_fix_hyper_local.html - local hyperdynamics
"imd"_fix_imd.html - implements the "Interactive MD" (IMD) protocol
"indent"_fix_indent.html - impose force due to an indenter
"ipi"_fix_ipi.html - enable LAMMPS to run as a client for i-PI path-integral simulations
"langevin"_fix_langevin.html - Langevin temperature control
"langevin/drude"_fix_langevin_drude.html - Langevin temperature control of Drude oscillators
"langevin/eff"_fix_langevin_eff.html - Langevin temperature control for the electron force field model
"langevin/spin"_fix_langevin_spin.html - Langevin temperature control for a spin or spin-lattice system
"latte"_fix_latte.html - wrapper on LATTE density-functional tight-binding code
"lb/fluid"_fix_lb_fluid.html -
"lb/momentum"_fix_lb_momentum.html -
"lb/pc"_fix_lb_pc.html -
"lb/rigid/pc/sphere"_fix_lb_rigid_pc_sphere.html -
"lb/viscous"_fix_lb_viscous.html -
"lineforce"_fix_lineforce.html - constrain atoms to move in a line
"manifoldforce"_fix_manifoldforce.html - restrain atoms to a manifold during minimization
"meso"_fix_meso.html - time integration for SPH/DPDE particles
"meso/move"_fix_meso_move.html - move mesoscopic SPH/SDPD particles in a prescribed fashion
"meso/stationary"_fix_meso_stationary.html -
"momentum"_fix_momentum.html - zero the linear and/or angular momentum of a group of atoms
"move"_fix_move.html - move atoms in a prescribed fashion
"mscg"_fix_mscg.html - apply MSCG method for force-matching to generate coarse grain models
"msst"_fix_msst.html - multi-scale shock technique (MSST) integration
"mvv/dpd"_fix_mvv_dpd.html - DPD using the modified velocity-Verlet integration algorithm
"mvv/edpd"_fix_mvv_dpd.html - constant energy DPD using the modified velocity-Verlet algorithm
"mvv/tdpd"_fix_mvv_dpd.html - constant temperature DPD using the modified velocity-Verlet algorithm
"neb"_fix_neb.html - nudged elastic band (NEB) spring forces
"nph"_fix_nh.html - constant NPH time integration via Nose/Hoover
"nph/asphere"_fix_nph_asphere.html - NPH for aspherical particles
"nph/body"_fix_nph_body.html - NPH for body particles
"nph/eff"_fix_nh_eff.html - NPH for  nuclei and electrons in the electron force field model
"nph/sphere"_fix_nph_sphere.html - NPH for spherical particles
"nphug"_fix_nphug.html - constant-stress Hugoniostat integration
"npt"_fix_nh.html - constant NPT time integration via Nose/Hoover
"npt/asphere"_fix_npt_asphere.html - NPT for aspherical particles
"npt/body"_fix_npt_body.html - NPT for body particles
"npt/eff"_fix_nh_eff.html - NPT for  nuclei and electrons in the electron force field model
"npt/sphere"_fix_npt_sphere.html - NPT for spherical particles
"npt/uef"_fix_nh_uef.html - NPT style time integration with diagonal flow
"nve"_fix_nve.html - constant NVE time integration
"nve/asphere"_fix_nve_asphere.html - NVE for aspherical particles
"nve/asphere/noforce"_fix_nve_asphere_noforce.html - NVE for aspherical particles without forces
"nve/awpmd"_fix_nve_awpmd.html - NVE for the Antisymmetrized Wave Packet Molecular Dynamics model
"nve/body"_fix_nve_body.html - NVE for body particles
"nve/dot"_fix_nve_dot.html - rigid body constant energy time integrator for coarse grain models
"nve/dotc/langevin"_fix_nve_dotc_langevin.html - Langevin style rigid body time integrator for coarse grain models
"nve/eff"_fix_nve_eff.html - NVE for  nuclei and electrons in the electron force field model
"nve/limit"_fix_nve_limit.html - NVE with limited step length
"nve/line"_fix_nve_line.html - NVE for line segments
"nve/manifold/rattle"_fix_nve_manifold_rattle.html -
"nve/noforce"_fix_nve_noforce.html - NVE without forces (v only)
"nve/sphere"_fix_nve_sphere.html - NVE for spherical particles
"nve/spin"_fix_nve_spin.html - NVE for a spin or spin-lattice system
"nve/tri"_fix_nve_tri.html - NVE for triangles
"nvk"_fix_nvk.html - constant kinetic energy time integration
"nvt"_fix_nh.html - NVT time integration via Nose/Hoover
"nvt/asphere"_fix_nvt_asphere.html - NVT for aspherical particles
"nvt/body"_fix_nvt_body.html - NVT for body particles
"nvt/eff"_fix_nh_eff.html - NVE for  nuclei and electrons in the electron force field model
"nvt/manifold/rattle"_fix_nvt_manifold_rattle.html -
"nvt/sllod"_fix_nvt_sllod.html - NVT for NEMD with SLLOD equations
"nvt/sllod/eff"_fix_nvt_sllod_eff.html - NVT for NEMD with SLLOD equations for the electron force field model
"nvt/sphere"_fix_nvt_sphere.html - NVT for spherical particles
"nvt/uef"_fix_nh_uef.html - NVT style time integration with diagonal flow
"oneway"_fix_oneway.html - constrain particles on move in one direction
"orient/bcc"_fix_orient.html - add grain boundary migration force for BCC
"orient/fcc"_fix_orient.html - add grain boundary migration force for FCC
"phonon"_fix_phonon.html - calculate dynamical matrix from MD simulations
"pimd"_fix_pimd.html - Feynman path integral molecular dynamics
"planeforce"_fix_planeforce.html - constrain atoms to move in a plane
"plumed"_fix_plumed.html - wrapper on PLUMED free energy library
"poems"_fix_poems.html - constrain clusters of atoms to move as coupled rigid bodies
"pour"_fix_pour.html - pour new atoms/molecules into a granular simulation domain
"precession/spin"_fix_precession_spin.html -
"press/berendsen"_fix_press_berendsen.html - pressure control by Berendsen barostat
"print"_fix_print.html - print text and variables during a simulation
"property/atom"_fix_property_atom.html - add customized per-atom values
"python/invoke"_fix_python_invoke.html - call a Python function during a simulation
"python/move"_fix_python_move.html -  call a Python function during a simulation run
"qbmsst"_fix_qbmsst.html - quantum bath multi-scale shock technique time integrator
"qeq/comb"_fix_qeq_comb.html - charge equilibration for COMB potential
"qeq/dynamic"_fix_qeq.html - charge equilibration via dynamic method
"qeq/fire"_fix_qeq.html - charge equilibration via FIRE minimizer
"qeq/point"_fix_qeq.html - charge equilibration via point method
"qeq/reax"_fix_qeq_reax.html - charge equilibration for ReaxFF potential
"qeq/shielded"_fix_qeq.html - charge equilibration via shielded method
"qeq/slater"_fix_qeq.html - charge equilibration via Slater method
"qmmm"_fix_qmmm.html - functionality to enable a quantum mechanics/molecular mechanics coupling
"qtb"_fix_qtb.html - implement quantum thermal bath scheme
"rattle"_fix_shake.html - RATTLE constraints on bonds and/or angles
"reax/c/bonds"_fix_reaxc_bonds.html - write out ReaxFF bond information
"reax/c/species"_fix_reaxc_species.html - write out ReaxFF molecule information
"recenter"_fix_recenter.html - constrain the center-of-mass position of a group of atoms
"restrain"_fix_restrain.html - constrain a bond, angle, dihedral
"rhok"_fix_rhok.html - add bias potential for long-range ordered systems
"rigid"_fix_rigid.html - constrain one or more clusters of atoms to move as a rigid body with NVE integration
"rigid/meso"_fix_rigid_meso.html - constrain clusters of mesoscopic SPH/SDPD particles to move as a rigid body
"rigid/nph"_fix_rigid.html - constrain one or more clusters of atoms to move as a rigid body with NPH integration
"rigid/nph/small"_fix_rigid.html - constrain many small clusters of atoms to move as a rigid body with NPH integration
"rigid/npt"_fix_rigid.html - constrain one or more clusters of atoms to move as a rigid body with NPT integration
"rigid/npt/small"_fix_rigid.html - constrain many small clusters of atoms to move as a rigid body with NPT integration
"rigid/nve"_fix_rigid.html - constrain one or more clusters of atoms to move as a rigid body with alternate NVE integration
"rigid/nve/small"_fix_rigid.html - constrain many small clusters of atoms to move as a rigid body with alternate NVE integration
"rigid/nvt"_fix_rigid.html - constrain one or more clusters of atoms to move as a rigid body with NVT integration
"rigid/nvt/small"_fix_rigid.html - constrain many small clusters of atoms to move as a rigid body with NVT integration
"rigid/small"_fix_rigid.html - constrain many small clusters of atoms to move as a rigid body with NVE integration
"rx"_fix_rx.html -
"saed/vtk"_fix_saed_vtk.html -
"setforce"_fix_setforce.html - set the force on each atom
"shake"_fix_shake.html - SHAKE constraints on bonds and/or angles
"shardlow"_fix_shardlow.html - integration of DPD equations of motion using the Shardlow splitting
"smd"_fix_smd.html - applied a steered MD force to a group
"smd/adjust_dt"_fix_smd_adjust_dt.html -
"smd/integrate_tlsph"_fix_smd_integrate_tlsph.html -
"smd/integrate_ulsph"_fix_smd_integrate_ulsph.html -
"smd/move_tri_surf"_fix_smd_move_triangulated_surface.html -
"smd/setvel"_fix_smd_setvel.html -
"smd/wall_surface"_fix_smd_wall_surface.html -
"spring"_fix_spring.html - apply harmonic spring force to group of atoms
"spring/chunk"_fix_spring_chunk.html - apply harmonic spring force to each chunk of atoms
"spring/rg"_fix_spring_rg.html - spring on radius of gyration of group of atoms
"spring/self"_fix_spring_self.html - spring from each atom to its origin
"srd"_fix_srd.html - stochastic rotation dynamics (SRD)
"store/force"_fix_store_force.html - store force on each atom
"store/state"_fix_store_state.html - store attributes for each atom
"tdpd/source"_fix_dpd_source.html -
"temp/berendsen"_fix_temp_berendsen.html - temperature control by Berendsen thermostat
"temp/csld"_fix_temp_csvr.html - canonical sampling thermostat with Langevin dynamics
"temp/csvr"_fix_temp_csvr.html - canonical sampling thermostat with Hamiltonian dynamics
"temp/rescale"_fix_temp_rescale.html - temperature control by velocity rescaling
"temp/rescale/eff"_fix_temp_rescale_eff.html - temperature control by velocity rescaling in the electron force field model
"tfmc"_fix_tfmc.html - perform force-bias Monte Carlo with time-stamped method
"thermal/conductivity"_fix_thermal_conductivity.html - Muller-Plathe kinetic energy exchange for thermal conductivity calculation
"ti/spring"_fix_ti_spring.html -
"tmd"_fix_tmd.html - guide a group of atoms to a new configuration
"ttm"_fix_ttm.html - two-temperature model for electronic/atomic coupling
"ttm/mod"_fix_ttm.html - enhanced two-temperature model with additional options
"tune/kspace"_fix_tune_kspace.html - auto-tune KSpace parameters
"vector"_fix_vector.html - accumulate a global vector every N timesteps
"viscosity"_fix_viscosity.html - Muller-Plathe momentum exchange for viscosity calculation
"viscous"_fix_viscous.html - viscous damping for granular simulations
"wall/body/polygon"_fix_wall_body_polygon.html -
"wall/body/polyhedron"_fix_wall_body_polyhedron.html -
"wall/colloid"_fix_wall.html - Lennard-Jones wall interacting with finite-size particles
"wall/ees"_fix_wall_ees.html - wall for ellipsoidal particles
"wall/gran"_fix_wall_gran.html - frictional wall(s) for granular simulations
"wall/gran/region"_fix_wall_gran_region.html -
"wall/harmonic"_fix_wall.html - harmonic spring wall
"wall/lj1043"_fix_wall.html - Lennard-Jones 10-4-3 wall
"wall/lj126"_fix_wall.html - Lennard-Jones 12-6 wall
"wall/lj93"_fix_wall.html - Lennard-Jones 9-3 wall
"wall/morse"_fix_wall.html - Morse potential wall
"wall/piston"_fix_wall_piston.html - moving reflective piston wall
"wall/reflect"_fix_wall_reflect.html - reflecting wall(s)
"wall/region"_fix_wall_region.html - use region surface as wall
"wall/region/ees"_fix_wall_ees.html - use region surface as wall for ellipsoidal particles
"wall/srd"_fix_wall_srd.html - slip/no-slip wall for SRD particles :ul

[Restrictions:]

Some fix styles are part of specific packages.  They are only enabled
if LAMMPS was built with that package.  See the "Build
package"_Build_package.html doc page for more info.  The doc pages for
individual fixes tell if it is part of a package.

[Related commands:]

"unfix"_unfix.html, "fix_modify"_fix_modify.html

[Default:] none
