<spanid="index-0"></span><h1>fix nvt command<aclass="headerlink"href="#fix-nvt-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-nvt-cuda-command">
<h1>fix nvt/cuda command<aclass="headerlink"href="#fix-nvt-cuda-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-nvt-omp-command">
<h1>fix nvt/omp command<aclass="headerlink"href="#fix-nvt-omp-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-npt-command">
<h1>fix npt command<aclass="headerlink"href="#fix-npt-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-npt-cuda-command">
<h1>fix npt/cuda command<aclass="headerlink"href="#fix-npt-cuda-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-npt-omp-command">
<h1>fix npt/omp command<aclass="headerlink"href="#fix-npt-omp-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-nph-command">
<h1>fix nph command<aclass="headerlink"href="#fix-nph-command"title="Permalink to this headline">¶</a></h1>
</div>
<divclass="section"id="fix-nph-omp-command">
<h1>fix nph/omp command<aclass="headerlink"href="#fix-nph-omp-command"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="syntax">
<h2>Syntax<aclass="headerlink"href="#syntax"title="Permalink to this headline">¶</a></h2>
<divclass="highlight-python"><divclass="highlight"><pre>fix ID group-ID style_name keyword value ...
</pre></div>
</div>
<ulclass="simple">
<li>ID, group-ID are documented in <aclass="reference internal"href="fix.html"><em>fix</em></a> command</li>
<li>style_name = <em>nvt</em> or <em>npt</em> or <em>nph</em></li>
<li>one or more keyword/value pairs may be appended</li>
</ul>
<preclass="literal-block">
keyword = <em>temp</em> or <em>iso</em> or <em>aniso</em> or <em>tri</em> or <em>x</em> or <em>y</em> or <em>z</em> or <em>xy</em> or <em>yz</em> or <em>xz</em> or <em>couple</em> or <em>tchain</em> or <em>pchain</em> or <em>mtk</em> or <em>tloop</em> or <em>ploop</em> or <em>nreset</em> or <em>drag</em> or <em>dilate</em> or <em>scalexy</em> or <em>scaleyz</em> or <em>scalexz</em> or <em>flip</em> or <em>fixedpoint</em>
<em>temp</em> values = Tstart Tstop Tdamp
Tstart,Tstop = external temperature at start/end of run
Tdamp = temperature damping parameter (time units)
<em>iso</em> or <em>aniso</em> or <em>tri</em> values = Pstart Pstop Pdamp
Pstart,Pstop = scalar external pressure at start/end of run (pressure units)
Pdamp = pressure damping parameter (time units)
<em>x</em> or <em>y</em> or <em>z</em> or <em>xy</em> or <em>yz</em> or <em>xz</em> values = Pstart Pstop Pdamp
Pstart,Pstop = external stress tensor component at start/end of run (pressure units)
Pdamp = stress damping parameter (time units)
<em>couple</em> = <em>none</em> or <em>xyz</em> or <em>xy</em> or <em>yz</em> or <em>xz</em>
<em>tchain</em> value = N
N = length of thermostat chain (1 = single thermostat)
<em>pchain</em> values = N
N length of thermostat chain on barostat (0 = no thermostat)
<em>mtk</em> value = <em>yes</em> or <em>no</em> = add in MTK adjustment term or not
<em>tloop</em> value = M
M = number of sub-cycles to perform on thermostat
<em>ploop</em> value = M
M = number of sub-cycles to perform on barostat thermostat
<em>nreset</em> value = reset reference cell every this many timesteps
<em>drag</em> value = Df
Df = drag factor added to barostat/thermostat (0.0 = no drag)
<em>dilate</em> value = dilate-group-ID
dilate-group-ID = only dilate atoms in this group due to barostat volume changes
<em>scalexy</em> value = <em>yes</em> or <em>no</em> = scale xy with ly
<em>scaleyz</em> value = <em>yes</em> or <em>no</em> = scale yz with lz
<em>scalexz</em> value = <em>yes</em> or <em>no</em> = scale xz with lz
<em>flip</em> value = <em>yes</em> or <em>no</em> = allow or disallow box flips when it becomes highly skewed
<em>fixedpoint</em> values = x y z
x,y,z = perform barostat dilation/contraction around this point (distance units)
</pre>
</div>
<divclass="section"id="examples">
<h2>Examples<aclass="headerlink"href="#examples"title="Permalink to this headline">¶</a></h2>
<divclass="highlight-python"><divclass="highlight"><pre>fix 1 all nvt temp 300.0 300.0 100.0
fix 1 water npt temp 300.0 300.0 100.0 iso 0.0 0.0 1000.0
<p>In some cases (e.g. for solids) the pressure (volume) and/or
temperature of the system can oscillate undesirably when a Nose/Hoover
barostat and thermostat is applied. The optional <em>drag</em> keyword will
damp these oscillations, although it alters the Nose/Hoover equations.
A value of 0.0 (no drag) leaves the Nose/Hoover formalism unchanged.
A non-zero value adds a drag term; the larger the value specified, the
greater the damping effect. Performing a short run and monitoring the
pressure and temperature is the best way to determine if the drag term
is working. Typically a value between 0.2 to 2.0 is sufficient to
damp oscillations after a few periods. Note that use of the drag
keyword will interfere with energy conservation and will also change
the distribution of positions and velocities so that they do not
correspond to the nominal NVT, NPT, or NPH ensembles.</p>
<p>An alternative way to control initial oscillations is to use chain
thermostats. The keyword <em>tchain</em> determines the number of thermostats
in the particle thermostat. A value of 1 corresponds to the original
Nose-Hoover thermostat. The keyword <em>pchain</em> specifies the number of
thermostats in the chain thermostatting the barostat degrees of
freedom. A value of 0 corresponds to no thermostatting of the
barostat variables.</p>
<p>The <em>mtk</em> keyword controls whether or not the correction terms due to
Martyna, Tuckerman, and Klein are included in the equations of motion
<aclass="reference internal"href="fix_rigid.html#martyna"><span>(Martyna)</span></a>. Specifying <em>no</em> reproduces the original
Hoover barostat, whose volume probability distribution function
differs from the true NPT and NPH ensembles by a factor of 1/V. Hence
using <em>yes</em> is more correct, but in many cases the difference is
negligible.</p>
<p>The keyword <em>tloop</em> can be used to improve the accuracy of integration
scheme at little extra cost. The initial and final updates of the
thermostat variables are broken up into <em>tloop</em> substeps, each of
length <em>dt</em>/<em>tloop</em>. This corresponds to using a first-order
Suzuki-Yoshida scheme <spanclass="xref std std-ref">(Tuckerman2006)</span>. The keyword
<em>ploop</em> does the same thing for the barostat thermostat.</p>
<p>The keyword <em>nreset</em> controls how often the reference dimensions used
to define the strain energy are reset. If this keyword is not used,
or is given a value of zero, then the reference dimensions are set to
those of the initial simulation domain and are never changed. If the
simulation domain changes significantly during the simulation, then
the final average pressure tensor will differ significantly from the
specified values of the external stress tensor. A value of <em>nstep</em>
means that every <em>nstep</em> timesteps, the reference dimensions are set
to those of the current simulation domain.</p>
<p>The <em>scaleyz</em>, <em>scalexz</em>, and <em>scalexy</em> keywords control whether or
not the corresponding tilt factors are scaled with the associated box
dimensions when barostatting triclinic periodic cells. The default
values <em>yes</em> will turn on scaling, which corresponds to adjusting the
linear dimensions of the cell while preserving its shape. Choosing
<em>no</em> ensures that the tilt factors are not scaled with the box
dimensions. See below for restrictions and default values in different
situations. In older versions of LAMMPS, scaling of tilt factors was
not performed. The old behavior can be recovered by setting all three
scale keywords to <em>no</em>.</p>
<p>The <em>flip</em> keyword allows the tilt factors for a triclinic box to
exceed half the distance of the parallel box length, as discussed
below. If the <em>flip</em> value is set to <em>yes</em>, the bound is enforced by
flipping the box when it is exceeded. If the <em>flip</em> value is set to
<em>no</em>, the tilt will continue to change without flipping. Note that if
applied stress induces large deformations (e.g. in a liquid), this
means the box shape can tilt dramatically and LAMMPS will run less
efficiently, due to the large volume of communication needed to
acquire ghost atoms around a processor’s irregular-shaped sub-domain.
For extreme values of tilt, LAMMPS may also lose atoms and generate an
error.</p>
<p>The <em>fixedpoint</em> keyword specifies the fixed point for barostat volume
changes. By default, it is the center of the box. Whatever point is
chosen will not move during the simulation. For example, if the lower
periodic boundaries pass through (0,0,0), and this point is provided
to <em>fixedpoint</em>, then the lower periodic boundaries will remain at
(0,0,0), while the upper periodic boundaries will move twice as
far. In all cases, the particle trajectories are unaffected by the
chosen value, except for a time-dependent constant translation of
positions.</p>
<hrclass="docutils"/>
<divclass="admonition warning">
<pclass="first admonition-title">Warning</p>
<pclass="last">Using a barostat coupled to tilt dimensions <em>xy</em>,
<em>xz</em>, <em>yz</em> can sometimes result in arbitrarily large values of the
tilt dimensions, i.e. a dramatically deformed simulation box. LAMMPS
allows the tilt factors to grow a small amount beyond the normal limit
of half the box length (0.6 times the box length), and then performs a
box “flip” to an equivalent periodic cell. See the discussion of the
<em>flip</em> keyword above, to allow this bound to be exceeded, if desired.</p>
</div>
<p>The flip operation is described in more detail in the doc page for
<aclass="reference internal"href="fix_deform.html"><em>fix deform</em></a>. Both the barostat dynamics and the atom
trajectories are unaffected by this operation. However, if a tilt
factor is incremented by a large amount (1.5 times the box length) on
a single timestep, LAMMPS can not accomodate this event and will
terminate the simulation with an error. This error typically indicates
that there is something badly wrong with how the simulation was
constructed, such as specifying values of <em>Pstart</em> that are too far
from the current stress value, or specifying a timestep that is too
large. Triclinic barostatting should be used with care. This also is
true for other barostat styles, although they tend to be more
forgiving of insults. In particular, it is important to recognize that
equilibrium liquids can not support a shear stress and that
equilibrium solids can not support shear stresses that exceed the
yield stress.</p>
<p>One exception to this rule is if the 1st dimension in the tilt factor
(x for xy) is non-periodic. In that case, the limits on the tilt
factor are not enforced, since flipping the box in that dimension does
not change the atom positions due to non-periodicity. In this mode,
if you tilt the system to extreme angles, the simulation will simply
become inefficient due to the highly skewed simulation box.</p>
<divclass="admonition warning">
<pclass="first admonition-title">Warning</p>
<pclass="last">Unlike the <aclass="reference internal"href="fix_temp_berendsen.html"><em>fix temp/berendsen</em></a> command which performs
thermostatting but NO time integration, these fixes perform
thermostatting/barostatting AND time integration. Thus you should not
use any other time integration fix, such as <aclass="reference internal"href="fix_nve.html"><em>fix nve</em></a> on
atoms to which this fix is applied. Likewise, fix nvt and fix npt
should not normally be used on atoms that also have their temperature
controlled by another fix - e.g. by <aclass="reference internal"href=""><em>fix langevin</em></a> or <aclass="reference internal"href="fix_temp_rescale.html"><em>fix temp/rescale</em></a> commands.</p>
</div>
<p>See <aclass="reference internal"href="Section_howto.html#howto-16"><span>this howto section</span></a> of the manual for
a discussion of different ways to compute temperature and perform
thermostatting and barostatting.</p>
<hrclass="docutils"/>
<p>These fixes compute a temperature and pressure each timestep. To do
this, the fix creates its own computes of style “temp” and “pressure”,
as if one of these two sets of commands had been issued:</p>
<divclass="highlight-python"><divclass="highlight"><pre>compute fix-ID_temp all temp
compute fix-ID_press all pressure fix-ID_temp
</pre></div>
</div>
<p>See the <aclass="reference internal"href="compute_temp.html"><em>compute temp</em></a> and <aclass="reference internal"href="compute_pressure.html"><em>compute pressure</em></a> commands for details. Note that the
IDs of the new computes are the fix-ID + underscore + “temp” or fix_ID
+ underscore + “press”. For fix nvt, the group for the new computes
is the same as the fix group. For fix nph and fix npt, the group for
the new computes is “all” since pressure is computed for the entire
system.</p>
<p>Note that these are NOT the computes used by thermodynamic output (see
the <aclass="reference internal"href="thermo_style.html"><em>thermo_style</em></a> command) with ID = <em>thermo_temp</em>
and <em>thermo_press</em>. This means you can change the attributes of this
fix’s temperature or pressure via the
<aclass="reference internal"href="compute_modify.html"><em>compute_modify</em></a> command or print this temperature
or pressure during thermodynamic output via the <aclass="reference internal"href="thermo_style.html"><em>thermo_style custom</em></a> command using the appropriate compute-ID.
It also means that changing attributes of <em>thermo_temp</em> or
<em>thermo_press</em> will have no effect on this fix.</p>
<p>Like other fixes that perform thermostatting, fix nvt and fix npt can
be used with <aclass="reference internal"href="compute.html"><em>compute commands</em></a> that calculate a
temperature after removing a “bias” from the atom velocities.
E.g. removing the center-of-mass velocity from a group of atoms or
only calculating temperature on the x-component of velocity or only
calculating temperature for atoms in a geometric region. This is not
done by default, but only if the <aclass="reference internal"href="fix_modify.html"><em>fix_modify</em></a> command
is used to assign a temperature compute to this fix that includes such
a bias term. See the doc pages for individual <aclass="reference internal"href="compute.html"><em>compute commands</em></a> to determine which ones include a bias. In
this case, the thermostat works in the following manner: the current
temperature is calculated taking the bias into account, bias is
removed from each atom, thermostatting is performed on the remaining
thermal degrees of freedom, and the bias is added back in.</p>
<hrclass="docutils"/>
<p>These fixes can be used with either the <em>verlet</em> or <em>respa</em>
<aclass="reference internal"href="run_style.html"><em>integrators</em></a>. When using one of the barostat fixes
with <em>respa</em>, LAMMPS uses an integrator constructed
according to the following factorization of the Liouville propagator
<p>This factorization differs somewhat from that of Tuckerman et al., in that
the barostat is only updated at the outermost rRESPA level, whereas
Tuckerman’s factorization requires splitting the pressure into pieces
corresponding to the forces computed at each rRESPA level. In theory, the
latter method will exhibit better numerical stability. In practice,
because Pdamp is normally chosen to be a large multiple of the
outermost rRESPA timestep, the barostat dynamics are not the
limiting factor for numerical stability. Both
factorizations are time-reversible and can be shown to preserve the phase
space measure of the underlying non-Hamiltonian equations of motion.</p>
<hrclass="docutils"/>
<p>The fix npt and fix nph commands can be used with rigid bodies or
mixtures of rigid bodies and non-rigid particles (e.g. solvent). But
there are also <aclass="reference internal"href="fix_rigid.html"><em>fix rigid/npt</em></a> and <aclass="reference internal"href="fix_rigid.html"><em>fix rigid/nph</em></a> commands, which are typically a more natural
choice. See the doc page for those commands for more discussion of
the various ways to do this.</p>
<hrclass="docutils"/>
<p>Styles with a <em>cuda</em>, <em>gpu</em>, <em>intel</em>, <em>kk</em>, <em>omp</em>, or <em>opt</em> suffix are
functionally the same as the corresponding style without the suffix.
They have been optimized to run faster, depending on your available
hardware, as discussed in <aclass="reference internal"href="Section_accelerate.html"><em>Section_accelerate</em></a>
of the manual. The accelerated styles take the same arguments and
should produce the same results, except for round-off and precision
issues.</p>
<p>These accelerated styles are part of the USER-CUDA, GPU, USER-INTEL,
KOKKOS, USER-OMP and OPT packages, respectively. They are only
enabled if LAMMPS was built with those packages. See the <aclass="reference internal"href="Section_start.html#start-3"><span>Making LAMMPS</span></a> section for more info.</p>
<p>You can specify the accelerated styles explicitly in your input script
by including their suffix, or you can use the <aclass="reference internal"href="Section_start.html#start-7"><span>-suffix command-line switch</span></a> when you invoke LAMMPS, or you can
use the <aclass="reference internal"href="suffix.html"><em>suffix</em></a> command in your input script.</p>
<p>See <aclass="reference internal"href="Section_accelerate.html"><em>Section_accelerate</em></a> of the manual for
more instructions on how to use the accelerated styles effectively.</p>
<h2>Restart, fix_modify, output, run start/stop, minimize info<aclass="headerlink"href="#restart-fix-modify-output-run-start-stop-minimize-info"title="Permalink to this headline">¶</a></h2>
<p>These fixes writes the state of all the thermostat and barostat
variables to <aclass="reference internal"href="restart.html"><em>binary restart files</em></a>. See the
<aclass="reference internal"href="read_restart.html"><em>read_restart</em></a> command for info on how to re-specify
a fix in an input script that reads a restart file, so that the
operation of the fix continues in an uninterrupted fashion.</p>
<p>The <aclass="reference internal"href="fix_modify.html"><em>fix_modify</em></a><em>temp</em> and <em>press</em> options are
supported by these fixes. You can use them to assign a
<aclass="reference internal"href="compute.html"><em>compute</em></a> you have defined to this fix which will be used
in its thermostatting or barostatting procedure, as described above.
If you do this, note that the kinetic energy derived from the compute
temperature should be consistent with the virial term computed using
all atoms for the pressure. LAMMPS will warn you if you choose to
compute temperature on a subset of atoms.</p>
<divclass="admonition warning">
<pclass="first admonition-title">Warning</p>
<pclass="last">If both the <em>temp</em> and <em>press</em> keywords are used in a
single thermo_modify command (or in two separate commands), then the
order in which the keywords are specified is important. Note that a
<aclass="reference internal"href="compute_pressure.html"><em>pressure compute</em></a> defines its own temperature
compute as an argument when it is specified. The <em>temp</em> keyword will
override this (for the pressure compute being used by fix npt), but
only if the <em>temp</em> keyword comes after the <em>press</em> keyword. If the
<em>temp</em> keyword comes before the <em>press</em> keyword, then the new pressure
compute specified by the <em>press</em> keyword will be unaffected by the
<em>temp</em> setting.</p>
</div>
<p>The <aclass="reference internal"href="fix_modify.html"><em>fix_modify</em></a><em>energy</em> option is supported by these
fixes to add the energy change induced by Nose/Hoover thermostatting
and barostatting to the system’s potential energy as part of
<p>These fixes compute a global scalar and a global vector of quantities,
which can be accessed by various <aclass="reference internal"href="Section_howto.html#howto-15"><span>output commands</span></a>. The scalar value calculated by
these fixes is “extensive”; the vector values are “intensive”.</p>
<p>The scalar is the cumulative energy change due to the fix.</p>
<p>The vector stores internal Nose/Hoover thermostat and barostat
variables. The number and meaning of the vector values depends on
which fix is used and the settings for keywords <em>tchain</em> and <em>pchain</em>,
which specify the number of Nose/Hoover chains for the thermostat and
barostat. If no thermostatting is done, then <em>tchain</em> is 0. If no
barostatting is done, then <em>pchain</em> is 0. In the following list,
“ndof” is 0, 1, 3, or 6, and is the number of degrees of freedom in
the barostat. Its value is 0 if no barostat is used, else its value
is 6 if any off-diagonal stress tensor component is barostatted, else
its value is 1 if <em>couple xyz</em> is used or <em>couple xy</em> for a 2d
simulation, otherwise its value is 3.</p>
<p>The order of values in the global vector and their meaning is as
follows. The notation means there are tchain values for eta, followed
by tchain for eta_dot, followed by ndof for omega, etc:</p>
<li>PE_eta[tchain] = potential energy of each particle thermostat displacement (energy units)</li>
<li>KE_eta_dot[tchain] = kinetic energy of each particle thermostat velocity (energy units)</li>
<li>PE_omega[ndof] = potential energy of each barostat displacement (energy units)</li>
<li>KE_omega_dot[ndof] = kinetic energy of each barostat velocity (energy units)</li>
<li>PE_etap[pchain] = potential energy of each barostat thermostat displacement (energy units)</li>
<li>KE_etap_dot[pchain] = kinetic energy of each barostat thermostat velocity (energy units)</li>
<li>PE_strain[1] = scalar strain energy (energy units)</li>
</ul>
<p>These fixes can ramp their external temperature and pressure over
multiple runs, using the <em>start</em> and <em>stop</em> keywords of the
<aclass="reference internal"href="run.html"><em>run</em></a> command. See the <aclass="reference internal"href="run.html"><em>run</em></a> command for details of
how to do this.</p>
<p>These fixes are not invoked during <aclass="reference internal"href="minimize.html"><em>energy minimization</em></a>.</p>
</div>
<hrclass="docutils"/>
<divclass="section"id="restrictions">
<h2>Restrictions<aclass="headerlink"href="#restrictions"title="Permalink to this headline">¶</a></h2>
<p><em>X</em>, <em>y</em>, <em>z</em> cannot be barostatted if the associated dimension is not
periodic. <em>Xy</em>, <em>xz</em>, and <em>yz</em> can only be barostatted if the
simulation domain is triclinic and the 2nd dimension in the keyword
(<em>y</em> dimension in <em>xy</em>) is periodic. <em>Z</em>, <em>xz</em>, and <em>yz</em>, cannot be
barostatted for 2D simulations. The <aclass="reference internal"href="create_box.html"><em>create_box</em></a>,
<aclass="reference internal"href="read_data.html"><em>read data</em></a>, and <aclass="reference internal"href="read_restart.html"><em>read_restart</em></a>
commands specify whether the simulation box is orthogonal or
non-orthogonal (triclinic) and explain the meaning of the xy,xz,yz
tilt factors.</p>
<p>For the <em>temp</em> keyword, the final Tstop cannot be 0.0 since it would
make the external T = 0.0 at some timestep during the simulation which
is not allowed in the Nose/Hoover formulation.</p>
<p>The <em>scaleyz yes</em> and <em>scalexz yes</em> keyword/value pairs can not be used
for 2D simulations. <em>scaleyz yes</em>, <em>scalexz yes</em>, and <em>scalexy yes</em> options
can only be used if the 2nd dimension in the keyword is periodic,
and if the tilt factor is not coupled to the barostat via keywords
<em>tri</em>, <em>yz</em>, <em>xz</em>, and <em>xy</em>.</p>
<p>These fixes can be used with dynamic groups as defined by the
<aclass="reference internal"href="group.html"><em>group</em></a> command. Likewise they can be used with groups to
which atoms are added or deleted over time, e.g. a deposition
simulation. However, the conservation properties of the thermostat
and barostat are defined for systems with a static set of atoms. You
may observe odd behavior if the atoms in a group vary dramatically
over time or the atom count becomes very small.</p>
</div>
<divclass="section"id="related-commands">
<h2>Related commands<aclass="headerlink"href="#related-commands"title="Permalink to this headline">¶</a></h2>
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>.