"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

compute command :h3

[Syntax:]

compute ID group-ID style args :pre

ID = user-assigned name for the computation
group-ID = ID of the group of atoms to perform the computation on
style = one of a list of possible style names (see below)
args = arguments used by a particular style :ul

[Examples:]

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

[Description:]

Create a computation that will be performed on a group of atoms.

In LAMMPS, a "compute" is used in several ways.  There are two kinds
of computes, "global" computes that calculate one or more values for
the entire group of atoms, and "per-atom" computes that calculate one
or more values for each atom in the group.  The latter has the word
"atom" in its style name.

The results of global computes 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
command.  The results of computes that calculate a global temperature
or pressure can be used by fixes that do thermostatting or
barostatting and when atom velocities are created.

The results of per-atom computes can be output via the "dump
custom"_dump.html command or the "fix
ave/spatial"_fix_ave_spatial.html command.  Or the per-atom values can
be time-averaged via the "fix ave/atom"_fix_ave_atom.html command and
then output via the "dump custom"_dump.html or "fix
ave/spatial"_fix_ave_spatial.html commands.  Note that the value of
per-atom computes will be 0.0 for atoms not in the specified compute
group.

See this "howto section"_Section_howto.html#4_15 for a summary of
various LAMMPS output options.

LAMMPS creates its own global computes for thermodynamic output.
Three computes are always created, named "thermo_temp",
"thermo_pressure", and "thermo_pe", as if these commands had been
invoked in the input script:

compute thermo_temp all temp
compute thermo_pressure all pressure thermo_temp
compute thermo_pe all pe :pre

Additional computes are created if the thermo style requires it.  See
the documentation for the "thermo_style"_thermo_style.html command.

The dumping of atom snapshots and fixes that compute temperature or
pressure also create computes as required.  These are discussed in the
documentation for the "dump custom"_dump.html and specific
"fix"_fix.html commands.

In all these cases, the default computes can be replaced by computes
defined by the user in the input script, as described by the
"thermo_modify"_thermo_modify.html, "fix modify"_fix_modify.html, and
"dump"_dump.html commands.

Properties of either a default of 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 LAMMPS (see "this
section"_Section_modify.html of the manaul) 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
defined in LAMMPS:

"attribute/atom"_compute_attribute_atom.html - attribute (x,v,f,etc) of each atom
"centro/atom"_compute_centro_atom.html - centro-symmetry parameter for each atom
"coord/atom"_compute_coord_atom.html - coordination number for each atom
"ke/atom"_compute_ke_atom.html - kinetic energy for each atom
"pe"_compute_pe.html - potential energy
"pe"_compute_pe.html - potential energy for each atom
"pressure"_compute_pressure.html - total pressure and pressure tensor
"rotate/dipole"_compute_rotate_dipole.html - rotational energy of dipolar atoms
"rotate/gran"_compute_rotate_gran.html - rotational energy of granular atoms
"stress/atom"_compute_stress_atom.html - stress tensor for each atom
"sum"_compute_sum.html - sum per-atom quantities to a global value
"sum/atom"_compute_sum_atom.html - sum per-atom quantities to per-atom values
"temp"_compute_temp.html - temperature of group of atoms
"temp/asphere"_compute_temp_asphere.html - temperature of aspherical particles
"temp/deform"_compute_temp_deform.html - temperature excluding box deformation velocity
"temp/dipole"_compute_temp_dipole.html - temperature of point dipolar particles
"temp/partial"_compute_temp_partial.html - temperature excluding one or more dimensions of velocity
"temp/ramp"_compute_temp_ramp.html - temperature excluding ramped velocity component
"temp/region"_compute_temp_region.html - temperature of a region of atoms
"variable"_compute_variable.html - calculate a scalar value from a variable
"variable/atom"_compute_variable_atom.html - calculate a formula for each atom :ul

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 "this
page"_Section_commands.html#3_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

[Default:] none
