about usage of centroid/stress/atom

Dear LAMMPS developers and users,

I try to use centroid/stress/atom to calculate per-atom stress in my all-atom MD simulations, using command

compute myStress all centroid/stress/atom NULL virial

When I use pair_style lj/cut/coul/cut for vdw and coulomb interactions to simulate my systems I can use command centroid/stress/atom to compute stress without any errors.
However, when I change pair_style to lj/cut/coul/long or lj/charmmfsw/coul/long also using kspace_style pppm 1e-5
I obtain such error

ERROR: Pair style does not support compute centroid/stress/atom (…/compute_centroid_stress_atom.cpp:13$

While when I return the old command stress/atom instead centroid/stress/atom using lj/cut/coul/long or lj/charmmfsw/coul/long with kspace_style pppm 1e-5 no errors arise again.

Could you help me, Is it possible at this moment in LAMMPS to use this types of pair interactions (lj/cut/coul/long or lj/charmmfsw/coul/long with kspace_style pppm 1e-5)
along with the command centroid/stress/atom to compute per-atom stress?

Do I need to modify somehow kspace_modify to use the command centroid/stress/atom?

I use LAMMPS’s version from 15 Apr 2020.

Best regards,

The error message very clearly tells you that this is currently not possible.

for lj/cut/coul/cut and similar pair styles the centroid stress is the same as the standard virial stress that compute stress/atom computes, hence you get no failure.

the pull request that included the feature states that the centroid stress has only been implemented for bonded interactions thus far.

you can contact the developer via github, e.g. be commenting to that pull request.

i will put a note under restrictions in the documentation of the compute stress/atom page.


Dear Dr. Kohlmeyer,

Thank you for your answer!

I would like to clarify.
If I want only calculate using centroid/stress/atom contribution from only bonded interactions in my systems into virial, using
compute mySC all centroid/stress/atom NULL bond angle dihedral

and for all other components of the virial I will calculate using

compute mySN all stress/atom NULL ke pair kspace fix

how I can sum in LAMMPS two per-atom stresses mySC and mySN, calculated separately by centroid/stress/atom and stress/atom,
to obtain total per-atom tensor myTotalStress consisting of 9 elements as the input per-atom stress for calculating the heat flux using

compute flux all heat/flux myKE myPE myTotalStress

Could you please tell me, is it possible to sum up two stresses in one total stress using commands in LAMMPS?

And what commands could be used to sum up the stresses in LAMMPS?

Best regards,

вт, 21 апр. 2020 г. в 19:32, Axel Kohlmeyer <[email protected]>:

Dear Dr. Kohlmeyer,


Could you please tell me, is it possible to sum up two stresses in one total stress using commands in LAMMPS?

no. at least not without doing some C++ programming and recompiling LAMMPS.