undoPeriodicBoundaryConditions() restores prevPos