"LIGGGHTS(R)-PUBLIC WWW Site"_liws - "LIGGGHTS(R)-PUBLIC Documentation"_ld - "LIGGGHTS(R)-PUBLIC Commands"_lc :c

:link(liws,http://www.cfdem.com)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

compute command :h3

[Syntax:]

compute ID group-ID style general_keywords general_values args :pre

ID = user-assigned name for the computation :ulb,l
group-ID = ID of the group of atoms to perform the computation on :l
style = one of a list of possible style names (see below) :l
zero or more general_keywords/general_values pair may be appended :l
general_keywords = {update_on_run_end} :l
  {update_on_run_end} value = 'yes' or 'no'
    yes = compute is updated at the last step of each run command
    no = compute is not updated at the end of a run :pre
args = arguments used by a particular style :l

:ule

[Examples:]

compute 1 all temp
compute newtemp flow temp/partial 1 1 0
compute 3 all ke/atom update_on_run_end yes :pre

[Description:]

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
LIGGGHTS(R)-PUBLIC commands as needed, e.g. to calculate  dump file output.
See this "howto section"_Section_howto.html#howto_8 for a summary of
various LIGGGHTS(R)-PUBLIC output options, many of which involve computes.

The full list of fixes defined in LIGGGHTS(R)-PUBLIC is on "this
page"_Section_commands.html#cmd_5.

The ID of a compute can only contain alphanumeric characters and
underscores.

:line

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. {ke/atom}.  Computes that produce
local quantities have the word "local" in their style,
e.g. {bond/local}.  Styles with neither "atom" or "local" in their
style produce global quantities.

Note that a single compute produces either global or per-atom or local
quantities, but never more than one of these.

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.

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:

c_ID | entire scalar, vector, or array
c_ID\[I\] | one element of vector, one column of array
c_ID\[I\]\[J\] | one element of array :tb(s=|)

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 "variables"_variable.html 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.

:line

In LIGGGHTS(R)-PUBLIC, the values generated by a compute can be used in several
ways:


Global values can be output via the "thermo_style
custom"_thermo_style.html or "fix ave/time"_fix_ave_time.html command.
Or the values can be referenced in a "variable equal"_variable.html or
"variable atom"_variable.html command. :l

Per-atom values can be output via the "dump custom"_dump.html command
or the "fix ave/spatial"_fix_ave_spatial.html command.  Or they can be
time-averaged via the "fix ave/atom"_fix_ave_atom.html command or
reduced by the "compute reduce"_compute_reduce.html command.  Or the
per-atom values can be referenced in an "atom-style
variable"_variable.html. :l

Local values can be reduced by the "compute
reduce"_compute_reduce.html command, or histogrammed by the "fix
ave/histo"_fix_ave_histo.html command, or output by the "dump
local"_dump.html command. :l,ule

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.
"Thermodynamic output"_thermo_style.html 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
"variable"_variable.html, you may want to know whether it is an
intensive or extensive value.  See the doc page for individual
computes for further info.

:line

Compute values can also be used after a "run"_run.html command to perform
"if"_if.html conditionals or "print"_print.html statements. In order to use the
result of a compute outside of a run it needs to be updated at the end of each
run. As computes generally update only upon request (e.g. before a dump) this
needs to be specified explicitly using the {update_on_run_end} option which is
available for every compute. If the associated value is set to 'yes' the compute
will be updated at the end of each run command and will be available for use.

:line

Properties of either a default or user-defined compute can be modified
via the "compute_modify"_compute_modify.html command.

Computes can be deleted with the "uncompute"_uncompute.html command.

Code for new computes can be added to LIGGGHTS(R)-PUBLIC (see "this
section"_Section_modify.html of the manual) and the results of their
calculations accessed in the various ways described above.

:line

Each compute style has its own doc page which describes its arguments
and what it does. The full list of computes defined in LIGGGHTS(R)-PUBLIC is on
"this page"_Section_commands.html#cmd_5.

[Restrictions:] none

[Related commands:]

"uncompute"_uncompute.html, "compute_modify"_compute_modify.html, "fix
ave/atom"_fix_ave_atom.html, "fix ave/spatial"_fix_ave_spatial.html,
"fix ave/time"_fix_ave_time.html, "fix ave/histo"_fix_ave_histo.html

[Default:] none
