Currently (I'm still on OpenMM 4.1.1 but I'm assuming this is still an issue for OpenMM 5), when you call getState() on a context set up by the RPMD Integrator and have the parameter enforcePeriodicBox=1, particle positions are translated into the box by molecule centers, but the copies are not considered (you have to get state info one copy at a time). In the output trajectory, this can result in a copy on one side of the box, but another whose center crossed the boundary will be shifted over to the other side. This can cause issues if you run the integrator multiple times in a row and set up particle positions from the last config of the previous run (i.e. restarting after a computer crash or if you're like me and using an external program between runs to do things). The problem is that you will have high spring energy between the separated copies.
I fixed this problem by making my own function to enforce the periodic box after calling the state on all of the copies. I used the code found in [OpenMM base directory]/openmmapi/src/Context.cpp between
as a starting point, but instead of center of molecule I was using centroid of the copies and translated all of the copies of a molecule together. It may be useful to have a native solution for this though, because other people might run into this problem. It complicated by each copy being contained in a different context, so I don't think the getState() in Context.cpp can be modified.