forked from lijiext/lammps
370 lines
18 KiB
HTML
370 lines
18 KiB
HTML
<HTML>
|
|
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A>
|
|
</CENTER>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<HR>
|
|
|
|
<H3>fix box/relax command
|
|
</H3>
|
|
<P><B>Syntax:</B>
|
|
</P>
|
|
<PRE>fix ID group-ID box/relax keyword value ...
|
|
</PRE>
|
|
<UL><LI>ID, group-ID are documented in <A HREF = "fix.html">fix</A> command
|
|
|
|
<LI>box/relax = style name of this fix command
|
|
|
|
<PRE>one or more keyword value pairs may be appended
|
|
keyword = <I>iso</I> or <I>aniso</I> or <I>tri</I> or <I>x</I> or <I>y</I> or <I>z</I> or <I>xy</I> or <I>yz</I> or <I>xz</I> or <I>couple</I> or <I>nreset</I> or <I>vmax</I> or <I>dilate</I> or <I>scaleyz</I> or <I>scalexz</I> or <I>scalexy</I> or <I>fixedpoint</I>
|
|
<I>iso</I> or <I>aniso</I> or <I>tri</I> value = Ptarget = desired pressure (pressure units)
|
|
<I>x</I> or <I>y</I> or <I>z</I> or <I>xy</I> or <I>yz</I> or <I>xz</I> value = Ptarget = desired pressure (pressure units)
|
|
<I>couple</I> = <I>none</I> or <I>xyz</I> or <I>xy</I> or <I>yz</I> or <I>xz</I>
|
|
<I>nreset</I> value = reset reference cell every this many minimizer iterations
|
|
<I>vmax</I> value = fraction = max allowed volume change in one iteration
|
|
<I>dilate</I> value = <I>all</I> or <I>partial</I>
|
|
<I>scaleyz</I> value = <I>yes</I> or <I>no</I> = scale yz with lz
|
|
<I>scalexz</I> value = <I>yes</I> or <I>no</I> = scale xz with lz
|
|
<I>scalexy</I> value = <I>yes</I> or <I>no</I> = scale xy with ly
|
|
<I>fixedpoint</I> values = x y z
|
|
x,y,z = perform relaxation dilation/contraction around this point (distance units)
|
|
</PRE>
|
|
|
|
</UL>
|
|
<P><B>Examples:</B>
|
|
</P>
|
|
<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>
|
|
<P><B>Description:</B>
|
|
</P>
|
|
<P>Apply an external pressure or stress tensor to the simulation box
|
|
during an <A HREF = "minimize.html">energy minimization</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>
|
|
<HR>
|
|
|
|
<P>The external pressure tensor is specified using one or more of the
|
|
<I>iso</I>, <I>aniso</I>, <I>tri</I>, <I>x</I>, <I>y</I>, <I>z</I>, <I>xy</I>, <I>xz</I>, <I>yz</I>, and <I>couple</I>
|
|
keywords. These keywords give you the ability to specify all 6
|
|
components of an external stress tensor, and to couple various of
|
|
these components together so that the dimensions they represent are
|
|
varied together during the mimimization.
|
|
</P>
|
|
<P>Orthogonal simulation boxes have 3 adjustable dimensions (x,y,z).
|
|
Triclinic (non-orthogonal) simulation boxes have 6 adjustable
|
|
dimensions (x,y,z,xy,xz,yz). The <A HREF = "create_box.html">create_box</A>, <A HREF = "read_data.html">read
|
|
data</A>, and <A HREF = "read_restart.html">read_restart</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 target pressures <I>Ptarget</I> for each of the 6 components of the
|
|
stress tensor can be specified independently via the <I>x</I>, <I>y</I>, <I>z</I>,
|
|
<I>xy</I>, <I>xz</I>, <I>yz</I> keywords, which correspond to the 6 simulation box
|
|
dimensions. For example, if the <I>y</I> keyword is used, the y-box length
|
|
will change during the minimization. If the <I>xy</I> keyword is used, the
|
|
xy tilt factor will change. A box dimension will not change if that
|
|
component is not specified.
|
|
</P>
|
|
<P>Note that in order to use the <I>xy</I>, <I>xz</I>, or <I>yz</I> keywords, the
|
|
simulation box must be triclinic, even if its initial tilt factors are
|
|
0.0.
|
|
</P>
|
|
<P>When the size of the simulation box changes, all atoms are re-scaled
|
|
to new positions, unless the keyword <I>dilate</I> is specified with a
|
|
value of <I>partial</I>, in which case only the atoms in the fix group are
|
|
re-scaled. This can be useful for leaving the coordinates of atoms in
|
|
a solid substrate unchanged and controlling the pressure of a
|
|
surrounding fluid.
|
|
</P>
|
|
<P>The <I>scaleyz</I>, <I>scalexz</I>, and <I>scalexy</I> keywords control whether or
|
|
not the corresponding tilt factors are scaled with the associated box
|
|
dimensions when relaxing triclinic periodic cells. The default
|
|
values <I>yes</I> will turn on scaling, which corresponds to adjusting the
|
|
linear dimensions of the cell while preserving its shape. Choosing
|
|
<I>no</I> 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 <I>no</I>.
|
|
</P>
|
|
<P>The <I>fixedpoint</I> keyword specifies the fixed point for cell relaxation.
|
|
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 <I>fixedpoint</I>, 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 positions at each iteration are
|
|
unaffected by the chosen value, except that all particles are
|
|
displaced by the same amount, different on each iteration.
|
|
</P>
|
|
<P>IMPORTANT NOTE: Appling an external pressure to tilt dimensions <I>xy</I>,
|
|
<I>xz</I>, <I>yz</I> can sometimes result in arbitrarily large values of the
|
|
tilt factors, i.e. a dramatically deformed simulation box. This
|
|
typically indicates that there is something badly wrong with how the
|
|
simulation was constructed. The two most common sources of this error
|
|
are applying a shear stress to a liquid system or specifying an
|
|
external shear stress tensor that exceeds the yield stress of the
|
|
solid. In either case the minimization may converge to a bogus
|
|
conformation or not converge at all. Also note that if the box shape
|
|
tilts to an extreme shape, 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>IMPORTANT NOTE: Performing a minimization with this fix is not a
|
|
mathematically well-defined minimization problem. This is because the
|
|
objective function being minimized changes if the box size/shape
|
|
changes. In practice this means the minimizer can get "stuck" before
|
|
you have reached the desired tolerance. The solution to this is to
|
|
restart the minmizer from the new adjusted box size/shape, since that
|
|
creates a new objective function valid for the new box size/shape.
|
|
Repeat as necessary until the box size/shape has reached its new
|
|
equilibrium.
|
|
</P>
|
|
<HR>
|
|
|
|
<HR>
|
|
|
|
<HR>
|
|
|
|
<P>The <I>couple</I> keyword allows two or three of the diagonal components of
|
|
the pressure tensor to be "coupled" together. The value specified
|
|
with the keyword determines which are coupled. For example, <I>xz</I>
|
|
means the <I>Pxx</I> and <I>Pzz</I> components of the stress tensor are coupled.
|
|
<I>Xyz</I> means all 3 diagonal components are coupled. Coupling means two
|
|
things: the instantaneous stress will be computed as an average of the
|
|
corresponding diagonal components, and the coupled box dimensions will
|
|
be changed together in lockstep, meaning coupled dimensions will be
|
|
dilated or contracted by the same percentage every timestep. The
|
|
<I>Ptarget</I> values for any coupled dimensions must be identical.
|
|
<I>Couple xyz</I> can be used for a 2d simulation; the <I>z</I> dimension is
|
|
simply ignored.
|
|
</P>
|
|
<HR>
|
|
|
|
<P>The <I>iso</I>, <I>aniso</I>, and <I>tri</I> keywords are simply shortcuts that are
|
|
equivalent to specifying several other keywords together.
|
|
</P>
|
|
<P>The keyword <I>iso</I> means couple all 3 diagonal components together when
|
|
pressure is computed (hydrostatic pressure), and dilate/contract the
|
|
dimensions together. Using "iso Ptarget" is the same as specifying
|
|
these 4 keywords:
|
|
</P>
|
|
<PRE>x Ptarget
|
|
y Ptarget
|
|
z Ptarget
|
|
couple xyz
|
|
</PRE>
|
|
<P>The keyword <I>aniso</I> means <I>x</I>, <I>y</I>, and <I>z</I> dimensions are controlled
|
|
independently using the <I>Pxx</I>, <I>Pyy</I>, and <I>Pzz</I> components of the
|
|
stress tensor as the driving forces, and the specified scalar external
|
|
pressure. Using "aniso Ptarget" is the same as specifying these 4
|
|
keywords:
|
|
</P>
|
|
<PRE>x Ptarget
|
|
y Ptarget
|
|
z Ptarget
|
|
couple none
|
|
</PRE>
|
|
<P>The keyword <I>tri</I> means <I>x</I>, <I>y</I>, <I>z</I>, <I>xy</I>, <I>xz</I>, and <I>yz</I> dimensions
|
|
are controlled independently using their individual stress components
|
|
as the driving forces, and the specified scalar pressure as the
|
|
external normal stress. Using "tri Ptarget" is the same as specifying
|
|
these 7 keywords:
|
|
</P>
|
|
<PRE>x Ptarget
|
|
y Ptarget
|
|
z Ptarget
|
|
xy 0.0
|
|
yz 0.0
|
|
xz 0.0
|
|
couple none
|
|
</PRE>
|
|
<HR>
|
|
|
|
<P>The <I>vmax</I> keyword can be used to limit the fractional change in the
|
|
volume of the simulation box that can occur in one iteration of the
|
|
minimizer. If the pressure is not settling down during the
|
|
minimization this can be because the volume is fluctuating too much.
|
|
The specified fraction must be greater than 0.0 and should be << 1.0.
|
|
A value of 0.001 means the volume cannot change by more than 1/10 of a
|
|
percent in one iteration when <I>couple xyz</I> has been specified. For
|
|
any other case it means no linear dimension of the simulation box can
|
|
change by more than 1/10 of a percent.
|
|
</P>
|
|
<HR>
|
|
|
|
<P>With this fix, the potential energy used by the minimizer is augmented
|
|
by an additional energy provided by the fix. The overall objective
|
|
function then is:
|
|
</P>
|
|
<CENTER><IMG SRC = "Eqs/fix_box_relax1.jpg">
|
|
</CENTER>
|
|
<P>where <I>U</I> is the system potential energy, <I>P</I>_t is the desired
|
|
hydrostatic pressure, <I>V</I> and <I>V</I>_0 are the system and reference
|
|
volumes, respectively. <I>E</I>_<I>strain</I> is the strain energy expression
|
|
proposed by Parrinello and Rahman <A HREF = "#Parrinello1981">(Parrinello1981)</A>.
|
|
Taking derivatives of <I>E</I> w.r.t. the box dimensions, and setting these
|
|
to zero, we find that at the minimum of the objective function, the
|
|
global system stress tensor <B>P</B> will satisfy the relation:
|
|
</P>
|
|
<CENTER><IMG SRC = "Eqs/fix_box_relax2.jpg">
|
|
</CENTER>
|
|
<P>where <B>I</B> is the identity matrix, <B>h</B>_0 is the box dimension tensor of
|
|
the reference cell, and <B>h</B>_0<I>d</I> is the diagonal part of
|
|
<B>h</B>_0. <B>S</B>_<I>t</I> is a symmetric stress tensor that is chosen by LAMMPS
|
|
so that the upper-triangular components of <B>P</B> 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 <I>nreset_ref</I> 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 <I>nstep</I> means that every <I>nstep</I>
|
|
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 <I>nreset</I>, or simply continuing the minimization
|
|
from a restart file.
|
|
</P>
|
|
<P>IMPORTANT NOTE: As normally computed, pressure includes a kinetic-
|
|
energy or temperature-dependent component; see the <A HREF = "compute_pressure.html">compute
|
|
pressure</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>
|
|
<P>IMPORTANT NOTE: 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>
|
|
<HR>
|
|
|
|
<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",
|
|
as if these commands had been issued:
|
|
</P>
|
|
<PRE>compute fix-ID_temp group-ID temp
|
|
compute fix-ID_press group-ID pressure fix-ID_temp virial
|
|
</PRE>
|
|
<P>See the <A HREF = "compute_temp.html">compute temp</A> and <A HREF = "compute_pressure.html">compute
|
|
pressure</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 <A HREF = "thermo_style.html">thermo_style</A> command) with ID = <I>thermo_temp</I>
|
|
and <I>thermo_press</I>. This means you can change the attributes of this
|
|
fix's temperature or pressure via the
|
|
<A HREF = "compute_modify.html">compute_modify</A> command or print this temperature
|
|
or pressure during thermodynamic output via the <A HREF = "thermo_style.html">thermo_style
|
|
custom</A> command using the appropriate compute-ID.
|
|
It also means that changing attributes of <I>thermo_temp</I> or
|
|
<I>thermo_press</I> will have no effect on this fix.
|
|
</P>
|
|
<HR>
|
|
|
|
<P><B>Restart, fix_modify, output, run start/stop, minimize info:</B>
|
|
</P>
|
|
<P>No information about this fix is written to <A HREF = "restart.html">binary restart
|
|
files</A>.
|
|
</P>
|
|
<P>The <A HREF = "fix_modify.html">fix_modify</A> <I>temp</I> and <I>press</I> options are
|
|
supported by this fix. You can use them to assign a
|
|
<A HREF = "compute.html">compute</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>
|
|
<P>IMPORTANT NOTE: If both the <I>temp</I> and <I>press</I> 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
|
|
<A HREF = "compute_pressure.html">pressure compute</A> defines its own temperature
|
|
compute as an argument when it is specified. The <I>temp</I> keyword will
|
|
override this (for the pressure compute being used by fix npt), but
|
|
only if the <I>temp</I> keyword comes after the <I>press</I> keyword. If the
|
|
<I>temp</I> keyword comes before the <I>press</I> keyword, then the new pressure
|
|
compute specified by the <I>press</I> keyword will be unaffected by the
|
|
<I>temp</I> setting.
|
|
</P>
|
|
<P>This fix computes a global scalar which can be accessed by various
|
|
<A HREF = "Section_howto.html#howto_15">output commands</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 <I>start/stop</I> keywords of
|
|
the <A HREF = "run.html">run</A> command.
|
|
</P>
|
|
<P>This fix is invoked during <A HREF = "minimize.html">energy minimization</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>
|
|
<P><B>Restrictions:</B>
|
|
</P>
|
|
<P>Only dimensions that are available can be adjusted by this fix.
|
|
Non-periodic dimensions are not available. <I>z</I>, <I>xz</I>, and <I>yz</I>, are
|
|
not available for 2D simulations. <I>xy</I>, <I>xz</I>, and <I>yz</I> are only
|
|
available if the simulation domain is non-orthogonal. The
|
|
<A HREF = "create_box.html">create_box</A>, <A HREF = "read_data.html">read data</A>, and
|
|
<A HREF = "read_restart.html">read_restart</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 <I>scaleyz yes</I> and <I>scalexz yes</I> keyword/value pairs can not be used
|
|
for 2D simulations. <I>scaleyz yes</I>, <I>scalexz yes</I>, and <I>scalexy yes</I> 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
|
|
<I>tri</I>, <I>yz</I>, <I>xz</I>, and <I>xy</I>.
|
|
</P>
|
|
<P><B>Related commands:</B>
|
|
</P>
|
|
<P><A HREF = "fix_nh.html">fix npt</A>, <A HREF = "minimize.html">minimize</A>
|
|
</P>
|
|
<P><B>Default:</B>
|
|
</P>
|
|
<P>The keyword defaults are dilate = all, vmax = 0.0001, nreset = 0.
|
|
</P>
|
|
<HR>
|
|
|
|
<A NAME = "Parrinello1981"></A>
|
|
|
|
<P><B>(Parrinello1981)</B> Parrinello and Rahman, J Appl Phys, 52, 7182 (1981).
|
|
</P>
|
|
</HTML>
|