LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

compute pressure command

Syntax:

compute ID group-ID pressure temp-ID keyword ... 

Examples:

compute 1 all pressure myTemp
compute 1 all pressure thermo_temp pair bond 

Description:

Define a computation that calculates the pressure of the entire system of atoms. The specified group must be "all". See the compute stress/atom command if you want per-atom pressure (stress). These per-atom values could be summed for a group of atoms via the compute reduce command.

The pressure is computed by the formula

where N is the number of atoms in the system (see discussion of DOF below), Kb is the Boltzmann constant, T is the temperature, d is the dimensionality of the system (2 or 3 for 2d/3d), V is the system volume (or area in 2d), and the second term is the virial, computed within LAMMPS for all pairwise as well as 2-body, 3-body, and 4-body, and long-range interactions. Fixes that impose constraints (e.g. the fix shake command) also contribute to the virial term.

A 6-component symmetric pressure tensor is also calculated by this compute whose components can be output by the thermo_style custom command or accessed by other compute and fix commands. The equation for the I,J components (where I and J = x,y,z) is similar to the above formula, except that the first term uses components of the kinetic energy tensor and the second term uses components of the virial tensor:

If no extra keywords are listed, the entire equations above are calculated which include a kinetic energy (temperature) term and the virial as the sum of pair, bond, angle, dihedral, improper, kspace (long-range), and fix contributions to the force on each atom. If any extra keywords are listed, then only those components are summed to compute temperature or ke and/or the virial. The virial keyword means include all terms except the kinetic energy ke.

The temperature and kinetic energy tensor is not calculated by this compute, but rather by the temperature compute specified with the command. Normally this compute should calculate the temperature of all atoms for consistency with the virial term, but any compute style that calculates temperature can be used, e.g. one that excludes frozen atoms or other degrees of freedom.

Note that the N in the first formula above is really degrees-of-freedom divided by d = dimensionality, where the DOF value is calcluated by the temperature compute. See the various compute temperature styles for details.

A compute of this style with the ID of "thermo_press" is created when LAMMPS starts up, as if this command were in the input script:

compute thermo_press all pressure thermo_temp 

where "thermo_temp" is the ID of a similarly defined compute of style "temp". See the "thermo_style" command for more details.

Output info:

The scalar and vector values calculated by this compute are "intensive", meaning they are independent of the number of atoms in the simulation. The 6 components of the vector are ordered xx, yy, zz, xy, xz, yz.

Restrictions: none

Related commands:

compute temp, compute stress/atom, thermo_style,

Default: none