<p>Perform an energy minimization of the system, by iteratively adjusting
atom coordinates. Iterations are terminated when one of the stopping
criteria is satisfied. At that point the configuration will hopefully
be in local potential energy minimum. More precisely, the
configuration should approximate a critical point for the objective
function (see below), which may or may not be a local minimum.</p>
<p>The minimization algorithm used is set by the
<a class="reference internal" href="min_style.html"><span class="doc">min_style</span></a> command. Other options are set by the
<a class="reference internal" href="min_modify.html"><span class="doc">min_modify</span></a> command. Minimize commands can be
interspersed with <a class="reference internal" href="run.html"><span class="doc">run</span></a> commands to alternate between
relaxation and dynamics. The minimizers bound the distance atoms move
in one iteration, so that you can relax systems with highly overlapped
atoms (large energies and forces) by pushing the atoms off of each
other.</p>
<p>Alternate means of relaxing a system are to run dynamics with a small
or <a class="reference internal" href="fix_nve_limit.html"><span class="doc">limited timestep</span></a>. Or dynamics can be run
using <a class="reference internal" href="fix_viscous.html"><span class="doc">fix viscous</span></a> to impose a damping force that
slowly drains all kinetic energy from the system. The <a class="reference internal" href="pair_soft.html"><span class="doc">pair_style soft</span></a> potential can be used to un-overlap atoms while
running dynamics.</p>
<p>Note that you can minimize some atoms in the system while holding the
coordiates of other atoms fixed by applying <a class="reference internal" href="fix_setforce.html"><span class="doc">fix setforce</span></a> to the other atoms. See a fuller
discussion of using fixes while minimizing below.</p>
<p>where the first term is the sum of all non-bonded <a class="reference internal" href="pair_style.html"><span class="doc">pairwise interactions</span></a> including <a class="reference internal" href="kspace_style.html"><span class="doc">long-range Coulombic interactions</span></a>, the 2nd thru 5th terms are
<p>The 3 energy values are for before and after the minimization and on
the next-to-last iteration. This is what the <em>etol</em> parameter checks.</p>
<p>The two-norm force values are the length of the global force vector
before and after minimization. This is what the <em>ftol</em> parameter
checks.</p>
<p>The max-component force values are the absolute value of the largest
component (x,y,z) in the global force vector, i.e. the infinity-norm
of the force vector.</p>
<p>The alpha parameter for the line-search, when multiplied by the max
force component (on the last iteration), gives the max distance any
atom moved during the last iteration. Alpha will be 0.0 if the line
search could not reduce the energy. Even if alpha is non-zero, if the
“max atom move” distance is tiny compared to typical atom coordinates,
then it is possible the last iteration effectively caused no atom
movement and thus the evaluated energy did not change and the
minimizer terminated. Said another way, even with non-zero forces,
it’s possible the effect of those forces is to move atoms a distance
less than machine precision, so that the energy cannot be further
reduced.</p>
<p>The iterations and force evaluation values are what is checked by the
<em>maxiter</em> and <em>maxeval</em> parameters.</p>
<hr class="docutils" />
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">There are several force fields in LAMMPS which have
discontinuities or other approximations which may prevent you from
performing an energy minimization to high tolerances. For example,
you should use a <a class="reference internal" href="pair_style.html"><span class="doc">pair style</span></a> that goes to 0.0 at the
cutoff distance when performing minimization (even if you later change
it when running dynamics). If you do not do this, the total energy of
the system will have discontinuities when the relative distance
between any pair of atoms changes from cutoff+epsilon to
cutoff-epsilon and the minimizer may behave poorly. Some of the
manybody potentials use splines and other internal cutoffs that
inherently have this problem. The <a class="reference internal" href="kspace_style.html"><span class="doc">long-range Coulombic styles</span></a> (PPPM, Ewald) are approximate to within the
user-specified tolerance, which means their energy and forces may not
agree to a higher precision than the Kspace-specified tolerance. In
all these cases, the minimizer may give up and stop before finding a
minimum to the specified energy or force tolerance.</p>
</div>
<p>Note that a cutoff Lennard-Jones potential (and others) can be shifted
so that its energy is 0.0 at the cutoff via the
<a class="reference internal" href="pair_modify.html"><span class="doc">pair_modify</span></a> command. See the doc pages for
inidividual <a class="reference internal" href="pair_style.html"><span class="doc">pair styles</span></a> for details. Note that
Coulombic potentials always have a cutoff, unless versions with a
long-range component are used (e.g. <a class="reference internal" href="pair_lj.html"><span class="doc">pair_style lj/cut/coul/long</span></a>). The CHARMM potentials go to 0.0 at
the cutoff (e.g. <a class="reference internal" href="pair_charmm.html"><span class="doc">pair_style lj/charmm/coul/charmm</span></a>),
as do the GROMACS potentials (e.g. <a class="reference internal" href="pair_gromacs.html"><span class="doc">pair_style lj/gromacs</span></a>).</p>
<p>If a soft potential (<a class="reference internal" href="pair_soft.html"><span class="doc">pair_style soft</span></a>) is used the
Astop value is used for the prefactor (no time dependence).</p>
<p>The <a class="reference internal" href="fix_box_relax.html"><span class="doc">fix box/relax</span></a> command can be used to apply an
external pressure to the simulation box and allow it to shrink/expand
during the minimization.</p>
<p>Only a few other fixes (typically those that apply force constraints)
are invoked during minimization. See the doc pages for individual
<a class="reference internal" href="fix.html"><span class="doc">fix</span></a> commands to see which ones are relevant. Current
<p class="last">Some fixes which are invoked during minimization have an
associated potential energy. For that energy to be included in the
total potential energy of the system (the quantity being minimized),
you MUST enable the <a class="reference internal" href="fix_modify.html"><span class="doc">fix_modify</span></a> <em>energy</em> option for
that fix. The doc pages for individual <a class="reference internal" href="fix.html"><span class="doc">fix</span></a> commands
specify if this should be done.</p>
</div>
</div>
<hr class="docutils" />
<div class="section" id="restrictions">
<h2>Restrictions</h2>
<p>Features that are not yet implemented are listed here, in case someone
knows how they could be coded:</p>
<p>It is an error to use <a class="reference internal" href="fix_shake.html"><span class="doc">fix shake</span></a> with minimization
because it turns off bonds that should be included in the potential
energy of the system. The effect of a fix shake can be approximated
during a minimization by using stiff spring constants for the bonds
and/or angles that would normally be constrained by the SHAKE
algorithm.</p>
<p><a class="reference internal" href="fix_rigid.html"><span class="doc">Fix rigid</span></a> is also not supported by minimization. It
is not an error to have it defined, but the energy minimization will
not keep the defined body(s) rigid during the minimization. Note that
if bonds, angles, etc internal to a rigid body have been turned off
(e.g. via <a class="reference internal" href="neigh_modify.html"><span class="doc">neigh_modify exclude</span></a>), they will not
contribute to the potential energy which is probably not what is
desired.</p>
<p>Pair potentials that produce torque on a particle (e.g. <a class="reference internal" href="pair_gran.html"><span class="doc">granular potentials</span></a> or the <a class="reference internal" href="pair_gayberne.html"><span class="doc">GayBerne potential</span></a> for ellipsoidal particles) are not
relaxed by a minimization. More specifically, radial relaxations are
induced, but no rotations are induced by a minimization, so such a
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>.