# Protein come out of the box but trjconv command didn't fix the problem

**URL:** <https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851>\
**Category:** User discussions\
**Tags:** mdrun, gmx-trjconv\
**Created:** [March 16, 2022, 9:18pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851 "2022-03-16T21:18:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wintermute](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@wintermute](https://gromacs.bioexcel.eu/u/wintermute)\
**Post date:** [March 16, 2022, 9:18pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/1 "2022-03-16T21:18:24Z")

</div>

GROMACS version: 2019.3  
GROMACS modification: No  
Here post your question

Hi there,

I just realised I didn’t position my protein in the centre of the box at the start so the protein came out of the box and reappeared on the other side, which could be indicated from the rmsd result of my MD run (figure shown below), as told by the postdoc in my group.

 ![RMSD_296K_100ns](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/4/42f08c3d830cdec70a0e96061d38334fa93538a5.png)

I was thinking if I could fix this problem without restarting the whole MD again. I tried to use `gmx trjconv -s md_0_1.tpr -f md_0_1.xtc -o md_0_1_fit-rot_trans.xtc -ur compact -fit rot+trans` to centre the protein and then generate the trajectory files (rmsd.xvg etc.) but didn’t succeed. It just changed its shape:

 ![Screenshot 2022-03-16 at 16.31.52](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/a/ae896b03c3c1c8fa762e8e75e1c0b1a3ad9be93c.jpeg)

I was just wondering do you have any suggestions on how to deal with it?

Many 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 17, 2022, 1:15am UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/2 "2022-03-17T01:15:21Z")

</div>

> [@wintermute](#):
>
> I was thinking if I could fix this problem without restarting the whole MD again. I tried to use `gmx trjconv -s md_0_1.tpr -f md_0_1.xtc -o md_0_1_fit-rot_trans.xtc -ur compact -fit rot+trans` to centre the protein and then generate the trajectory files (rmsd.xvg etc.) but didn’t succeed.

This doesn’t do any centering. If you only have a single protein (not a complex), you can clean everything up (centering and making molecules whole) with `gmx trjconv -center -pbc mol`.

---

<div class="post-metadata">

**Author:** ![wintermute](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@wintermute](https://gromacs.bioexcel.eu/u/wintermute)\
**Post date:** [March 18, 2022, 1:27am UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/3 "2022-03-18T01:27:37Z")

</div>

> [@jalemkul](#):
>
> you can clean everything up (centering and making molecules whole) with `gmx trjconv -center -pbc mol` .

Thank you very much for the reply.

However, sadly it doesn’t work. Maybe I’ve used it in the wrong way, but the RMSD result seemed to have even more spikes. These are the codes I used to centre my protein:

```auto
gmx trjconv -f md_0_1.xtc -s md_0_1.tpr -center -pbc mol

```

Firstly select ‘protein’ and then ‘system’

```auto
Note that major changes are planned in future for trjconv, to improve usability and utility.
Will write xtc: Compressed trajectory (portable xdr format): xtc
Reading file md_0_1.tpr, VERSION 2019.3 (single precision)
Reading file md_0_1.tpr, VERSION 2019.3 (single precision)
Select group for centering
Group 0 ( System) has 130119 elements
Group 1 ( Protein) has 6600 elements
Group 2 ( Protein-H) has 3336 elements
Group 3 ( C-alpha) has 442 elements
Group 4 ( Backbone) has 1326 elements
Group 5 ( MainChain) has 1770 elements
Group 6 ( MainChain+Cb) has 2179 elements
Group 7 ( MainChain+H) has 2192 elements
Group 8 ( SideChain) has 4408 elements
Group 9 ( SideChain-H) has 1566 elements
Group 10 ( Prot-Masses) has 6600 elements
Group 11 ( non-Protein) has 123519 elements
Group 12 ( Water) has 122700 elements
Group 13 ( SOL) has 122700 elements
Group 14 ( non-Water) has 7419 elements
Group 15 ( Ion) has 819 elements
Group 16 ( NA) has 406 elements
Group 17 ( CL) has 413 elements
Group 18 ( Water_and_ions) has 123519 elements
Select a group: 1
Selected 1: 'Protein'
Select group for output
Group 0 ( System) has 130119 elements
Group 1 ( Protein) has 6600 elements
Group 2 ( Protein-H) has 3336 elements
Group 3 ( C-alpha) has 442 elements
Group 4 ( Backbone) has 1326 elements
Group 5 ( MainChain) has 1770 elements
Group 6 ( MainChain+Cb) has 2179 elements
Group 7 ( MainChain+H) has 2192 elements
Group 8 ( SideChain) has 4408 elements
Group 9 ( SideChain-H) has 1566 elements
Group 10 ( Prot-Masses) has 6600 elements
Group 11 ( non-Protein) has 123519 elements
Group 12 ( Water) has 122700 elements
Group 13 ( SOL) has 122700 elements
Group 14 ( non-Water) has 7419 elements
Group 15 ( Ion) has 819 elements
Group 16 ( NA) has 406 elements
Group 17 ( CL) has 413 elements
Group 18 ( Water_and_ions) has 123519 elements
Select a group: 0
Selected 0: 'System'
Reading frame 0 time 0.000   
Precision of md_0_1.xtc is 0.001 (nm)
Using output precision of 0.001 (nm)

Back Off! I just backed up trajout.xtc to ./#trajout.xtc.1#
Last frame 10000 time 100000.000 -> frame 10000 time 100000.000 

```

Then I generated my rmsd file with this:

```auto
gmx rms -s md_0_1.tpr -f md_0_1.xtc -o rmsd.xvg -tu ns

```

Selected “1: protein” in the next two steps.

I don’t know in which step I made some mistakes and just wanna post here in case you have any thoughts. Hope the questions all make sense.

---

<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 18, 2022, 1:48am UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/4 "2022-03-18T01:48:04Z")

</div>

> [@wintermute](#):
>
> `gmx trjconv -f md_0_1.xtc -s md_0_1.tpr -center -pbc mol`

Here, you did not specify an output file with `-o` so you will get the default `trajout.xtc`.

> [@wintermute](#):
>
> `gmx rms -s md_0_1.tpr -f md_0_1.xtc -o rmsd.xvg -tu ns`

Here, you analyzed the old trajectory that you did not center. You should perform the analysis on `trajout.xtc` (or, ideally, something with a more descriptive file name).

---

<div class="post-metadata">

**Author:** ![wintermute](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@wintermute](https://gromacs.bioexcel.eu/u/wintermute)\
**Post date:** [March 23, 2022, 1:44pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/5 "2022-03-23T13:44:44Z")

</div>

Hi,

Thank you very much for the reply.

I followed what you suggested these days but sadly it still didn’t work:  
`gmx rms -s md_0_1.tpr -f trajout.xtc -o rmsd_trajout.xvg -tu ns`

I still got spikes in the RMSD results:

 ![Screenshot 2022-03-23 at 13.35.46](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/e/ec52cd3ba5b0c26033c0f7072c0116132b339489.jpeg)

As indicated in the figure, the spikes are different from the previous figure I posted several days ago. My supervisor suspected it was generated because the protein wasn’t structurally aligned with the before-simulation protein, so I just tried to structurally align my protein to the reference one. These are the commands I’ve used:

`gmx trjconv -s md_0_1.tpr -f md_0_1.xtc -o md_0_1_noPBC.xtc -pbc mol -center` (selecting 1 - Protein and 0 - system to re-center)  
`gmx trjconv -s md_0_1.tpr -f md_0_1_noPBC.xtc -o md_0_1_align.xtc -fit rot+trans` (selecting 1 - Protein and 1 - Protein for output)  
`gmx rms -s md_0_1.tpr -f md_0_1_align.xtc -o rmsd_align.xvg -tu ns` (selecting 1 - Protein and 1 - Protein for output)

I’ve also checked the similar page ([Structural Realignment](https://gromacs.bioexcel.eu/t/structural-realignment/650)) and tried the commands over there but there’re still spikes in my RMSD results as shown above. Now I started to suspect whether the plotting tool I used for generating RMSD was not appropriate. For your information, I used grace ([Grace Home](https://plasma-gate.weizmann.ac.il/Grace/)) to plot my RMSD from the rmsd.xvg file. The postdocs in my group also suspected perhaps the rescheduling of the HPC cluster I was using caused this result, but it’s still the same after I did some replicates.

Any ideas would be greatly appreciated, since I’ve basically tried every possible solution I could get from my group as well as the forum.

Many thanks.

---

<div class="post-metadata">

**Author:** ![wintermute](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@wintermute](https://gromacs.bioexcel.eu/u/wintermute)\
**Post date:** [May 3, 2022, 2:19pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/6 "2022-05-03T14:19:04Z")

</div>

Hi. This problem has already been solved and I would like to post the solution here in case anyone else has the similar problem in the future.

It turned out that I didn’t use ‘-merge’ function when I used pdb2gmx during the protein preparation process. My protein is a Fab domain containing two chains and with [`-merge` function](https://manual.gromacs.org/documentation/current/onlinehelp/gmx-pdb2gmx.html) will the two chains be merged into one moleculetype, only in which way will not the chains split away from each other during the simulation. Then after the simulation, using the `trjconv` nojump and `rot + trans` options to remove translation and rotation of the protein. All is done.

---

<div class="post-metadata">

**Author:** ![squinzanetto](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@squinzanetto](https://gromacs.bioexcel.eu/u/squinzanetto)\
**Post date:** [May 10, 2023, 9:52pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/7 "2023-05-10T21:52:31Z")

</div>

Hi, Mario here. I am new to gromacs, and I have run into such issues, i. e. a dimer that is split during visualization in pymol or vmd. I am wondering if “-pbc nojump” might be enough to visualize the dimer at the centre of the box. I was wondering if “-merge” can alter the md simulation if multiple chains turn into one molecule.  
Thanks if you ever reply

---

<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:** [May 11, 2023, 1:52pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/8 "2023-05-11T13:52:02Z")

</div>

The typical approach is to create an index group for one chain and use `trjconv` to center on it, which will wrap the other chain to it. Simply applying `-pbc nojump` will not fix this case, but `-pbc mol -ur compact -center` usually does if you use this approach.

---

<div class="post-metadata">

**Author:** ![squinzanetto](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@squinzanetto](https://gromacs.bioexcel.eu/u/squinzanetto)\
**Post date:** [May 24, 2023, 10:18am UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/9 "2023-05-24T10:18:55Z")

</div>

sorry to annoy you, but how can one create an index file with a single chain that is not indicated within the .gro files but only in the initial pdb file? I tries to use the option r 1-133 for a single chain, but the number of atoms was higher than that expected

---

<div class="post-metadata">

**Author:** ![Trebuchet](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@Trebuchet](https://gromacs.bioexcel.eu/u/Trebuchet)\
**Post date:** [April 3, 2024, 7:35pm UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/10 "2024-04-03T19:35:18Z")

</div>

you were absolutely right, I made a custom index, centered it and it worked perfectly and solved the problem for all my simulations, I guess working with indexes is really the way to go with rmsds, it is great we have a forum like this

---

<div class="post-metadata">

**Author:** ![mkato](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@mkato](https://gromacs.bioexcel.eu/u/mkato)\
**Post date:** [August 2, 2025, 4:41am UTC](https://gromacs.bioexcel.eu/t/protein-come-out-of-the-box-but-trjconv-command-didnt-fix-the-problem/3851/11 "2025-08-02T04:41:47Z")

</div>

hey wintermute please explain in depth how to go about this problem i am really stuck with this issue for months now
