"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 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 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 dozens of fixes
defined in LAMMPS and new ones can be added; see "this
section"_Section_modify.html for a discussion.

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.

IMPORTANT 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_nvt.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 calculate a global scalar or vector quantity which can be
accessed by various commands for output, including "equal- and
atom-style variables"_variable.html, "thermo_style
custom"_thermo_style.html, and "fix ave/time"_fix_ave_time.html.

Some fixes calculate a per-atom scalar or vector quantity which can be
accessed by various commands for output, including "atom-style
variables"_variable.html, "dump_style custom"_dump.html, and "fix
ave/spatial"_fix_ave_spatial.html.

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. timestep
size.  Extensive means the value scales with the number of atoms in
the simulation, e.g. total force applied by the fix.  "Thermodynamic
output"_thermo_style.html will normalize extensive values depending on
the "thermo_modify norm" setting.  But if a fix value is accessed in
another way, e.g. by a "variable"_variable.html, you may need to know
whether it is an intensive or extensive value.  See the doc page for
individual fixes for further info.

See this "howto section"_Section_howto.html#4_15 for a summary of
various LAMMPS output options.  See the doc pages for individual fixes
for info on which ones calculate these quantities.

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.

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:

"addforce"_fix_addforce.html - add a force to each atom
"aveforce"_fix_aveforce.html - add an averaged force to each atom
"ave/atom"_fix_ave_atom.html - compute per-atom time-averaged quantities
"ave/spatial"_fix_ave_spatial.html - output per-atom quantities by layer
"ave/time"_fix_ave_time.html - output time-averaged compute quantities
"bond/break"_fix_bond_break.html - break bonds on the fly
"bond/create"_fix_bond_create.html - create bonds on the fly
"bond/swap"_fix_bond_swap.html - Monte Carlo bond swapping
"box/relax"_fix_box_relax.html - relax box size during energy minimization
"com"_fix_com.html - compute a center-of-mass
"coord/original"_fix_coord_original.html - store original coords of each atom
"deform"_fix_deform.html - change the simulation box size/shape
"deposit"_fix_deposit.html - add new atoms above a surface
"drag"_fix_drag.html - drag atoms towards a defined coordinate
"dt/reset"_fix_dt_reset.html - reset the timestep based on velocity, forces
"efield"_fix_efield.html - impose electric field on system
"enforce2d"_fix_enforce2d.html - zero out z-dimension velocity and force
"evaporate"_fix_evaporate.html - remove atoms from simulation periodically
"freeze"_fix_freeze.html - freeze atoms in a granular simulation
"gravity"_fix_gravity.html - add gravity to atoms in a granular simulation
"gyration"_fix_gyration.html - compute radius of gyration
"heat"_fix_heat.html - add/subtract momentum-conserving heat
"indent"_fix_indent.html - impose force due to an indenter
"langevin"_fix_langevin.html - Langevin temperature control
"lineforce"_fix_lineforce.html - constrain atoms to move in a line
"msd"_fix_msd.html - compute mean-squared displacement \
     (i.e. diffusion coefficient)
"momentum"_fix_momentum.html - zero the linear and/or angular momentum \
  of a group of atoms
"nph"_fix_nph.html - constant NPH time integration via Nose/Hoover
"npt"_fix_npt.html - constant NPT time integration via Nose/Hoover
"npt/asphere"_fix_npt_asphere.html - NPT for aspherical particles
"npt/sphere"_fix_npt_sphere.html - NPT for spherical particles
"nve"_fix_nve.html - constant NVE time integration
"nve/asphere"_fix_nve_asphere.html - NVT for aspherical particles
"nve/limit"_fix_nve_limit.html - NVE with limited step length
"nve/noforce"_fix_nve_noforce.html - NVE without forces (v only)
"nve/sphere"_fix_nve_asphere.html - NVT for spherical particles
"nvt"_fix_nvt.html - constant NVT time integration via Nose/Hoover
"nvt/asphere"_fix_nvt_asphere.html - NVT for aspherical particles
"nvt/sllod"_fix_nvt_sllod.html - NVT for NEMD with SLLOD equations
"nvt/sphere"_fix_nvt_sphere.html - NVT for spherical particles
"orient/fcc"_fix_orient_fcc.html - add grain boundary migration force
"planeforce"_fix_planeforce.html - constrain atoms to move in a plane
"poems"_fix_poems.html - constrain clusters of atoms to move \
  as coupled rigid bodies
"pour"_fix_pour.html - pour new atoms into a granular simulation domain
"press/berendsen"_fix_press_berendsen.html - pressure control by \
     Berendsen barostat
"print"_fix_print.html - print text and variables during a simulation
"rdf"_fix_rdf.html - compute radial distribution functions
"reax/bonds"_fix_reax_bonds.html - write out ReaxFF bond information \
"recenter"_fix_recenter.html - constrain the center-of-mass position \
  of a group of atoms
"rigid"_fix_rigid.html - constrain one or more clusters of atoms to \
     move as a rigid body
"setforce"_fix_setforce.html - set the force on each atom
"shake"_fix_shake.html - SHAKE constraints on bonds and/or angles
"spring"_fix_spring.html - apply harmonic spring force to group 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
"temp/berendsen"_fix_temp_berendsen.html - temperature control by \
     Berendsen thermostat
"temp/rescale"_fix_temp_rescale.html - temperature control by \
     velocity rescaling
"thermal/conductivity"_fix_thermal_conductivity.html - Muller-Plathe kinetic energy exchange for \
     thermal conductivity calculation
"tmd"_fix_tmd.html - guide a group of atoms to a new configuration
"ttm"_fix_ttm.html - two-temperature model for electronic/atomic coupling
"viscosity"_fix_viscosity.html - Muller-Plathe momentum exchange for \
     viscosity calculation
"viscous"_fix_viscous.html - viscous damping for granular simulations
"wall/gran"_fix_wall_gran.html - frictional wall(s) for \
     granular simulations
"wall/lj126"_fix_wall_lj126.html - Lennard-Jones 12-6 wall
"wall/lj93"_fix_wall_lj93.html - Lennard-Jones 9-3 wall
"wall/reflect"_fix_wall_reflect.html - reflecting wall(s)
"wiggle"_fix_wiggle.html - oscillate walls and frozen atoms :ul

There are also additional fix styles 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 "this
page"_Section_commands.html#3_5.

[Restrictions:]

Some fix styles are part of specific packages.  They are only enabled
if LAMMPS was built with that package.  See the "Making
LAMMPS"_Section_start.html#2_3 section for more info on packages.  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
