<p>where <em>tau</em> = <em>Nevery</em> * <em>timestep</em> is the time interval between updates,
and the subscripted variables indicate the values of <em>c</em> and <em>e</em> at
successive updates.</p>
<p>From the first equation, it is clear that if the three gain values
<em>Kp</em>, <em>Ki</em>, <em>Kd</em> are dimensionless constants, then <em>alpha</em> must have
units of [unit <em>cvar</em>]/[unit <em>pvar</em>]/[unit time] e.g. [ eV/K/ps
]. The advantage of this unit scheme is that the value of the
constants should be invariant under a change of either the MD timestep
size or the value of <em>Nevery</em>. Similarly, if the LAMMPS <aclass="reference internal"href="units.html"><spanclass="doc">unit style</span></a> is changed, it should only be necessary to change
the value of <em>alpha</em> to reflect this, while leaving <em>Kp</em>, <em>Ki</em>, and
<em>Kd</em> unaltered.</p>
<p>When choosing the values of the four constants, it is best to first
pick a value and sign for <em>alpha</em> that is consistent with the
magnitudes and signs of <em>pvar</em> and <em>cvar</em>. The magnitude of <em>Kp</em>
should then be tested over a large positive range keeping <em>Ki</em>=<em>Kd</em>=0.
A good value for <em>Kp</em> will produce a fast reponse in <em>pvar</em>, without
overshooting the <em>setpoint</em>. For many applications, proportional
feedback is sufficient, and so <em>Ki</em>=<em>Kd</em>=0 can be used. In cases where
there is a substantial lag time in the response of <em>pvar</em> to a change
in <em>cvar</em>, this can be counteracted by increasing <em>Kd</em>. In situations
where <em>pvar</em> plateaus without reaching <em>setpoint</em>, this can be
counteracted by increasing <em>Ki</em>. In the language of Charles Dickens,
<em>Kp</em> represents the error of the present, <em>Ki</em> the error of the past,
and <em>Kd</em> the error yet to come.</p>
<p>Because this fix updates <em>cvar</em>, but does not initialize its value,
the initial value is that assigned by the user in the input script via
the <aclass="reference internal"href="variable.html"><spanclass="doc">internal-style variable</span></a> command. This value is
used (by the other LAMMPS command that used the variable) until this
fix performs its first update of <em>cvar</em> after <em>Nevery</em> timesteps. On
the first update, the value of the derivative term is set to zero,
because the value of <em>e_n-1</em> is not yet defined.</p>
<hrclass="docutils"/>
<p>The process variable <em>pvar</em> can be specified as the output of a
<aclass="reference internal"href="compute.html"><spanclass="doc">compute</span></a> or <aclass="reference internal"href="fix.html"><spanclass="doc">fix</span></a> or the evaluation of a
<aclass="reference internal"href="variable.html"><spanclass="doc">variable</span></a>. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity.</p>
<p>If <em>pvar</em> begins with “c_”, a compute ID must follow which has been
previously defined in the input script and which generates a global
scalar or vector. See the individual <aclass="reference internal"href="compute.html"><spanclass="doc">compute</span></a> doc page
for details. If no bracketed integer is appended, the scalar
calculated by the compute is used. If a bracketed integer is
appended, the Ith value of the vector calculated by the compute is
used. Users can also write code for their own compute styles and <aclass="reference internal"href="Section_modify.html"><spanclass="doc">add them to LAMMPS</span></a>.</p>
<p>If <em>pvar</em> begins with “f_”, a fix ID must follow which has been
previously defined in the input script and which generates a global
scalar or vector. See the individual <aclass="reference internal"href="fix.html"><spanclass="doc">fix</span></a> doc page for
details. Note that some fixes only produce their values on certain
timesteps, which must be compatible with when fix controller
references the values, or else an error results. If no bracketed integer
is appended, the scalar calculated by the fix is used. If a bracketed
integer is appended, the Ith value of the vector calculated by the fix
is used. Users can also write code for their own fix style and <aclass="reference internal"href="Section_modify.html"><spanclass="doc">add them to LAMMPS</span></a>.</p>
<p>If <em>pvar</em> begins with “v_”, a variable name must follow which has been
previously defined in the input script. Only equal-style variables
can be referenced. See the <aclass="reference internal"href="variable.html"><spanclass="doc">variable</span></a> command for
details. Note that variables of style <em>equal</em> define a formula which
can reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying the process
variable.</p>
<p>The target value <em>setpoint</em> for the process variable must be a numeric
value, in whatever units <em>pvar</em> is defined for.</p>
<p>The control variable <em>cvar</em> must be the name of an <aclass="reference internal"href="variable.html"><spanclass="doc">internal-style variable</span></a> previously defined in the input script. Note
that it is not specified with a “v_” prefix, just the name of the
variable. It must be an internal-style variable, because this fix
updates its value directly. Note that other commands can use an
equal-style versus internal-style variable interchangeably.</p>
<hrclass="docutils"/>
<p><strong>Restart, fix_modify, output, run start/stop, minimize info:</strong></p>
<p>Currenlty, no information about this fix is written to <aclass="reference internal"href="restart.html"><spanclass="doc">binary restart files</span></a>. None of the <aclass="reference internal"href="fix_modify.html"><spanclass="doc">fix_modify</span></a> options
are relevant to this fix.</p>
<p>This fix produces a global vector with 3 values which can be accessed
by various <aclass="reference internal"href="Section_howto.html#howto-15"><spanclass="std std-ref">output commands</span></a>. The values
can be accessed on any timestep, though they are only updated on
timesteps that are a multiple of <em>Nevery</em>.</p>
<p>The three values are the most recent updates made to the control
variable by each of the 3 terms in the PID equation above. The first
value is the proportional term, the second is the integral term, the
third is the derivative term.</p>
<p>The units of the vector values will be whatever units the control
variable is in. The vector values calculated by this fix are
“extensive”.</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"><spanclass="doc">run</span></a> command. This fix is not invoked during <aclass="reference internal"href="minimize.html"><spanclass="doc">energy minimization</span></a>.</p>
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>.