ChrisB's fix for periodic_neighbours. Tests pass now!