# how to calculate stress tensor of a bin

Dear lammps users,

I divide my simulation box into small layers along z direction using compute chunk/atom command.

I want to calculate the stress tensor of each bin. I don’t know which of the following ways I should take:

1. I know that I can use compute stress/atom command to get the stress*volume of each atom. Here volume is the volume of an atom. Just as said in lammps manual, an individual atom’s volume is not well defined. One choice is to use compute voronoi/atom command for one possible way to estimate a per-atom volume. With results from compute stress/atom command and compute voronoi/atom command, I can get the stress tensor of each atom and then sum them up within a bin to get the stress tensor of a bin.

2. The second way is to use compute stress/atom command to get the stress*volume of each atom, then sum up the results of compute stress/atom command within a bin. Finally the sum is divided by the volume of a bin to get the stress of a bin.

Because the sum of each atom’s voronoi volume in a bin may not equal the volume of the bin, so these two ways may give different results. Could you tell me which way I should use? Or they are both wrong and there is another way to do it?