LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

compute command

Syntax:

compute ID group-ID style args 

Examples:

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

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 or fix ave/time command. Or the values can be referenced in a variable equal 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 command or the fix ave/spatial command. Or the per-atom values can be time-averaged via the fix ave/atom command and then output via the dump custom or fix ave/spatial 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 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 

Additional computes are created if the thermo style requires it. See the documentation for the thermo_style 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 and specific fix 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, fix modify, and dump commands.

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

Computes can be deleted with the uncompute command.

Code for new computes can be added to LAMMPS (see this section 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:

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.

Restrictions: none

Related commands:

uncompute, compute_modify, fix ave/atom, fix ave/spatial, fix ave/time

Default: none