<p>Define a computation that calculates the velocity auto-correlation
function (VACF), averaged over a group of atoms. Each atom’s
contribution to the VACF is its current velocity vector dotted into
its initial velocity vector at the time the compute was specified.</p>
<p>A vector of four quantites is calculated by this compute. The first 3
elements of the vector are vx * vx0 (and similarly for the y and z
components), summed and averaged over atoms in the group. Vx is the
current x-component of velocity for the atom, vx0 is the initial
x-component of velocity for the atom. The 4th element of the vector
is the total VACF, i.e. (vx*vx0 + vy*vy0 + vz*vz0), summed and
averaged over atoms in the group.</p>
<p>The integral of the VACF versus time is proportional to the diffusion
coefficient of the diffusing atoms. This can be computed in the
following manner, using the <a class="reference internal" href="variable.html"><span class="doc">variable trap()</span></a> function:</p>
<pre class="literal-block">
compute 2 all vacf
fix 5 all vector 1 c_2[4]
variable diff equal dt*trap(f_5)
thermo_style custom step v_diff
</pre>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you want the quantities calculated by this compute to be
continuous when running from a <a class="reference internal" href="read_restart.html"><span class="doc">restart file</span></a>, then
you should use the same ID for this compute, as in the original run.
This is so that the fix this compute creates to store per-atom
quantities will also have the same ID, and thus be initialized
correctly with time=0 atom velocities from the restart file.</p>
</div>
<p><strong>Output info:</strong></p>
<p>This compute calculates a global vector of length 4, which can be
accessed by indices 1-4 by any command that uses global vector values
from a compute as input. See <a class="reference internal" href="Section_howto.html#howto-15"><span class="std std-ref">this section</span></a> for an overview of LAMMPS output
options.</p>
<p>The vector values are “intensive”. The vector values will be in
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>.