Page MenuHomec4science

change_box.html
No OneTemporary

File Metadata

Created
Tue, Dec 24, 13:24

change_box.html

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>change_box command &mdash; LAMMPS 15 May 2015 version documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/sphinxcontrib-images/LightBox2/lightbox2/css/lightbox.css" type="text/css" />
<link rel="top" title="LAMMPS 15 May 2015 version documentation" href="index.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="Manual.html" class="icon icon-home"> LAMMPS
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="Section_intro.html">1. Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_start.html">2. Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_commands.html">3. Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_packages.html">4. Packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_accelerate.html">5. Accelerating LAMMPS performance</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_howto.html">6. How-to discussions</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_example.html">7. Example problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_perf.html">8. Performance &amp; scalability</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_tools.html">9. Additional tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_modify.html">10. Modifying &amp; extending LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_python.html">11. Python interface to LAMMPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_errors.html">12. Errors</a></li>
<li class="toctree-l1"><a class="reference internal" href="Section_history.html">13. Future and history</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="Manual.html">LAMMPS</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="Manual.html">Docs</a> &raquo;</li>
<li>change_box command</li>
<li class="wy-breadcrumbs-aside">
<a href="http://lammps.sandia.gov">Website</a>
<a href="Section_commands.html#comm">Commands</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="change-box-command">
<span id="index-0"></span><h1>change_box command<a class="headerlink" href="#change-box-command" title="Permalink to this headline">¶</a></h1>
<div class="section" id="syntax">
<h2>Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre>change_box group-ID parameter args ... keyword args ...
</pre></div>
</div>
<ul class="simple">
<li>group-ID = ID of group of atoms to (optionally) displace</li>
<li>one or more parameter/arg pairs may be appended</li>
</ul>
<pre class="literal-block">
parameter = <em>x</em> or <em>y</em> or <em>z</em> or <em>xy</em> or <em>xz</em> or <em>yz</em> or <em>boundary</em> or <em>ortho</em> or <em>triclinic</em> or <em>set</em> or <em>remap</em>
<em>x</em>, <em>y</em>, <em>z</em> args = style value(s)
style = <em>final</em> or <em>delta</em> or <em>scale</em> or <em>volume</em>
<em>final</em> values = lo hi
lo hi = box boundaries after displacement (distance units)
<em>delta</em> values = dlo dhi
dlo dhi = change in box boundaries after displacement (distance units)
<em>scale</em> values = factor
factor = multiplicative factor for change in box length after displacement
<em>volume</em> value = none = adjust this dim to preserve volume of system
<em>xy</em>, <em>xz</em>, <em>yz</em> args = style value
style = <em>final</em> or <em>delta</em>
<em>final</em> value = tilt
tilt = tilt factor after displacement (distance units)
<em>delta</em> value = dtilt
dtilt = change in tilt factor after displacement (distance units)
<em>boundary</em> args = x y z
x,y,z = <em>p</em> or <em>s</em> or <em>f</em> or <em>m</em>, one or two letters
<em>p</em> is periodic
<em>f</em> is non-periodic and fixed
<em>s</em> is non-periodic and shrink-wrapped
<em>m</em> is non-periodic and shrink-wrapped with a minimum value
<em>ortho</em> args = none = change box to orthogonal
<em>triclinic</em> args = none = change box to triclinic
<em>set</em> args = none = store state of current box
<em>remap</em> args = none = remap atom coords from last saved state to current box
</pre>
<ul class="simple">
<li>zero or more keyword/value pairs may be appended</li>
<li>keyword = <em>units</em></li>
</ul>
<pre class="literal-block">
<em>units</em> value = <em>lattice</em> or <em>box</em>
lattice = distances are defined in lattice units
box = distances are defined in simulation box units
</pre>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre>change_box all xy final -2.0 z final 0.0 5.0 boundary p p f remap units box
change_box all x scale 1.1 y volume z volume remap
</pre></div>
</div>
</div>
<div class="section" id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>Change the volume and/or shape and/or boundary conditions for the
simulation box. Orthogonal simulation boxes have 3 adjustable size
parameters (x,y,z). Triclinic (non-orthogonal) simulation boxes have
6 adjustable size/shape parameters (x,y,z,xy,xz,yz). Any or all of
them can be adjusted independently by this command. Thus it can be
used to expand or contract a box, or to apply a shear strain to a
non-orthogonal box. It can also be used to change the boundary
conditions for the simulation box, similar to the
<a class="reference internal" href="boundary.html"><em>boundary</em></a> command.</p>
<p>The size and shape of the initial simulation box are specified by the
<a class="reference internal" href="create_box.html"><em>create_box</em></a> or <a class="reference internal" href="read_data.html"><em>read_data</em></a> or
<a class="reference internal" href="read_restart.html"><em>read_restart</em></a> command used to setup the simulation.
The size and shape may be altered by subsequent runs, e.g. by use of
the <a class="reference internal" href="fix_nh.html"><em>fix npt</em></a> or <a class="reference internal" href="fix_deform.html"><em>fix deform</em></a> commands.
The <a class="reference internal" href="create_box.html"><em>create_box</em></a>, <a class="reference internal" href="read_data.html"><em>read data</em></a>, and
<a class="reference internal" href="read_restart.html"><em>read_restart</em></a> commands also determine whether the
simulation box is orthogonal or triclinic and their doc pages explain
the meaning of the xy,xz,yz tilt factors.</p>
<p>See <a class="reference internal" href="Section_howto.html#howto-12"><span>Section_howto 12</span></a> of the doc pages
for a geometric description of triclinic boxes, as defined by LAMMPS,
and how to transform these parameters to and from other commonly used
triclinic representations.</p>
<p>The keywords used in this command are applied sequentially to the
simulation box and the atoms in it, in the order specified.</p>
<p>Before the sequence of keywords are invoked, the current box
size/shape is stored, in case a <em>remap</em> keyword is used to map the
atom coordinates from a previously stored box size/shape to the
current one.</p>
<p>After all the keywords have been processed, any shrink-wrap boundary
conditions are invoked (see the <a class="reference internal" href="boundary.html"><em>boundary</em></a> command)
which may change simulation box boundaries, and atoms are migrated to
new owning processors.</p>
<p>IMPORTANT_NOTE: This means that you cannot use the change_box command
to enlarge a shrink-wrapped box, e.g. to make room to insert more
atoms via the <a class="reference internal" href="create_atoms.html"><em>create_atoms</em></a> command, because the
simulation box will be re-shrink-wrapped before the change_box command
completes. Instead you could do something like this, assuming the
simulation box is non-periodic and atoms extend from 0 to 20 in all
dimensions:</p>
<div class="highlight-python"><div class="highlight"><pre>change_box all x final -10 20
create_atoms 1 single -5 5 5 # this will fail to insert an atom
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre>change_box all x final -10 20 boundary f s s
create_atoms 1 single -5 5 5
change_box boundary s s s # this will work
</pre></div>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Unlike the earlier &#8220;displace_box&#8221; version of this
command, atom remapping is NOT performed by default. This command
allows remapping to be done in a more general way, exactly when you
specify it (zero or more times) in the sequence of transformations.
Thus if you do not use the <em>remap</em> keyword, atom coordinates will not
be changed even if the box size/shape changes. If a uniformly
strained state is desired, the <em>remap</em> keyword should be specified.</p>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">It is possible to lose atoms with this command.
E.g. by changing the box without remapping the atoms, and having atoms
end up outside of non-periodic boundaries. It is also possible to
alter bonds between atoms straddling a boundary in bad ways. E.g. by
converting a boundary from periodic to non-periodic. It is also
possible when remapping atoms to put them (nearly) on top of each
other. E.g. by converting a boundary from non-periodic to periodic.
All of these will typically lead to bad dynamics and/or generate error
messages.</p>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The simulation box size/shape can be changed by
arbitrarily large amounts by this command. This is not a problem,
except that the mapping of processors to the simulation box is not
changed from its initial 3d configuration; see the
<a class="reference internal" href="processors.html"><em>processors</em></a> command. Thus, if the box size/shape
changes dramatically, the mapping of processors to the simulation box
may not end up as optimal as the initial mapping attempted to be.</p>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Because the keywords used in this command are applied
one at a time to the simulation box and the atoms in it, care must be
taken with triclinic cells to avoid exceeding the limits on skew after
each transformation in the sequence. If skew is exceeded before the
final transformation this can be avoided by changing the order of the
sequence, or breaking the transformation into two or more smaller
transformations. For more information on the allowed limits for box
skew see the discussion on triclinic boxes on <a class="reference internal" href="Section_howto.html#howto-12"><span>this page</span></a>.</p>
</div>
<hr class="docutils" />
<p>For the <em>x</em>, <em>y</em>, and <em>z</em> parameters, this is the meaning of their
styles and values.</p>
<p>For style <em>final</em>, the final lo and hi box boundaries of a dimension
are specified. The values can be in lattice or box distance units.
See the discussion of the units keyword below.</p>
<p>For style <em>delta</em>, plus or minus changes in the lo/hi box boundaries
of a dimension are specified. The values can be in lattice or box
distance units. See the discussion of the units keyword below.</p>
<p>For style <em>scale</em>, a multiplicative factor to apply to the box length
of a dimension is specified. For example, if the initial box length
is 10, and the factor is 1.1, then the final box length will be 11. A
factor less than 1.0 means compression.</p>
<p>The <em>volume</em> style changes the specified dimension in such a way that
the overall box volume remains constant with respect to the operation
performed by the preceding keyword. The <em>volume</em> style can only be
used following a keyword that changed the volume, which is any of the
<em>x</em>, <em>y</em>, <em>z</em> keywords. If the preceding keyword &#8220;key&#8221; had a <em>volume</em>
style, then both it and the current keyword apply to the keyword
preceding &#8220;key&#8221;. I.e. this sequence of keywords is allowed:</p>
<div class="highlight-python"><div class="highlight"><pre>change_box all x scale 1.1 y volume z volume
</pre></div>
</div>
<p>The <em>volume</em> style changes the associated dimension so that the
overall box volume is unchanged relative to its value before the
preceding keyword was invoked.</p>
<p>If the following command is used, then the z box length will shrink by
the same 1.1 factor the x box length was increased by:</p>
<div class="highlight-python"><div class="highlight"><pre>change_box all x scale 1.1 z volume
</pre></div>
</div>
<p>If the following command is used, then the y,z box lengths will each
shrink by sqrt(1.1) to keep the volume constant. In this case, the
y,z box lengths shrink so as to keep their relative aspect ratio
constant:</p>
<div class="highlight-python"><div class="highlight"><pre>change_box all&quot;x scale 1.1 y volume z volume
</pre></div>
</div>
<p>If the following command is used, then the final box will be a factor
of 10% larger in x and y, and a factor of 21% smaller in z, so as to
keep the volume constant:</p>
<div class="highlight-python"><div class="highlight"><pre>change_box all x scale 1.1 z volume y scale 1.1 z volume
</pre></div>
</div>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">For solids or liquids, when one dimension of the box
is expanded, it may be physically undesirable to hold the other 2 box
lengths constant since that implies a density change. For solids,
adjusting the other dimensions via the <em>volume</em> style may make
physical sense (just as for a liquid), but may not be correct for
materials and potentials whose Poisson ratio is not 0.5.</p>
</div>
<p>For the <em>scale</em> and <em>volume</em> styles, the box length is expanded or
compressed around its mid point.</p>
<hr class="docutils" />
<p>For the <em>xy</em>, <em>xz</em>, and <em>yz</em> parameters, this is the meaning of their
styles and values. Note that changing the tilt factors of a triclinic
box does not change its volume.</p>
<p>For style <em>final</em>, the final tilt factor is specified. The value
can be in lattice or box distance units. See the discussion of the
units keyword below.</p>
<p>For style <em>delta</em>, a plus or minus change in the tilt factor is
specified. The value can be in lattice or box distance units. See
the discussion of the units keyword below.</p>
<p>All of these styles change the xy, xz, yz tilt factors. In LAMMPS,
tilt factors (xy,xz,yz) for triclinic boxes are required to be no more
than half the distance of the parallel box length. For example, if
xlo = 2 and xhi = 12, then the x box length is 10 and the xy tilt
factor must be between -5 and 5. Similarly, both xz and yz must be
between -(xhi-xlo)/2 and +(yhi-ylo)/2. Note that this is not a
limitation, since if the maximum tilt factor is 5 (as in this
example), then configurations with tilt = ..., -15, -5, 5, 15, 25,
... are all equivalent. Any tilt factor specified by this command
must be within these limits.</p>
<hr class="docutils" />
<p>The <em>boundary</em> keyword takes arguments that have exactly the same
meaning as they do for the <a class="reference internal" href="boundary.html"><em>boundary</em></a> command. In each
dimension, a single letter assigns the same style to both the lower
and upper face of the box. Two letters assigns the first style to the
lower face and the second style to the upper face.</p>
<p>The style <em>p</em> means the box is periodic; the other styles mean
non-periodic. For style <em>f</em>, the position of the face is fixed. For
style <em>s</em>, the position of the face is set so as to encompass the
atoms in that dimension (shrink-wrapping), no matter how far they
move. For style <em>m</em>, shrink-wrapping occurs, but is bounded by the
current box edge in that dimension, so that the box will become no
smaller. See the <a class="reference internal" href="boundary.html"><em>boundary</em></a> command for more
explanation of these style options.</p>
<p>Note that the &#8220;boundary&#8221; command itself can only be used before the
simulation box is defined via a <a class="reference internal" href="read_data.html"><em>read_data</em></a> or
<a class="reference internal" href="create_box.html"><em>create_box</em></a> or <a class="reference internal" href="read_restart.html"><em>read_restart</em></a>
command. This command allows the boundary conditions to be changed
later in your input script. Also note that the
<a class="reference internal" href="read_restart.html"><em>read_restart</em></a> will change boundary conditions to
match what is stored in the restart file. So if you wish to change
them, you should use the change_box command after the read_restart
command.</p>
<hr class="docutils" />
<p>The <em>ortho</em> and <em>triclinic</em> keywords convert the simulation box to be
orthogonal or triclinic (non-orthongonal). See <a class="reference internal" href="Section_howto.html#howto-13"><span>this section</span></a> for a discussion of how non-orthongal
boxes are represented in LAMMPS.</p>
<p>The simulation box is defined as either orthogonal or triclinic when
it is created via the <a class="reference internal" href="create_box.html"><em>create_box</em></a>,
<a class="reference internal" href="read_data.html"><em>read_data</em></a>, or <a class="reference internal" href="read_restart.html"><em>read_restart</em></a>
commands.</p>
<p>These keywords allow you to toggle the existing simulation box from
orthogonal to triclinic and vice versa. For example, an initial
equilibration simulation can be run in an orthogonal box, the box can
be toggled to triclinic, and then a <a class="reference internal" href="Section_howto.html#howto-13"><span>non-equilibrium MD (NEMD) simulation</span></a> can be run with deformation
via the <a class="reference internal" href="fix_deform.html"><em>fix deform</em></a> command.</p>
<p>If the simulation box is currently triclinic and has non-zero tilt in
xy, yz, or xz, then it cannot be converted to an orthogonal box.</p>
<hr class="docutils" />
<p>The <em>set</em> keyword saves the current box size/shape. This can be
useful if you wish to use the <em>remap</em> keyword more than once or if you
wish it to be applied to an intermediate box size/shape in a sequence
of keyword operations. Note that the box size/shape is saved before
any of the keywords are processed, i.e. the box size/shape at the time
the create_box command is encountered in the input script.</p>
<p>The <em>remap</em> keyword remaps atom coordinates from the last saved box
size/shape to the current box state. For example, if you stretch the
box in the x dimension or tilt it in the xy plane via the <em>x</em> and <em>xy</em>
keywords, then the <em>remap</em> commmand will dilate or tilt the atoms to
conform to the new box size/shape, as if the atoms moved with the box
as it deformed.</p>
<p>Note that this operation is performed without regard to periodic
boundaries. Also, any shrink-wrapping of non-periodic boundaries (see
the <a class="reference internal" href="boundary.html"><em>boundary</em></a> command) occurs after all keywords,
including this one, have been processed.</p>
<p>Only atoms in the specified group are remapped.</p>
<hr class="docutils" />
<p>The <em>units</em> keyword determines the meaning of the distance units used
to define various arguments. A <em>box</em> value selects standard distance
units as defined by the <a class="reference internal" href="units.html"><em>units</em></a> command, e.g. Angstroms for
units = real or metal. A <em>lattice</em> value means the distance units are
in lattice spacings. The <a class="reference internal" href="lattice.html"><em>lattice</em></a> command must have
been previously used to define the lattice spacing.</p>
</div>
<hr class="docutils" />
<div class="section" id="restrictions">
<h2>Restrictions<a class="headerlink" href="#restrictions" title="Permalink to this headline">¶</a></h2>
<p>If you use the <em>ortho</em> or <em>triclinic</em> keywords, then at the point in
the input script when this command is issued, no <a class="reference internal" href="dump.html"><em>dumps</em></a> can
be active, nor can a <a class="reference internal" href="fix_ave_spatial.html"><em>fix ave/spatial</em></a> or <a class="reference internal" href="fix_deform.html"><em>fix deform</em></a> be active. This is because these commands
test whether the simulation box is orthogonal when they are first
issued. Note that these commands can be used in your script before a
change_box command is issued, so long as an <a class="reference internal" href="undump.html"><em>undump</em></a> or
<a class="reference internal" href="unfix.html"><em>unfix</em></a> command is also used to turn them off.</p>
</div>
<div class="section" id="related-commands">
<h2>Related commands<a class="headerlink" href="#related-commands" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="fix_deform.html"><em>fix deform</em></a>, <a class="reference internal" href="boundary.html"><em>boundary</em></a></p>
</div>
<div class="section" id="default">
<h2>Default<a class="headerlink" href="#default" title="Permalink to this headline">¶</a></h2>
<p>The option default is units = lattice.</p>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright .
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'15 May 2015 version',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2/js/lightbox.min.js"></script>
<script type="text/javascript" src="_static/sphinxcontrib-images/LightBox2/lightbox2-customize/jquery-noconflict.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>

Event Timeline