How to center molecule along XY plane?

GROMACS version:2020.3
GROMACS modification: No

Hello all,

I am working on simulating a small anion in the water/vapor interface and after the production run in a box elongated in the z-direction, I have extracted snapshots where the ion is at the interface. The following is a representative snapshot which will be use in further analysis:

I want the molecule to be centered in the XY plane for all the snapshots but I cannot find any tool to do that. I wanted to ask if it is possible to enforce PBC along certain planes using already available GROMACS commands.

gmx trjconv -fit transxy will apply a translational fit using only X and Y components of the coordinates.

Dear prof. @jalemkul ,
Could you say that in a membrane simulation, it is normal to have translational movements of protein within the XY plane of the membrane jumping across the box boundaries? If it’s fine, how does someone calculate RMSD doing the least square fitting?
I’m getting errors due to jumps of the protein and I couldn’t easily get an RMSD curve with most of the gmx rms options, and the RMSD curve always resembles the errors due to jumps.

Thank you!