Reconstructing a tpr file for subsetting xtc in analysis using GMXPBSA

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 which I then recreated with pdb2gmx by subsetting out the binding site only as a pdb then add my ligands itp manually into 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!

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

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