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.
Note that commands and :doc:`variables <variable>` 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.
----------
In LAMMPS, the values generated by a compute can be used in several
ways:
* 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.
* Global values can be output via the :doc:`thermo_style custom <thermo_style>` or :doc:`fix ave/time <fix_ave_time>` command.
Or the values can be referenced in a :doc:`variable equal <variable>` or
:doc:`variable atom <variable>` command.
* Per-atom values can be output via the :doc:`dump custom <dump>` command
or the :doc:`fix ave/spatial <fix_ave_spatial>` command. Or they can be
time-averaged via the :doc:`fix ave/atom <fix_ave_atom>` command or
reduced by the :doc:`compute reduce <compute_reduce>` command. Or the
per-atom values can be referenced in an :doc:`atom-style variable <variable>`.
* Local values can be reduced by the :doc:`compute reduce <compute_reduce>` command, or histogrammed by the :doc:`fix ave/histo <fix_ave_histo>` command, or output by the :doc:`dump local <dump>` command.
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.
:doc:`Thermodynamic output <thermo_style>` 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
:doc:`variable <variable>`, you may want to know whether it is an
intensive or extensive value. See the doc page for individual
computes for further info.
----------
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:
.. parsed-literal::
compute thermo_temp all temp
compute thermo_press all pressure thermo_temp
compute thermo_pe all pe
Additional computes for other quantities are created if the thermo
style requires it. See the documentation for the
:doc:`thermo_style <thermo_style>` command.
Fixes that calculate temperature or pressure, i.e. for thermostatting
or barostatting, may also create computes. These are discussed in the
documentation for specific :doc:`fix <fix>` commands.
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 :doc:`thermo_modify <thermo_modify>` and :doc:`fix modify <fix_modify>` commands.
Properties of either a default or user-defined compute can be modified
via the :doc:`compute_modify <compute_modify>` command.
Computes can be deleted with the :doc:`uncompute <uncompute>` command.
Code for new computes can be added to LAMMPS (see :doc:`this section <Section_modify>` of the manual) and the results of their
calculations accessed in the various ways described above.
----------
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 :ref:`this page <cmd_5>`.
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 :ref:`this page <cmd_5>`.
* :doc:`angle/local <compute_bond_local>` - theta and energy of each angle
* :doc:`angmom/chunk <compute_angmom_chunk>` - angular momentum for each chunk
* :doc:`body/local <compute_body_local>` - attributes of body sub-particles