<span id="index-0"></span><h1>fix tune/kspace command<a class="headerlink" href="#fix-tune-kspace-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>fix ID group-ID tune/kspace N
</pre></div>
</div>
<ul class="simple">
<li>ID, group-ID are documented in <a class="reference internal" href="fix.html"><em>fix</em></a> command</li>
<li>tune/kspace = style name of this fix command</li>
<li>N = invoke this fix every N steps</li>
</ul>
</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>fix 2 all tune/kspace 100
</pre></div>
</div>
</div>
<div class="section" id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>This fix tests each kspace style (Ewald, PPPM, and MSM), and
automatically selects the fastest style to use for the remainder
of the run. If the fastest style is Ewald or PPPM, the fix also
adjusts the coulomb cutoff towards optimal speed. Future versions
of this fix will automatically select other kspace parameters
to use for maximum simulation speed. The kspace parameters may
include the style, cutoff, grid points in each direction, order,
Ewald parameter, MSM parallelization cut-point, MPI tasks to use, etc.</p>
<p>The rationale for this fix is to provide the user with
as-fast-as-possible simulations that include long-range electrostatics
(kspace) while meeting the user-prescribed accuracy requirement. A
simple heuristic could never capture the optimal combination of
parameters for every possible run-time scenario. But by performing
short tests of various kspace parameter sets, this fix allows
parameters to be tailored specifically to the user’s machine, MPI
ranks, use of threading or accelerators, the simulated system, and the
simulation details. In addition, it is possible that parameters could
be evolved with the simulation on-the-fly, which is useful for systems
that are dynamically evolving (e.g. changes in box size/shape or
number of particles).</p>
<p>When this fix is invoked, LAMMPS will perform short timed tests of
various parameter sets to determine the optimal parameters. Tests are
performed on-the-fly, with a new test initialized every N steps. N should
be chosen large enough so that adequate CPU time lapses between tests,
thereby providing statistically significant timings. But N should not be
chosen to be so large that an unfortunate parameter set test takes an
inordinate amount of wall time to complete. An N of 100 for most problems
seems reasonable. Once an optimal parameter set is found, that set is
used for the remainder of the run.</p>
<p>This fix uses heristics to guide it’s selection of parameter sets to test,
but the actual timed results will be used to decide which set to use in the
simulation.</p>
<p>It is not necessary to discard trajectories produced using sub-optimal
parameter sets, or a mix of various parameter sets, since the user-prescribed
accuracy will have been maintained throughout. However, some users may prefer
to use this fix only to discover the optimal parameter set for a given setup
that can then be used on subsequent production runs.</p>
<p>This fix starts with kspace parameters that are set by the user with the
<a class="reference internal" href="kspace_style.html"><em>kspace_style</em></a> and <a class="reference internal" href="kspace_modify.html"><em>kspace_modify</em></a>
commands. The prescribed accuracy will be maintained by this fix throughout
the simulation.</p>
<p>None of the <a class="reference internal" href="fix_modify.html"><em>fix_modify</em></a> options are relevant to this
fix.</p>
<p>No parameter of this fix can be used with the <em>start/stop</em> keywords of
the <a class="reference internal" href="run.html"><em>run</em></a> command. This fix is not invoked during <a class="reference internal" href="minimize.html"><em>energy minimization</em></a>.</p>
</div>
<div class="section" id="restrictions">
<h2>Restrictions<a class="headerlink" href="#restrictions" title="Permalink to this headline">¶</a></h2>
<p>This fix is part of the KSPACE package. It is only enabled if LAMMPS was
built with that package. See the <a class="reference internal" href="Section_start.html#start-3"><span>Making LAMMPS</span></a> section for more info.</p>
<p>Do not set “neigh_modify once yes” or else this fix will never be
called. Reneighboring is required.</p>
</div>
<div class="section" id="related-commands">
<h2>Related commands<a class="headerlink" href="#related-commands" title="Permalink to this headline">¶</a></h2>
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>.