# Post_calculation of average stress in xx, yy and zz

Hi,everyone, i am trying to verify that my input script is right. and i do have a problem.
firstly, i use the command
‘’’
compute 2 all pair/local dist dx dy dz force fx fy fz cutoff radius
‘’’
to calcute the contact force between each contact pairs. Then i used
‘’’
fix 9 all press/berendsen x 0 100000 1000 y 0 100000 1000 z 0 100000 1000
‘’’
to compress the box until the average stress in x, y, z is 100 kPa. the
‘’’
compute 7 all pressure NULL pair
‘’’
is also used to show the stress. everything seems good, the simulation reach my target stress 100 kPa. the c_7[1] c_7[2] c_7[3] shows 100 kPa.

But then I tried to verify the average stress by using the contacts information data. as we know, if we have dx, and dy, then sum (dx * dy)./ volume of box should be average stress in the xx diraction. however this value is definitely not right. i can not get the right stress ? is this anything wrong for my test the setup? I also identify that
‘’’
compute 3 all property/local patom1 patom2 cutoff radius
‘’’
did not recalculate the perodic boundry effect, i can one particle in very left contact with the particle in the very right. is that common?

please find attached the contact file
it is for all column.
id-1 id-2 dist dx dy dz force fx fy fz

i calculated the sum (dx*fx)./V, its not right.

if anyone have similar experiences for the calculation of stress from contact forces, please share any idea. hope you have a nice day
random.in (4.1 KB)

dump385300000.contact (1.7 MB)

Hi dear all, i just found the reason, its weird but i identfied the reason, if we want to simulate shpere and calculate the average stress from pair contact forces.
we get the dx dy and dz from pair/local, however they cannot be directly used. we added P10 P11 P12 at the compute pair/local. I cited “The last 3 (10-12) are the components of the vector connecting the centers of the two particles (x_I - x_J)”. Then this P10, P11 and P12 can be used to calculate xx,yy. zz
sum (p10*fx)./v is now the average stress in x

Hi @Tom_lammps,

• The character your looking for to format your input is the backtick (). Put three of them above and below the line containing your command
et voilà.

• You can also use a bit of LaTeX using dollar signs \frac{dx\cdot{}dy}{V} for example.
• Your input file is convoluted and complex for new readers. Please try to provide simple minimal examples to narrow your problem down if you want useful inputs.

• Assuming that random people know what you’re talking about (...as we know...) is a big hypothesis. I don’t know what dx and dy are and why they should give a stress. From the LAMMPS command compute pair/local they are pairwise distance. So if V is the box volume, \frac{dx\cdot{}dy}{V} is a distance. Not a stress.
• “How can I get the right stress?” Which stress are you talking about? If it is the full box stress, details of the calculation are provided in the lammps manual of the compute stress/atom` command. This one should give you the total stress if summed over atoms.