<spanid="index-0"></span><h1>fix box/relax command<aclass="headerlink"href="#fix-box-relax-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 box/relax 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>box/relax = style name of this fix command</li>
</ul>
<preclass="literal-block">
one or more keyword value pairs may be appended
keyword = <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>nreset</em> or <em>vmax</em> or <em>dilate</em> or <em>scaleyz</em> or <em>scalexz</em> or <em>scalexy</em> or <em>fixedpoint</em>
<em>iso</em> or <em>aniso</em> or <em>tri</em> value = Ptarget = desired pressure (pressure units)
<em>x</em> or <em>y</em> or <em>z</em> or <em>xy</em> or <em>yz</em> or <em>xz</em> value = Ptarget = desired pressure (pressure units)
<em>couple</em> = <em>none</em> or <em>xyz</em> or <em>xy</em> or <em>yz</em> or <em>xz</em>
<em>nreset</em> value = reset reference cell every this many minimizer iterations
<em>vmax</em> value = fraction = max allowed volume change in one iteration
<em>dilate</em> value = <em>all</em> or <em>partial</em>
<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>scalexy</em> value = <em>yes</em> or <em>no</em> = scale xy with ly
<em>fixedpoint</em> values = x y z
x,y,z = perform relaxation 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 box/relax iso 0.0 vmax 0.001
fix 2 water box/relax aniso 0.0 dilate partial
fix 2 ice box/relax tri 0.0 couple xy nreset 100
</pre></div>
</div>
</div>
<divclass="section"id="description">
<h2>Description<aclass="headerlink"href="#description"title="Permalink to this headline">¶</a></h2>
<p>Apply an external pressure or stress tensor to the simulation box
during an <aclass="reference internal"href="minimize.html"><em>energy minimization</em></a>. This allows the box
size and shape to vary during the iterations of the minimizer so that
the final configuration will be both an energy minimum for the
potential energy of the atoms, and the system pressure tensor will be
close to the specified external tensor. Conceptually, specifying a
positive pressure is like squeezing on the simulation box; a negative
pressure typically allows the box to expand.</p>
<hrclass="docutils"/>
<p>The external pressure tensor is specified using one or more of the
<p>where <strong>I</strong> is the identity matrix, <strong>h**_0 is the box dimension tensor of
the reference cell, and **h**_0*d* is the diagonal part of
**h**_0. **S**_*t* is a symmetric stress tensor that is chosen by LAMMPS
so that the upper-triangular components of **P</strong> equal the stress tensor
specified by the user.</p>
<p>This equation only applies when the box dimensions are equal to those
of the reference dimensions. If this is not the case, then the
converged stress tensor will not equal that specified by the user. We
can resolve this problem by periodically resetting the reference
dimensions. The keyword <em>nreset_ref</em> controls how often this is done.
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. A value of <em>nstep</em> means that every <em>nstep</em>
minimization steps, the reference dimensions are set to those of the
current simulation domain. Note that resetting the reference
dimensions changes the objective function and gradients, which
sometimes causes the minimization to fail. This can be resolved by
changing the value of <em>nreset</em>, or simply continuing the minimization
from a restart file.</p>
<divclass="admonition warning">
<pclass="first admonition-title">Warning</p>
<pclass="last">As normally computed, pressure includes a kinetic-
energy or temperature-dependent component; see the <aclass="reference internal"href="compute_pressure.html"><em>compute pressure</em></a> command. However, atom velocities are
ignored during a minimization, and the applied pressure(s) specified
with this command are assumed to only be the virial component of the
pressure (the non-kinetic portion). Thus if atoms have a non-zero
temperature and you print the usual thermodynamic pressure, it may not
appear the system is converging to your specified pressure. The
solution for this is to either (a) zero the velocities of all atoms
before performing the minimization, or (b) make sure you are
monitoring the pressure without its kinetic component. The latter can
be done by outputting the pressure from the fix this command creates
(see below) or a pressure fix you define yourself.</p>
</div>
<divclass="admonition warning">
<pclass="first admonition-title">Warning</p>
<pclass="last">Because pressure is often a very sensitive function of
volume, it can be difficult for the minimizer to equilibrate the
system the desired pressure with high precision, particularly for
solids. Some techniques that seem to help are (a) use the
“min_modify line quadratic” option when minimizing with box
relaxations, (b) minimize several times in succession if need be,
to drive the pressure closer to the target pressure, (c) relax
the atom positions before relaxing the box, and (d) relax the box
to the target hydrostatic pressure before relaxing to a target
shear stress state. Also note that
some systems (e.g. liquids) will not sustain a non-hydrostatic applied
pressure, which means the minimizer will not converge.</p>
</div>
<hrclass="docutils"/>
<p>This fix computes a temperature and pressure each timestep. The
temperature is used to compute the kinetic contribution to the
pressure, even though this is subsequently ignored by default. To do
this, the fix creates its own computes of style “temp” and “pressure”,
<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”, and the group for the new computes is the same
as the fix group. Also note that the pressure compute does not
include a kinetic component.</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>
<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>No information about this fix is written to <aclass="reference internal"href="restart.html"><em>binary restart files</em></a>.</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 this fix. 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 temperature and pressure calculation, as described above. Note
that as described above, if you assign a pressure compute to this fix
that includes a kinetic energy component it will affect the
minimization, most likely in an undesirable way.</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>This fix computes a global scalar which can be accessed by various
<aclass="reference internal"href="Section_howto.html#howto-15"><span>output commands</span></a>. The scalar is the
pressure-volume energy, plus the strain energy, if it exists.</p>
<p>No parameter of this fix can be used with the <em>start/stop</em> keywords of
the <aclass="reference internal"href="run.html"><em>run</em></a> command.</p>
<p>This fix is invoked during <aclass="reference internal"href="minimize.html"><em>energy minimization</em></a>, but
not for the purpose of adding a contribution to the energy or forces
being minimized. Instead it alters the simulation box geometry as
described above.</p>
</div>
<divclass="section"id="restrictions">
<h2>Restrictions<aclass="headerlink"href="#restrictions"title="Permalink to this headline">¶</a></h2>
<p>Only dimensions that are available can be adjusted by this fix.
Non-periodic dimensions are not available. <em>z</em>, <em>xz</em>, and <em>yz</em>, are
not available for 2D simulations. <em>xy</em>, <em>xz</em>, and <em>yz</em> are only
available if the simulation domain is non-orthogonal. 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>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>
</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>.