fix spring/self and periodic boundary conditions

Hello all,
I have noticed an issue with the spring/self fix in a simulation with
applied periodic boundary conditions. The energy (and forces?) of the
springs does not seem to take the PBC into account. Atoms near the
edge of a simulation cell can wrap around and see a spike in their
spring energy. Adding a call to domain->minimum_image() seems to solve
that problem (see the changed section in post_force() below for
Is that by design? To be honest I did not quite understand the
intention if the lines I commented out (it seems like an attempt at
taking PBC into account, but it did not give the results I was looking
Daniel Schwen

       /*xbox = (image[i] & IMGMASK) - IMGMAX;
       ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
       zbox = (image[i] >> IMG2BITS) - IMGMAX;
       dx = x[i][0] + xbox*xprd - xoriginal[i][0];
       dy = x[i][1] + ybox*yprd - xoriginal[i][1];
       dz = x[i][2] + zbox*zprd - xoriginal[i][2];*/
       dx = x[i][0] - xoriginal[i][0];
       dy = x[i][1] - xoriginal[i][1];
       dz = x[i][2] - xoriginal[i][2];

The logic with the image flags should make it so that
periodic BC work correctly without using minimum_image.
It does require however that your atom's image flags be
correct at the time you invoke the fix.

I.e. an atom near a boundary should feel nearly the
same force whether it crosses the boundary or not.