Cleanup.
Work correctly with ghost atoms.

The code assumed symmetric neighbor lists for the pair contributions
(if (i < j) ...).  This is not correct when the test uses ghost atoms.
Work correctly with image atoms.

When using a neighbor list it may be that i == j because of image
atoms. So only check for i != j in cluster mode.