\(\renewcommand{\AA}{\text{Å}}\)

# compute stress/mop command

# compute stress/mop/profile command

## Syntax

```
compute ID group-ID style dir args keywords ...
```

ID, group-ID are documented in compute command

style =

*stress/mop*or*stress/mop/profile*dir =

*x*or*y*or*z*is the direction normal to the planeargs = argument specific to the compute style

keywords =

*kin*or*conf*or*total*or*pair*or*bond*or*angle*or*dihedral*(one or more can be specified)

stress/mopargs = pos pos =lowerorcenterorupperor coordinate value (distance units) is the position of the planestress/mop/profileargs = origin delta origin =lowerorcenterorupperor coordinate value (distance units) is the position of the first plane delta = value (distance units) is the distance between planes

## Examples

```
compute 1 all stress/mop x lower total
compute 1 liquid stress/mop z 0.0 kin conf
fix 1 all ave/time 10 1000 10000 c_1[*] file mop.time
fix 1 all ave/time 10 1000 10000 c_1[2] file mop.time
compute 1 all stress/mop/profile x lower 0.1 total
compute 1 liquid stress/mop/profile z 0.0 0.25 kin conf
fix 1 all ave/time 500 20 10000 c_1[*] ave running overwrite file mopp.time mode vector
```

## Description

Compute *stress/mop* and compute *stress/mop/profile* define
computations that calculate components of the local stress tensor using
the method of planes (Todd). Specifically in compute
*stress/mop* calculates 3 components are computed in directions *dir*,*x*; *dir*,*y*; and *dir*,*z*; where *dir* is the direction
normal to the plane, while in compute *stress/mop/profile* the profile
of the stress is computed.

Contrary to methods based on histograms of atomic stress (i.e., using compute stress/atom), the method of planes is compatible with mechanical balance in heterogeneous systems and at interfaces (Todd).

The stress tensor is the sum of a kinetic term and a configurational term, which are given respectively by Eq. (21) and Eq. (16) in (Todd). For the kinetic part, the algorithm considers that atoms have crossed the plane if their positions at times \(t-\Delta t\) and \(t\) are one on either side of the plane, and uses the velocity at time \(t-\Delta t/2\) given by the velocity Verlet algorithm.

Added in version 15Jun2023: contributions from bond, angle and dihedral potentials

Between one and seven keywords can be used to indicate which contributions to the stress must be computed: total stress (total), kinetic stress (kin), configurational stress (conf), stress due to bond stretching (bond), stress due to angle bending (angle), stress due to dihedral terms (dihedral) and/or due to pairwise non-bonded interactions (pair).

NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID.

NOTE 2: The local stress does not include any Lennard-Jones tail corrections to the stress added by the pair_modify tail yes command, since those are contributions to the global system pressure.

NOTE 3: The local stress profile generated by compute
*stress/mop/profile* is similar to that obtained by compute
stress/cartesian.
A key difference is that compute *stress/mop/profile*
considers particles crossing a set of planes, while
*stress/cartesian* computes averages for a set
of small volumes.
Moreover, *stress/cartesian* compute computes the diagonal components of the stress
tensor \(P_{xx}\), \(P_{yy}\), and \(P_{zz}\), while
*stress/mop/profile* computes the components
\(P_{ix}\), \(P_{iy}\), and \(P_{iz}\), where \(i\) is the
direction normal to the plane.

## Output info

Compute *stress/mop* calculates a global vector (indices starting at 1),
with 3 values for each declared keyword (in the order the keywords have
been declared). For each keyword, the stress tensor components are
ordered as follows: stress_dir,x, stress_dir,y, and stress_dir,z.

Compute *stress/mop/profile* instead calculates a global array, with 1
column giving the position of the planes where the stress tensor was
computed, and with 3 columns of values for each declared keyword (in the
order the keywords have been declared). For each keyword, the profiles
of stress tensor components are ordered as follows: stress_dir,x;
stress_dir,y; and stress_dir,z.

The values are in pressure units.

The values produced by this compute can be accessed by various output commands. For instance, the results can be written to a file using the fix ave/time command. Please see the example in the examples/PACKAGES/mop folder.

## Restrictions

These styles are part of the EXTRA-COMPUTE package. They are only enabled if LAMMPS is built with that package. See the Build package doc page on for more info.

The method is implemented for orthogonal simulation boxes whose size does not change in time, and axis-aligned planes.

The method only works with two-body pair interactions, because it
requires the class method `Pair::single()`

to be implemented, which is
not possible for manybody potentials. In particular, compute
*stress/mop/profile* and *stress/mop* do not work with more than two-body
pair interactions, long range (kspace) interactions and
improper intramolecular interactions.

The impact of fixes that affect the stress (e.g. fix langevin) is also not included in the stress computed here.

## Default

none

**(Todd)** B. D. Todd, Denis J. Evans, and Peter J. Daivis: “Pressure tensor for inhomogeneous fluids”,
Phys. Rev. E 52, 1627 (1995).

**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003).