neigh_modify question

Please keep the list in the loop.

See the compute() method in src/pair_sw.cpp
The 3-body loop is

loop i
loop j
loop k

The inner 2 loops are neighbors of atom I.
So you end up with I-J-K triplets which are 3-body

The energy for the 3-body term is returned by
the method threebody().


perhaps one should mention in addition,
that it is a valid consideration to make
nested loops over the same neighborlist,
since 3-body terms in most of the potentials
in the manybody package are all shortranged
interactions and thus it is a valid assumption
that the third atom is as likely within the
neighbors of the first atom as the second.

dihedral (i.e. 4-body) terms are a bit more
tricky in that respect. :wink: