Stress Per Atom

Hi,
I was trying to output trace of the stress tensor ( s(1,1)+s(2,2)+s(3,3) ) as a per atom quantity with CFG file
to color the structure according to local stress value.

I used
compute stress all stress/atom

which generates and array of Natoms x 6 . stress[1] to stress[6] will be stress tensor for each atom

Is there any way to calculate the average of first 3 elements of this array and set to a variable?

Dundar.

yes - use an atom-style variable and write the equation
that averages the 3 components you want.

Steve