# stress and pressure.

Vikas, I think what you are asking for is something like this, which
gives all 6 components of the pressure:

compute peratom all stress/atom
compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
c_peratom[4] c_peratom[5] c_peratom[6]
variable press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)
variable pxx equal -c_p[1]/vol
variable pyy equal -c_p[2]/vol
variable pzz equal -c_p[3]/vol
variable pxy equal -c_p[4]/vol
variable pxz equal -c_p[5]/vol
variable pyz equal -c_p[6]/vol
thermo_style custom press v_press pxx v_pxx pyy v_pyy pzz v_pzz pxy
v_pxy pxz v_pxz pyz v_pyz

As you can see you must take the negative of stress and divide by
volume to get pressure as described on the doc page
(http://lammps.sandia.gov/doc/compute_stress_atom.html):

"Note that as defined in the formula, per-atom stress is the negative
of the per-atom pressure tensor. It is also really a stress*volume
formulation, meaning the computed quantity is in units of
pressure*volume. It would need to be divided by a per-atom volume to
have units of stress (pressure), but an individual atom's volume is
not well defined or easy to compute in a deformed solid or a liquid.
Thus, if the diagonal components of the per-atom stress tensor are
summed for all atoms in the system and the sum is divided by dV, where
d = dimension and V is the volume of the system, the result should be
-P, where P is the total pressure of the system."

Stan