<PRE>compute ID group-ID stress/atom temp-ID keyword ...
</PRE>
<UL><LI>ID, group-ID are documented in <AHREF ="compute.html">compute</A> command
<LI>stress/atom = style name of this compute command
<LI>temp-ID = ID of compute that calculates temperature, can be NULL if not needed
<LI>zero or more keywords may be appended
<LI>keyword = <I>ke</I> or <I>pair</I> or <I>bond</I> or <I>angle</I> or <I>dihedral</I> or <I>improper</I> or <I>kspace</I> or <I>fix</I> or <I>virial</I>
</UL>
<P><B>Examples:</B>
</P>
<PRE>compute 1 mobile stress/atom NULL
compute 1 mobile stress/atom myRamp
compute 1 all stress/atom NULL pair bond
</PRE>
<P><B>Description:</B>
</P>
<P>Define a computation that computes the symmetric per-atom stress
tensor for each atom in a group. The tensor for each atom has 6
components and is stored as a 6-element vector in the following order:
xx, yy, zz, xy, xz, yz. See the <AHREF ="compute_pressure.html">compute
pressure</A> command if you want the stress tensor
(pressure) of the entire system.
</P>
<P>The stress tensor for atom <I>I</I> is given by the following formula,
where <I>a</I> and <I>b</I> take on values x,y,z to generate the 6 components of
the symmetric tensor:
</P>
<CENTER><IMGSRC ="Eqs/stress_tensor.jpg">
</CENTER>
<P>The first term is a kinetic energy contribution for atom <I>I</I>. See
details below on how the specified <I>temp-ID</I> can affect the velocities
used in this calculation. The second term is a pairwise energy
contribution where <I>n</I> loops over the <I>Np</I> neighbors of atom <I>I</I>, <I>r1</I>
and <I>r2</I> are the positions of the 2 atoms in the pairwise interaction,
and <I>F1</I> and <I>F2</I> are the forces on the 2 atoms resulting from the
pairwise interaction. The third term is a bond contribution of
similar form for the <I>Nb</I> bonds which atom <I>I</I> is part of. There are
similar terms for the <I>Na</I> angle, <I>Nd</I> dihedral, and <I>Ni</I> improper
interactions atom <I>I</I> is part of. There is also a term for the KSpace
contribution from long-range Coulombic interactions, if defined.
Finally, there is a term for the <I>Nf</I><AHREF ="fix.html">fixes</A> that apply
internal constraint forces to atom <I>I</I>. Currently, only the <AHREF ="fix_shake.html">fix
shake</A> and <AHREF ="fix_rigid.html">fix rigid</A> commands
contribute to this term.
</P>
<P>As the coefficients in the formula imply, a virial contribution
produced by a small set of atoms (e.g. 4 atoms in a dihedral or 3
atoms in a Tersoff 3-body interaction) is assigned in equal portions
to each atom in the set. E.g. 1/4 of the dihedral virial to each of
the 4 atoms, or 1/3 of the fix virial due to SHAKE constraints applied
to atoms in a a water molecule via the <AHREF ="fix_shake.html">fix shake</A>
command.
</P>
<P>If no extra keywords are listed, all of the terms in this formula are
included in the per-atom stress tensor. If any extra keywords are
listed, only those terms are summed to compute the tensor. The
<I>virial</I> keyword means include all terms except the kinetic energy
<I>ke</I>.
</P>
<P>Note that the stress for each atom is due to its interaction with all
other atoms in the simulation, not just with other atoms in the group.
</P>
<P>Details of how LAMMPS computes the virial for individual atoms for
either pairwise or manybody potentials, and including the effects of
periodic boundary conditions is discussed in <AHREF ="#Thompson">(Thompson)</A>.
The basic idea for manybody potentials is to treat each component of
the force computation between a small cluster of atoms in the same
manner as in the formula above for bond, angle, dihedral, etc
interactions. Namely the quantity R dot F is summed over the atoms in
the interaction, with the R vectors unwrapped by periodic boundaries
so that the cluster of atoms is close together. The total
contribution for the cluster interaction is divided evenly among those