[lammps-users] compute sum and stress/atom problem.

Dear Steve, Lammps Users,
A very happy new year to all of you.

I am having some problem in understanding the compute sum command. In the doc page of compute_stress_atom, it is mentioned that one can calculate global stress vector as follows.

compute peratom all stress/atom
compute p all sum peratom
variable p equal div(add(add(c_p1,c_p2),c_p3),mult(3.0,vol))
thermo_style custom step temp etotal c_global v_p

When I tried it on my inputscript, I got an error on the second compute command. Here, the compute compute doesn’t seem to be working. I looked at the code (compute_sum.cpp) and understood that probably the command should be written in the following manner.

compute p all sum c_peratom[1] c_peratom[2] c_peratom[3] c_peratom[4] c_peratom[5] c_peratom[6]

This command seems to be working with latest (3rd Jan version). I just want to make sure that I am going the right way. In that case, I doc page could be clarified, If I am misunderstanding something please let me know.

If my version of compute is correct, does it mean that p[1] would be sum of all stress/atom for peratom[1], same for the case with p[2], p[3], etc? In such case, is it fine to define the variable command as
variable p equal div(add(add(c_p 1,c_p2),c_p3),mult(3.0,vol))

or one should define it as
variable p equal div(add(add(c_p[1],c_p[2]),c_p[3]),mult(3.0,vol))

Any comments will be highly appreciated.

Regards,
Vikas

The doc page for compute stress/atom is out-of-date with the 3Jan08 patch.
Your version of compute sum is correct below, but the formula for
computing the pressure from per-atom stress would now be:

variable press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)

The 4Jan08 patch updates the doc page for this.

Steve