LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

compute sum command

Syntax:

compute ID group-ID sum compute-ID1 compute-ID2 ... 

Examples:

compute 1 all sum c_force
compute 1 all sum atomKE atomEpair atomEbond 

Description:

Define a computation that sums the results of one or more per-atom computes across all atoms in the group to yield a global scalar or vector quantity. For example, the forces on a group of atoms could be summed to yield a net force on the group. The resulting value(s) can be accessed by any command that uses global computes, e.g. the thermo custom command or fix ave/time command or by a variable command.

Unlike the compute sum/atom command, the result of this is not a per-atom quantity, but a global scalar or vector. If the other computes each generate a scalar value per atom, this compute will generate a single scalar value. If the other computes each generate a vector of values per atom, this compute will generate a vector of values where each value is the sum across atoms of the corresponding value produced by the other computes. In the latter case, all the other computes must generate per-atom vectors of the same size.

Note that all per-atom computes generate values of 0.0 for atoms that are not in the group specified for that compute.

Restrictions: none

Related commands:

compute sum/atom

Default: none