<p>Define a computation that will be performed on a group of atoms.
Quantities calculated by a compute are instantaneous values, meaning
they are calculated from information about atoms on the current
timestep or iteration, though a compute may internally store some
information about a previous state of the system. Defining a compute
does not perform a computation. Instead computes are invoked by other
LAMMPS commands as needed, e.g. to calculate a temperature needed for
a thermostat fix or to generate thermodynamic or dump file output.
See this <aclass="reference internal"href="Section_howto.html#howto-15"><spanclass="std std-ref">howto section</span></a> for a summary of
various LAMMPS output options, many of which involve computes.</p>
<p>The ID of a compute can only contain alphanumeric characters and
underscores.</p>
<hrclass="docutils"/>
<p>Computes calculate one of three styles of quantities: global,
per-atom, or local. A global quantity is one or more system-wide
values, e.g. the temperature of the system. A per-atom quantity is
one or more values per atom, e.g. the kinetic energy of each atom.
Per-atom values are set to 0.0 for atoms not in the specified compute
group. Local quantities are calculated by each processor based on the
atoms it owns, but there may be zero or more per atom, e.g. a list of
bond distances. Computes that produce per-atom quantities have the
word “atom” in their style, e.g. <em>ke/atom</em>. Computes that produce
local quantities have the word “local” in their style,
e.g. <em>bond/local</em>. Styles with neither “atom” or “local” in their
style produce global quantities.</p>
<p>Note that a single compute produces either global or per-atom or local
quantities, but never more than one of these (with only a few
exceptions, as documented by individual compute commands).</p>
<p>Global, per-atom, and local quantities each come in three kinds: a
single scalar value, a vector of values, or a 2d array of values. The
doc page for each compute describes the style and kind of values it
produces, e.g. a per-atom vector. Some computes produce more than one
kind of a single style, e.g. a global scalar and a global vector.</p>
<p>When a compute quantity is accessed, as in many of the output commands
discussed below, it can be referenced via the following bracket
notation, where ID is the ID of the compute:</p>
<tableborder="1"class="docutils">
<colgroup>
<colwidth="23%"/>
<colwidth="77%"/>
</colgroup>
<tbodyvalign="top">
<trclass="row-odd"><td>c_ID</td>
<td>entire scalar, vector, or array</td>
</tr>
<trclass="row-even"><td>c_ID[I]</td>
<td>one element of vector, one column of array</td>
</tr>
<trclass="row-odd"><td>c_ID[I][J]</td>
<td>one element of array</td>
</tr>
</tbody>
</table>
<p>In other words, using one bracket reduces the dimension of the
quantity once (vector -> scalar, array -> vector). Using two brackets
reduces the dimension twice (array -> scalar). Thus a command that
uses scalar compute values as input can also process elements of a
vector or array.</p>
<p>Note that commands and <aclass="reference internal"href="variable.html"><spanclass="doc">variables</span></a> which use compute
quantities typically do not allow for all kinds, e.g. a command may
require a vector of values, not a scalar. This means there is no
ambiguity about referring to a compute quantity as c_ID even if it
produces, for example, both a scalar and vector. The doc pages for
various commands explain the details.</p>
<hrclass="docutils"/>
<p>In LAMMPS, the values generated by a compute can be used in several
ways:</p>
<ulclass="simple">
<li>The results of computes that calculate a global temperature or
pressure can be used by fixes that do thermostatting or barostatting
or when atom velocities are created.</li>
<li>Global values can be output via the <aclass="reference internal"href="thermo_style.html"><spanclass="doc">thermo_style custom</span></a> or <aclass="reference internal"href="fix_ave_time.html"><spanclass="doc">fix ave/time</span></a> command.
Or the values can be referenced in a <aclass="reference internal"href="variable.html"><spanclass="doc">variable equal</span></a> or
<li>Per-atom values can be output via the <aclass="reference internal"href="dump.html"><spanclass="doc">dump custom</span></a> command.
Or they can be time-averaged via the <aclass="reference internal"href="fix_ave_atom.html"><spanclass="doc">fix ave/atom</span></a>
command or reduced by the <aclass="reference internal"href="compute_reduce.html"><spanclass="doc">compute reduce</span></a>
command. Or the per-atom values can be referenced in an <aclass="reference internal"href="variable.html"><spanclass="doc">atom-style variable</span></a>.</li>
<li>Local values can be reduced by the <aclass="reference internal"href="compute_reduce.html"><spanclass="doc">compute reduce</span></a> command, or histogrammed by the <aclass="reference internal"href="fix_ave_histo.html"><spanclass="doc">fix ave/histo</span></a> command, or output by the <aclass="reference internal"href="dump.html"><spanclass="doc">dump local</span></a> command.</li>
</ul>
<p>The results of computes that calculate global quantities can be either
“intensive” or “extensive” values. Intensive means the value is
independent of the number of atoms in the simulation,
e.g. temperature. Extensive means the value scales with the number of
atoms in the simulation, e.g. total rotational kinetic energy.
<aclass="reference internal"href="thermo_style.html"><spanclass="doc">Thermodynamic output</span></a> will normalize extensive
values by the number of atoms in the system, depending on the
“thermo_modify norm” setting. It will not normalize intensive values.
If a compute value is accessed in another way, e.g. by a
<aclass="reference internal"href="variable.html"><spanclass="doc">variable</span></a>, you may want to know whether it is an
intensive or extensive value. See the doc page for individual
computes for further info.</p>
<hrclass="docutils"/>
<p>LAMMPS creates its own computes internally for thermodynamic output.
Three computes are always created, named “thermo_temp”,
“thermo_press”, and “thermo_pe”, as if these commands had been invoked
in the input script:</p>
<preclass="literal-block">
compute thermo_temp all temp
compute thermo_press all pressure thermo_temp
compute thermo_pe all pe
</pre>
<p>Additional computes for other quantities are created if the thermo
<p>Fixes that calculate temperature or pressure, i.e. for thermostatting
or barostatting, may also create computes. These are discussed in the
documentation for specific <aclass="reference internal"href="fix.html"><spanclass="doc">fix</span></a> commands.</p>
<p>In all these cases, the default computes LAMMPS creates can be
replaced by computes defined by the user in the input script, as
described by the <aclass="reference internal"href="thermo_modify.html"><spanclass="doc">thermo_modify</span></a> and <aclass="reference internal"href="fix_modify.html"><spanclass="doc">fix modify</span></a> commands.</p>
<p>Properties of either a default or user-defined compute can be modified
via the <aclass="reference internal"href="compute_modify.html"><spanclass="doc">compute_modify</span></a> command.</p>
<p>Computes can be deleted with the <aclass="reference internal"href="uncompute.html"><spanclass="doc">uncompute</span></a> command.</p>
<p>Code for new computes can be added to LAMMPS (see <aclass="reference internal"href="Section_modify.html"><spanclass="doc">this section</span></a> of the manual) and the results of their
calculations accessed in the various ways described above.</p>
<hrclass="docutils"/>
<p>Each compute style has its own doc page which describes its arguments
and what it does. Here is an alphabetic list of compute styles
available in LAMMPS. They are also given in more compact form in the
Compute section of <aclass="reference internal"href="Section_commands.html#cmd-5"><spanclass="std std-ref">this page</span></a>.</p>
<p>There are also additional compute styles (not listed here) submitted
by users which are included in the LAMMPS distribution. The list of
these with links to the individual styles are given in the compute
section of <aclass="reference internal"href="Section_commands.html#cmd-5"><spanclass="std std-ref">this page</span></a>.</p>
<ulclass="simple">
<li><aclass="reference internal"href="compute_bond_local.html"><spanclass="doc">angle/local</span></a> - theta and energy of each angle</li>
<li><aclass="reference internal"href="compute_angmom_chunk.html"><spanclass="doc">angmom/chunk</span></a> - angular momentum for each chunk</li>
<li><aclass="reference internal"href="compute_body_local.html"><spanclass="doc">body/local</span></a> - attributes of body sub-particles</li>
<li><aclass="reference internal"href="compute_bond.html"><spanclass="doc">bond</span></a> - values computed by a bond style</li>
<li><aclass="reference internal"href="compute_bond_local.html"><spanclass="doc">bond/local</span></a> - distance and energy of each bond</li>
<li><aclass="reference internal"href="compute_centro_atom.html"><spanclass="doc">centro/atom</span></a> - centro-symmetry parameter for each atom</li>
<li><aclass="reference internal"href="compute_chunk_atom.html"><spanclass="doc">chunk/atom</span></a> - assign chunk IDs to each atom</li>
<li><aclass="reference internal"href="compute_cluster_atom.html"><spanclass="doc">cluster/atom</span></a> - cluster ID for each atom</li>
<li><aclass="reference internal"href="compute_cna_atom.html"><spanclass="doc">cna/atom</span></a> - common neighbor analysis (CNA) for each atom</li>
<li><aclass="reference internal"href="compute_com.html"><spanclass="doc">com</span></a> - center-of-mass of group of atoms</li>
<li><aclass="reference internal"href="compute_com_chunk.html"><spanclass="doc">com/chunk</span></a> - center-of-mass for each chunk</li>
<li><aclass="reference internal"href="compute_contact_atom.html"><spanclass="doc">contact/atom</span></a> - contact count for each spherical particle</li>
<li><aclass="reference internal"href="compute_coord_atom.html"><spanclass="doc">coord/atom</span></a> - coordination number for each atom</li>
<li><aclass="reference internal"href="compute_damage_atom.html"><spanclass="doc">damage/atom</span></a> - Peridynamic damage for each atom</li>
<li><aclass="reference internal"href="compute_dihedral_local.html"><spanclass="doc">dihedral/local</span></a> - angle of each dihedral</li>
<li><aclass="reference internal"href="compute_dilatation_atom.html"><spanclass="doc">dilatation/atom</span></a> - Peridynamic dilatation for each atom</li>
<li><aclass="reference internal"href="compute_displace_atom.html"><spanclass="doc">displace/atom</span></a> - displacement of each atom</li>
<li><aclass="reference internal"href="compute_erotate_asphere.html"><spanclass="doc">erotate/asphere</span></a> - rotational energy of aspherical particles</li>
<li><aclass="reference internal"href="compute_erotate_rigid.html"><spanclass="doc">erotate/rigid</span></a> - rotational energy of rigid bodies</li>
<li><aclass="reference internal"href="compute_erotate_sphere.html"><spanclass="doc">erotate/sphere</span></a> - rotational energy of spherical particles</li>
<li><aclass="reference internal"href="compute_erotate_sphere.html"><spanclass="doc">erotate/sphere/atom</span></a> - rotational energy for each spherical particle</li>
<li><aclass="reference internal"href="compute_event_displace.html"><spanclass="doc">event/displace</span></a> - detect event on atom displacement</li>
<li><aclass="reference internal"href="compute_group_group.html"><spanclass="doc">group/group</span></a> - energy/force between two groups of atoms</li>
<li><aclass="reference internal"href="compute_gyration.html"><spanclass="doc">gyration</span></a> - radius of gyration of group of atoms</li>
<li><aclass="reference internal"href="compute_gyration_chunk.html"><spanclass="doc">gyration/chunk</span></a> - radius of gyration for each chunk</li>
<li><aclass="reference internal"href="compute_heat_flux.html"><spanclass="doc">heat/flux</span></a> - heat flux through a group of atoms</li>
<li><aclass="reference internal"href="compute_hexorder_atom.html"><spanclass="doc">hexorder/atom</span></a> - bond orientational order parameter q6</li>
<li><aclass="reference internal"href="compute_improper_local.html"><spanclass="doc">improper/local</span></a> - angle of each improper</li>
<li><aclass="reference internal"href="compute_inertia_chunk.html"><spanclass="doc">inertia/chunk</span></a> - inertia tensor for each chunk</li>
<li><aclass="reference internal"href="compute_ke_atom.html"><spanclass="doc">ke/atom</span></a> - kinetic energy for each atom</li>
<li><aclass="reference internal"href="compute_ke_rigid.html"><spanclass="doc">ke/rigid</span></a> - translational kinetic energy of rigid bodies</li>
<li><aclass="reference internal"href="compute_msd.html"><spanclass="doc">msd</span></a> - mean-squared displacement of group of atoms</li>
<li><aclass="reference internal"href="compute_msd_chunk.html"><spanclass="doc">msd/chunk</span></a> - mean-squared displacement for each chunk</li>
<li><aclass="reference internal"href="compute_msd_nongauss.html"><spanclass="doc">msd/nongauss</span></a> - MSD and non-Gaussian parameter of group of atoms</li>
<li><aclass="reference internal"href="compute_omega_chunk.html"><spanclass="doc">omega/chunk</span></a> - angular velocity for each chunk</li>
<li><aclass="reference internal"href="compute_orientorder_atom.html"><spanclass="doc">orientorder/atom</span></a> - Steinhardt bond orientational order parameters Ql</li>
<li><aclass="reference internal"href="compute_pair.html"><spanclass="doc">pair</span></a> - values computed by a pair style</li>
<li><aclass="reference internal"href="compute_pair_local.html"><spanclass="doc">pair/local</span></a> - distance/energy/force of each pairwise interaction</li>
<li><aclass="reference internal"href="compute_pe_atom.html"><spanclass="doc">pe/atom</span></a> - potential energy for each atom</li>
<li><aclass="reference internal"href="compute_plasticity_atom.html"><spanclass="doc">plasticity/atom</span></a> - Peridynamic plasticity for each atom</li>
<li><aclass="reference internal"href="compute_pressure.html"><spanclass="doc">pressure</span></a> - total pressure and pressure tensor</li>
<li><aclass="reference internal"href="compute_property_atom.html"><spanclass="doc">property/atom</span></a> - convert atom attributes to per-atom vectors/arrays</li>
<li><aclass="reference internal"href="compute_property_local.html"><spanclass="doc">property/local</span></a> - convert local attributes to localvectors/arrays</li>
<li><aclass="reference internal"href="compute_property_chunk.html"><spanclass="doc">property/chunk</span></a> - extract various per-chunk attributes</li>
<li><aclass="reference internal"href="compute_rdf.html"><spanclass="doc">rdf</span></a> - radial distribution function g(r) histogram of group of atoms</li>
<li><aclass="reference internal"href="compute_reduce.html"><spanclass="doc">reduce</span></a> - combine per-atom quantities into a single global value</li>
<li><aclass="reference internal"href="compute_reduce.html"><spanclass="doc">reduce/region</span></a> - same as compute reduce, within a region</li>
<li><aclass="reference internal"href="compute_rigid_local.html"><spanclass="doc">rigid/local</span></a> - extract rigid body attributes</li>
<li><aclass="reference internal"href="compute_slice.html"><spanclass="doc">slice</span></a> - extract values from global vector or array</li>
<li><aclass="reference internal"href="compute_sna_atom.html"><spanclass="doc">sna/atom</span></a> - calculate bispectrum coefficients for each atom</li>
<li><aclass="reference internal"href="compute_sna_atom.html"><spanclass="doc">snad/atom</span></a> - derivative of bispectrum coefficients for each atom</li>
<li><aclass="reference internal"href="compute_sna_atom.html"><spanclass="doc">snav/atom</span></a> - virial contribution from bispectrum coefficients for each atom</li>
<li><aclass="reference internal"href="compute_stress_atom.html"><spanclass="doc">stress/atom</span></a> - stress tensor for each atom</li>
<li><aclass="reference internal"href="compute_temp.html"><spanclass="doc">temp</span></a> - temperature of group of atoms</li>
<li><aclass="reference internal"href="compute_temp_asphere.html"><spanclass="doc">temp/asphere</span></a> - temperature of aspherical particles</li>
<li><aclass="reference internal"href="compute_temp_body.html"><spanclass="doc">temp/body</span></a> - temperature of body particles</li>
<li><aclass="reference internal"href="compute_temp_chunk.html"><spanclass="doc">temp/chunk</span></a> - temperature of each chunk</li>
<li><aclass="reference internal"href="compute_temp_com.html"><spanclass="doc">temp/com</span></a> - temperature after subtracting center-of-mass velocity</li>
<li><aclass="reference internal"href="compute_temp_deform.html"><spanclass="doc">temp/deform</span></a> - temperature excluding box deformation velocity</li>
<li><aclass="reference internal"href="compute_temp_partial.html"><spanclass="doc">temp/partial</span></a> - temperature excluding one or more dimensions of velocity</li>
<li><aclass="reference internal"href="compute_temp_profile.html"><spanclass="doc">temp/profile</span></a> - temperature excluding a binned velocity profile</li>
<li><aclass="reference internal"href="compute_temp_ramp.html"><spanclass="doc">temp/ramp</span></a> - temperature excluding ramped velocity component</li>
<li><aclass="reference internal"href="compute_temp_region.html"><spanclass="doc">temp/region</span></a> - temperature of a region of atoms</li>
<li><aclass="reference internal"href="compute_temp_sphere.html"><spanclass="doc">temp/sphere</span></a> - temperature of spherical particles</li>
<li><aclass="reference internal"href="compute_ti.html"><spanclass="doc">ti</span></a> - thermodyanmic integration free energy values</li>
<li><aclass="reference internal"href="compute_torque_chunk.html"><spanclass="doc">torque/chunk</span></a> - torque applied on each chunk</li>
<li><aclass="reference internal"href="compute_vacf.html"><spanclass="doc">vacf</span></a> - velocity-autocorrelation function of group of atoms</li>
<li><aclass="reference internal"href="compute_vcm_chunk.html"><spanclass="doc">vcm/chunk</span></a> - velocity of center-of-mass for each chunk</li>
<li><aclass="reference internal"href="compute_voronoi_atom.html"><spanclass="doc">voronoi/atom</span></a> - Voronoi volume and neighbors for each atom</li>
</ul>
<p>There are also additional compute styles submitted by users which are
included in the LAMMPS distribution. The list of these with links to
the individual styles are given in the compute section of <aclass="reference internal"href="Section_commands.html#cmd-5"><spanclass="std std-ref">this page</span></a>.</p>
<p>There are also additional accelerated compute styles included in the
LAMMPS distribution for faster performance on CPUs and GPUs. The list
of these with links to the individual styles are given in the pair
section of <aclass="reference internal"href="Section_commands.html#cmd-5"><spanclass="std std-ref">this page</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>.