Syntax:
compute ID group-ID stress/atom keyword value ...
ke arg = yes or no yes/no = include/exclude kinetic energy contribution to stress pair arg = yes or no yes/no = include/exclude pairwise energy contribution to stress bond arg = yes or no yes/no = include/exclude bond energy contribution to stress
Examples:
compute 1 mobile stress/atom
compute 1 all stress/atom ke no
Description:
Define a computation that computes the per-atom stress tensor for each atom in a group. The tensor for each atom has 6 components: xx, yy, zz, xy, xz, yz. The resulting values can be accessed by indices 1-6 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 stress tensor for each atom is the sum of 3 terms in the following formula. Any of the terms can be excluded by setting the ke, pair, or bond keywords to no. The ab component of stress on atom I is as follows, where a and b take on values x,y,z to generate the 6 components of the symmetric tensor:
The first term is a kinetic energy contribution for atom I. The second term is a pairwise energy contribution where J loops over the Np neighbors of atom I, and Fp is one of 3 components of force on atom I due to the pairwise interaction with atom J. The third term is a bond energy contribution where J loops over the Nb bonds which atom I is part of, and Fb is one of 3 components of force on atom I due to the bonded interaction with atom J.
If two atoms interact, either pairwise or in a bond, and only one of them is in the compute group, the interaction is included in the per-atom stress of the atom in the group.
For force fields that include a contribution to the pairwise interaction that is computed as part of dihedral terms (i.e. 1-4 interactions), this contribution is NOT included in the per-atom pairwise stress.
IMPORTANT NOTE: The per-atom stress does NOT include contributions due to angles, dihedrals, impropers that the atom is part of, or a long-range Coulombic contribution. Currently, there is no way in LAMMPS to calculate per-atom stress from angles, dihedrals, improper, or long-range interactions.
Note that as defined above, per-atom stress is the negative of the per-atom pressure tensor. It is also really a stress-volume formulation. It would need to be divided by a per-atom volume to have units of stress, but an individual atom's volume is not easy to compute in a deformed solid. Thus, if you sum the diagonal components of the per-atom stress tensor for all atoms in the system and divide the sum by 3V, where V is the volume of the system, you should get -P, where P is the total pressure of the system (assuming there is no angle, dihedral, improper, or long-range contribution to the total pressure).
Computation of per-atom stress tensor components requires a loop thru the pairwise and bond neighbor lists and inter-processor communication, so it can be inefficient to compute/dump this quantity too frequently or to have multiple compute/dump commands, each of a stress/atom style.
Restrictions:
Some pair potentials do not allow the calculation of per-atom stress via this command. An error will be generated if this is the case.
Related commands: none
Default:
The option defaults are ke = yes, pair = yes, bond = yes.