LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

compute variable/atom command

Syntax:

compute ID group-ID variable/atom name 

Examples:

compute 1 flow variable/atom myVar 

Description:

Define a computation that calculates a formula for each atom in the group. The resulting values can be accessed by any command that uses per-atom computes, e.g. the dump custom command or fix ave/spatial command or fix ave/atom command.

The value of the variable evaluation will be 0.0 for atoms not in the specified compute group.

The formula is defined by the variable atom command. A variable of style atom can access properties of the system, such as volume or temperature, and also reference individual atom attributes, such as its coordinates or velocity.

For example, these 3 commands would compute the xy kinectic energy of atoms in the flow group and include the values in dumped snapshots of the system.

variable xy atom mult(0.5,add(mult(vx[],vx[]),mult(vy[],vy[])))
compute ke flow variable/atom xy
dump 1 flow custom 1000 dump.flow tag type x y z c_ke 

If the dump line were replaced by

fix 1 flow ave/spatial 100 1000 z lower 2.0 ke.profile compute ke 

then the xy kinetic energy values would be averaged by z layer and the layer averages written periodically to the file ke.profile.

Restrictions: none

Related commands:

dump custom, fix ave/spatial

Default: none