# Reconstructing a tpr file for subsetting xtc in analysis using GMXPBSA

**URL:** <https://gromacs.bioexcel.eu/t/reconstructing-a-tpr-file-for-subsetting-xtc-in-analysis-using-gmxpbsa/1371>\
**Category:** User discussions\
**Created:** [January 2, 2021, 1:17pm UTC](https://gromacs.bioexcel.eu/t/reconstructing-a-tpr-file-for-subsetting-xtc-in-analysis-using-gmxpbsa/1371 "2021-01-02T13:17:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yyten](https://avatars.discourse-cdn.com/v4/letter/y/839c29/32.png) [@yyten](https://gromacs.bioexcel.eu/u/yyten)\
**Post date:** [January 2, 2021, 1:17pm UTC](https://gromacs.bioexcel.eu/t/reconstructing-a-tpr-file-for-subsetting-xtc-in-analysis-using-gmxpbsa/1371/1 "2021-01-02T13:17:11Z")

</div>

GROMACS version: 2019.6  
GROMACS modification: Yes/No

Happy new year to all!

First of all, my system is a membrane protein system simulate together with a variety of ligands placed randomly in water.

I want to use GMXPBSA to analyze a specific binding site that was predicted with COACH. As such, I tried to subset the binding site and the ligand only for PBSA analysis.

Gromacs from the GMXPBSA script throw this error:

Fatal error:  
Index[116] 146885 is larger than the number of atoms in the  
trajectory file (4616). There is a mismatch in the contents  
of your -f, -s and/or -n files.

My reckoning is that its probably caused by the mismatch with the tpr file and the subsetted trajectory. Therefore, I reconstructed a pdb structure containing only the binding site residue and my ligands. Now the problem is trying to reconstruct the tpr file.

To reconstruct the tpr, I needed another topol.top which I then recreated with pdb2gmx by subsetting out the binding site only as a pdb then add my ligands itp manually into topol.top. However, there is still a missmatch in atom number possibly due to the automated capping of terminals by pdb2gmx. I tried to bypass the capping but pdb2gmx really don’t want you to do so and throw many errors that I could not manually bypass.

What I wanted is really simple, a tpr file that contains only the binding site and ligands. Any help?

Thank you!

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [January 4, 2021, 9:24am UTC](https://gromacs.bioexcel.eu/t/reconstructing-a-tpr-file-for-subsetting-xtc-in-analysis-using-gmxpbsa/1371/2 "2021-01-04T09:24:26Z")

</div>

Hi,  
the error may also occur if you select a group that contains a number of atoms larger than the one in the trajectory.  
If this is the case, you can generate a index file (gmx make\_ndx) with a group in line with your trajectory and what you want to do.  
Best regards  
Alessandra

---

<div class="post-metadata">

**Author:** ![yyten](https://avatars.discourse-cdn.com/v4/letter/y/839c29/32.png) [@yyten](https://gromacs.bioexcel.eu/u/yyten)\
**Post date:** [January 5, 2021, 5:38am UTC](https://gromacs.bioexcel.eu/t/reconstructing-a-tpr-file-for-subsetting-xtc-in-analysis-using-gmxpbsa/1371/3 "2021-01-05T05:38:41Z")

</div>

Dear Alessandra,

Thank you kindly for the help. It was a “D`oh” moment for me. Looks to be working now :)

For the future users who happened to stumble upon my thread looking for answers.

These are the steps that I did to make it work:

1. Generate an index file with the original structure
2. Subset original gro structure using the first index file into second gro structure containing only the subsetted molecules
3. Generate second index file with the second structure
4. Subset original trajectory with first index file
5. Use convert-tpr with first index file to subset the original tpr into new tpr file
6. Use index from step 3, trajectory from step 4 and tpr from step 5 to feed into GMXPBSA
