Question about global and peratom stress parameters

Dear LAMMPS users,

I’m writing here to ask a question about the correlation of global pressure components and peratom ones. As pointed out in compute stress/atom command in the manual :

compute        peratom all stress/atom NULL
compute        p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
variable       press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)
thermo_style   custom step temp etotal press v_press

which results similar value for press and v_press parameters. Now, my question is how we can correlate each components together ( i.e. global pxx to the value of peratom[1] ) ? I tried to

use voronoi analysis to capture the atomic volume and then divide peratom[1] of each atom with the corresponding value of its voronoi volume and finally

take the average of the resultant over the population of the atoms ( let's call it newpxx )but the output is different with pxx. I should mention that I did the conversion and 

both pxx and newpxx are in GPa. My LAMMPS version is 7 Aug 2019. Is there anything wrong in the way I'm trying to correlate those parameters? 

Below you can find a part of my test code where I saved c_stress[1] and c_va[1] for atoms and then use those number further to capture newpxx and

I was hoping to end up with a value similar to p2 that I got in thermo.


compute stress all stress/atom NULL
compute va all voronoi/atom 
variable p2 equal "-pxx/10000"
thermo 1
thermo_style custom step lx ly lz  v_p2 pe 
dump 1c all custom 1 dump.tensile.*.cfg id type xs ys zs c_va[1] c_stress[1]
fix 2 all box/relax  aniso 0 vmax 0.001 
minimize 1.0e-25 1.0e-25 5 100000
unfix 2

I appreciate your comments,

Best,

Shargh

you have the solution in your description available. you just have to reverse the procedure.
as shown in your example, you can compute the global stress components by summing the per-atom components. you can compute the scalar global stress by taking the average over the x, y, and z component, i.e. the trace of the stress tensor. and you can compute the corresponding pressure components by dividing through the corresponding volume.

thus to compute the global pressure tensor component or scalar global pressure from a corresponding local pressure, you first need to multiply with the local volume and then sum and then divide by the global volume.

axel.

To avoid misunderstanding of my questions, I understand that I can sum c_peratom[1] and then divide it by the volume of the simulation box as bellow. However

my question is in case of capturing peratom stress using the volume that is calculated by the voronei analysis, how can I relate this calculated peratom stress of the atoms to the global pxx.

compute peratom all stress/atom NULL
compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
variable press equal -(c_p[1])/(1*vol)
thermo_style custom step temp etotal pxx v_press vol
fix 2 all box/relax aniso 0 vmax 0.001
min_style sd
minimize 1.0e-25 1.0e-25 5 100000
unfix 2

Thanks

actually you are encouraging misunderstandings, as you are mixing up “pressure” and “stress”. the stress that LAMMPS computes is virial stress.
and there is no volume included in that calculation. that is why you have to divide by the volume to obtain “pressure”. the stress components can be summed freely and then converted to the corresponding pressure by dividing to the volume that span.

axel.

Dear Axel,

I really appreciate you went through my both questions and I’m sorry if I encouraged any misunderstanding. We are totally on the same page that volume is not included in pressure that lammps calculated ( i.e. pxx pyy … pxy ) and that’s why upon diving by 10^4 we got it in GPa in case of using metal units. As I understand, compute stress/atom ended up with values in units of pressure*volume as we can see in manual as follows:

It is also really a stressvolume formulation, meaning the computed quantity is in units of pressurevolume. 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. See the compute voronoi/atom command for one possible way to estimate a per-atom volume.

Now, to get rid of the volume part in the unit, what people do ( As I’ve see in the papers and also you mentioned in manual ) is to capture the per atom volume based on Voronei tessellation and then divide the output of compute stress/atom for each atom with the corresponding voronei volume and report it as peratom stress of the atoms in pressure unit ( Let’s say GPa if again we divide it with 10^4 ). Let’s call it as a new parameter like newpxx for each atoms. So, my understanding is that if we do a summation over this new peratom parameter newpxx and then average it over the total number of atoms, the output should be very close to the pxx that lammps gives us as virial stress in the first place. I wonder if there is anything wrong in this conclusion.
Best

you are missing the point. because the virial stress formulation implicitly includes the per-atom volume, you can compute the global stress tensor components by summing over the per-atom components, as you were doing in your input example. that can also be done for any subset of atoms for as long as you can easily determine the volume of that subset. you are arbitrarily introducing a complication by first wanting to divide by the volume.

axel.

Now I catch your point. Many thanks for your helpful comments.
regards

This is exactly why we put this LAMMPS snippet in the compute stress/atom doc page:

“”"

These lines in an input script for a 3d system should yield that result. I.e. the last 2 columns of thermo output will be the same:

compute peratom all stress/atom NULL

compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]

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

thermo_style custom step temp etotal press v_press

“”"