Refactoring, but neighbor tests seem to run.

Still need to double check correctness, but it runs without problems on an
old trajectory with non-cubic PBCs that change over the course of the
trajectory.