# Center solvent in the centre of the box

**URL:** <https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632>\
**Category:** User discussions\
**Tags:** gmx-trjconv\
**Created:** [February 23, 2021, 1:56pm UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632 "2021-02-23T13:56:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![carajillu](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/carajillu/32/494_2.png) [@carajillu](https://gromacs.bioexcel.eu/u/carajillu)\
**Post date:** [February 23, 2021, 1:56pm UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/1 "2021-02-23T13:56:19Z")

</div>

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

![output](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/1X/4c95c98f96fdef94593e98454e7b8a9245e95586.gif)

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [February 24, 2021, 7:26pm UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/2 "2021-02-24T19:26:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![carajillu](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/carajillu/32/494_2.png) [@carajillu](https://gromacs.bioexcel.eu/u/carajillu)\
**Post date:** [March 2, 2021, 11:41am UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/3 "2021-03-02T11:41:09Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [March 2, 2021, 4:24pm UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/4 "2021-03-02T16:24:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![carajillu](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/carajillu/32/494_2.png) [@carajillu](https://gromacs.bioexcel.eu/u/carajillu)\
**Post date:** [April 19, 2021, 8:15am UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/5 "2021-04-19T08:15:50Z")

</div>

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).

Thanks

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [April 19, 2021, 1:15pm UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/6 "2021-04-19T13:15:10Z")

</div>

> [@carajillu](#):
>
> 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?).

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

---

<div class="post-metadata">

**Author:** ![carajillu](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/carajillu/32/494_2.png) [@carajillu](https://gromacs.bioexcel.eu/u/carajillu)\
**Post date:** [June 18, 2021, 8:21am UTC](https://gromacs.bioexcel.eu/t/center-solvent-in-the-centre-of-the-box/1632/7 "2021-06-18T08:21:28Z")

</div>

UPDATE  
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.
