"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 pressure command :h3
compute pressure/cuda command :h3

[Syntax:]

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

ID, group-ID are documented in "compute"_compute.html command
pressure = style name of this compute command
temp-ID = ID of compute that calculates temperature
zero or more keywords may be appended
keyword = {ke} or {pair} or {bond} or {angle} or {dihedral} or {improper} or {kspace} or {fix} or {virial} :ul

[Examples:]

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

[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"_compute_stress_atom.html command if you want per-atom
pressure (stress).  These per-atom values could be summed for a group
of atoms via the "compute reduce"_compute_reduce.html command.

The pressure is computed by the formula

:c,image(Eqs/pressure.jpg)

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"_fix.html that impose constraints
(e.g. the "fix shake"_fix_shake.html command) also contribute to the
virial term.

A symmetric pressure tensor, stored as a 6-element vector, is also
calculated by this compute.  The 6 components of the vector are
ordered xx, yy, zz, xy, xz, yz.  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:

:c,image(Eqs/pressure_tensor.jpg)

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"_compute.html 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 :pre

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

:line

Styles with a {cuda} suffix are functionally the same as the
corresponding style without the suffix.  They have been optimized to
run faster, depending on your available hardware, as discussed in
"Section_accelerate"_Section_accelerate.html of the manual.  The
accelerated styles take the same arguments and should produce the same
results, except for round-off and precision issues.

These accelerated styles are part of the USER-CUDA package.  They are
only enabled if LAMMPS was built with that package.  See the "Making
LAMMPS"_Section_start.html#start_3 section for more info.

You can specify the accelerated styles explicitly in your input script
by including their suffix, or you can use the "-suffix command-line
switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can
use the "suffix"_suffix.html command in your input script.

See "Section_accelerate"_Section_accelerate.html of the manual for
more instructions on how to use the accelerated styles effectively.

:line

[Output info:]

This compute calculates a global scalar (the pressure) and a global
vector of length 6 (pressure tensor), which can be accessed by indices
1-6.  These values can be used by any command that uses global scalar
or vector values from a compute as input.  See "this
section"_Section_howto.html#howto_15 for an overview of LAMMPS output
options.

The scalar and vector values calculated by this compute are
"intensive".  The scalar and vector values will be in pressure
"units"_units.html.

[Restrictions:] none

[Related commands:]

"compute temp"_compute_temp.html, "compute
stress/atom"_compute_stress_atom.html,
"thermo_style"_thermo_style.html,

[Default:] none
