That's not the correct formula for any potential.
It's not position (r) invariant, meaning if you
translate the box you'll get a different answer.
See the compute stress/atom doc and compute
pressure doc pages for how LAMMPS computes
Let me restate what I just posted more accurately.
The formula is correct, but you have to be careful
about how you calculate it. In a periodic system,
you can't just use F dot r. It isn't translationally
invariant, e.g. if you shift the atoms wrt to the
box, you get a different answer.
On the citations page of the WWW site, see
the paper by A Thompson if you want details.
The compute stress/atom doc page tells
you how you can compare 2 different ways
of calculating the pressure within LAMMPS.
They should agree for AIREBO and every
Thank you very much for your explanation.
Dear Dr. Plimpton,
In the compute stress/atom doc page it is said that "...F1 and F2 are the
forces on the 2 atoms resulting from the pairwise interaction". Then, to
calculate the stress using that formula, I need to know the force on each
atom due to each pairwise interaction they encounter. Then the pressure
cannot be calculated from only knowing the total force acting on each
atom. Is that correct?
The issue is periodic boundary conditions. The forces you
need to calculate pressure may actually be on ghost atoms.
LAMMPS takes care of this, but by the time you dump forces
per atom to a dump file, it's too late. You don't know if the
forces were on the real atom or its ghost images.