LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

### fix command

Syntax:

    fix ID group-ID style args

- 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

Examples:

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

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 for a discussion.

Each fix style has its own documentation page which describes its arguments and what it does, as listed below.

Fixes perform their operations at different stages of the timestep. If 2 or more fixes both operate at the same stage of the timestep, they are invoked in the order they were specified in the input script.

Fixes can be deleted with the unfix command. Note that this 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. For example, using a fix nve command for a second run after using a fix nvt 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 command.

The fix modify 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 output commands, including variables, thermo_style custom, and fix ave/time. See this howto section 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 or write_restart commands. This allows the fix to continue on with its calculations in a restarted simulation. See the read_restart 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.

Here is an alphabetic list of fix styles available in LAMMPS:

- addforce - add a force to each atom
- aveforce - add an averaged force to each atom
- ave/atom - compute per-atom time-averaged quantities
- ave/spatial - output per-atom quantities by layer
- ave/time - output time-averaged compute quantities
- com - compute a center-of-mass
- deform - change the simulation box size/shape
- deposit - add new atoms above a surface
- drag - drag atoms towards a defined coordinate
- dt/reset - reset the timestep based on velocity, forces
- efield - impose electric field on system
- enforce2d - zero out z-dimension velocity and force
- freeze - freeze atoms in a granular simulation
- gravity - add gravity to atoms in a granular simulation
- gyration - compute radius of gyration
- heat - add/subtract momentum-conserving heat
- indent - impose force due to an indenter
- langevin - Langevin temperature control
- lineforce - constrain atoms to move in a line
- msd - compute mean-squared displacement (i.e. diffusion coefficient)
- momentum - zero the linear and/or angular momentum of a group of atoms
- nph - constant NPH time integration via Nose/Hoover
- npt - constant NPT time integration via Nose/Hoover
- npt/asphere - NPT for aspherical particles
- nve - constant NVE time integration
- nve/asphere - NVT for aspherical particles
- nve/dipole - NVE for point dipolar particles
- nve/gran - NVE for granular particles
- nve/limit - NVE with limited step length
- nve/noforce - NVE without forces (v only)
- nvt - constant NVT time integration via Nose/Hoover
- nvt/asphere - NVT for aspherical particles
- nvt/sllod - NVT for NEMD with SLLOD equations
- orient/fcc - add grain boundary migration force
- planeforce - constrain atoms to move in a plane
- poems - constrain clusters of atoms to move as coupled rigid bodies
- pour - pour new atoms into a granular simulation domain
- print - print text and variables during a simulation
- rdf - compute radial distribution functions
- recenter - constrain the center-of-mass position of a group of atoms
- rigid - constrain one or more clusters of atoms to move as a rigid body
- setforce - set the force on each atom
- shake - SHAKE constraints on bonds and/or angles
- spring - apply harmonic spring force to group of atoms
- spring/rg - spring on radius of gyration of group of atoms
- spring/self - spring from each atom to its origin
- temp/rescale - temperature control by velocity rescaling
- tmd - guide a group of atoms to a new configuration
- viscosity - Muller-Plathe momentum exchange for viscosity calculation
- viscous - viscous damping for granular simulations
- wall/gran - frictional wall(s) for granular simulations
- wall/lj126 - Lennard-Jones 12-6 wall
- wall/lj93 - Lennard-Jones 9-3 wall
- wall/reflect - reflecting wall(s)
- wiggle - oscillate walls and frozen atoms

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.

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 for more info on packages. The doc pages for individual fixes tell if it is part of a package.

Related commands:

unfix, fix_modify

Default: none