Center solvent in the centre of the box

GROMACS version: 2020.4
GROMACS modification: Yes/No

Hi all,

I am trying to use trjconv wrap a trajectory produced by a NVT simulation with a box that has been enlarged on the z axis. here is my command

gmx trjconv -s nvt.tpr -f nvt.xtc -pbc mol -ur compact -center -o processed.xtc

I have tried using “Water” and “System” as groups for centering, but both give me the following output


I would like to keep the centre of all atoms in the center of the box, but I can’t find the setting to do it. Any ideas?


Try removing jumps first with -pbc nojump then do translational fitting with -fit translation.

Hi Justin,

Thanks for your answer.
I have had no luck though. I think it may be because when the jumps are removed, the system drifts out of the box in all directions, and with so many molecules the translational fitting maybe doesn’t work? Is there any way to only remove the jumps in the z direction? that may do the trick


Maybe -fit progressive or -fit translation without removing PBC jumps will do the trick.

Hi Justin,

Still fiddling with this, and none of the trjconv commands I’ve tried so far seems to do the trick. I was wondering if that may be an artifact with the simulation, specifically with the setting that removes the COM motion. Here’s the relevant parameters:

comm-mode = Linear
comm-grps = System
nstcomm = 2500 ; same as nstxout

Do you think the problem would be here? I have tried with nstcomm = 1 but I’m afraid the COM movements between consecutive steps may be too small for mdrun to notice (am I right?).

The system consists in about 10000 molecules (different proportions of water and ethanol) and 1 to 20 small molecules (20ish atoms each).


If there’s a net kinetic energy associated with the COM, it gets removed, unless it’s below machine precision (unlikely).

Hi all,
I recently found a fix for this. It looks like the issue was not on trjconv but on the simulation itself. I was using the v-rescale thermostat which seemed to result in the “flying ice cube” effect. Using Nose-Hoover thermostat seemed to fix this behaviour and now the solvent stays in the middle of the box.