# 回复： Could lammps calculate the stress tensor based onintermolecular interactions

Hi Axel
I have read the manual for the command “compute stress/atom command” , and I have several questions about the formula to calculate the stress tensor.

If I take x for a and b,the second term for the pair interaction in the formula is 1/2Σ(R1xF1x+R2xF2x).The pair interaction is the interactions between two atoms,so only R1xF1x or R2xF2x is supposed to appear, but if one image of the atom, and only one image of the atom is taken into account, then the second term which contains both R1xF1x and R2xF2x is correct. If the image of the atom is taken into account, for the third term for angled atoms, it is not correct. The reason is that there are two atoms which are bonded with atom I, thus an angle is formed. If the image of the two bonded atoms are taken into account, there should be four terms (two plus two) instead of three,but there are only three terms in the manual for the angle.

Could you please kindly explain why the manual is written so?

Thanks

Fan L

Hi Axel
I have read the manual for the command "compute stress/atom command" ,
and I have several questions about the formula to calculate the stress
tensor.

If I take x for a and b,the second term for the pair interaction in the
formula is 1/2Σ(R1x*F1x+R2x*F2x).The pair interaction is the interactions
between two atoms,so only R1x*F1x or R2x*F2x is supposed to appear, but
if one image of the atom, and only one image of the atom is taken into
account, then the second term which contains both R1x*F1x and R2x*F2x is
correct. If the image of the atom is taken into account, for the third term
for angled atoms, it is not correct. The reason is that there are two atoms
which are bonded with atom I, thus an angle is formed. If the image of the
two bonded atoms are taken into account, there should be four terms (two
plus two) instead of three,but there are only three terms in the manual for
the angle.

Could you please kindly explain why the manual is written so?

​the manual is written this way because it is correct and describes what is
computed (if all explicit pairs are considered and not the - more efficient
- F dot r​ shortcut can be used).
please note, that the pair sum is over all pairs of atoms as computed
inside pair styles based on the neighbor list. they consider the two
closest images of a pair of atoms.
you are not making sense about "angled atoms". angle force terms are
additive, so is the stress term. for normal classical force fields, of
course, the pairs related to an explicit angle interactions are excluded
and thus don't show up in the list of pairs.

axel.

p.s.: one word of advice before making claims that something is wrong:
please consider the probabilities. LAMMPS is a software that is around for
over 20 years now and lots and lots of people have looked at the source
code and documentation. many of these people are very knowledgeable and
experienced. while that doesn't guarantee, that there are no mistakes or
bugs (in fact, we are occasionally made aware of mistakes or bugs, that
should have been found long ago, following the consideration i just
outlined), it still makes it very, very unlikely for anything to be so
obviously wrong as you claim in a basic, often used feature.