 # [lammps-users] On the pressure and stress

Dear all,

I’m using LAMMPS to do tensile simulations. I found that the p_tensor is equal to the summation of ke_tensor and virial terms (as described in pressure.cpp), where ke_tensor is computed only from the velocity of all atoms (in temp_full.cpp) and the virial term is always equal to zero. However, the stress tensor is computed from the atomic velocity and force, that is, S(a,b) = - mv(a)v(b)+0.5sum{[a(i)-a(j)]Fb(i,j);j=1,n} (in fix_stress.cpp). Now, I’m wondering that how we can draw the conclusion that “Also note that this quantity is the negative of the per-atom pressure tensor.” (in the help file dump.html). Could anyone explain this to me? thanks.
In addition, I want to compute the stress as S(a,b) = 0.5
sum{[a(i)-a(j)]Fb(i,j);j=1,n}, are there many codes need to be modified and where are they? Any suggestion is appreciated.

With best regards,

ZHENG

3G 时 代 来 临 了，坚 决 对 传 统 邮 箱 说 不 ！

Not clear what you're asking. The ke_tensor should just be the
sum of the atomic velocity terms and the virial term (non-zero) will
contribute to the pressure or stress tensor. Do you think
something is inconsistent?

Steve

Hi Steve,

I have known that the virial term is not zero, which involves the pair_virial terms computed from pair forces. The average stress tensor is exactly the negative of the per-atom pressure. Thanks.

Now I just want to modify the code to compute the stress using only the force terms (that is, ignoring contributions from the atomic velocity terms as suggested in some literatures). Because I use the fix_npt option, I think I should modify those codes related to the pressure and stress computing in pressure.cpp and fix_stress.cpp, is that correct?

Best regards,

ZHENG

3G 时 代 来 临 了，坚 决 对 传 统 邮 箱 说 不 ！

I think all you would need from fix npt is the current volume,
which would enable you to compute the virial for the current
snapshot.

Steve