how lammps compute msd

Dear all,

I have a basic question while calculating MSD of molecules in the sytem. A molecule goes out of the box and due to PBC it comes back again from the opposite side. So when this happens MSD reduces as that molecule/aom again recenter to the same position where it was initially. How we can compute MSD then, when there should not be an image recentering of the molecules? It should continously moving away from the refernce postion rather than coming back from the opposite side.
Please help!

This is explained on the doc page:

And there is a compute msd/chunk command which
can be used for molecules (a chunk can be a molecule).
It handles PBCs the same way.