Make custom specific trajectories

GROMACS version: 2021.3

Hello Gromacs users,

I want to make a sub trajectory for a discontinuous set of frames (based on my own clustering criteria) from the main trajectory. I realize that the gmx trjconv -sub command is not working.
I have an index file with target frames, but which command should I use along with gmx trjconv

Many thanks,

Assuming for some reason you cannot use trjconv -sub (I am not following this forum much so I don’t know why), you can always trjconv -sep -o OUTPUT/frame.pdb, then use a shell script to paste the parts you want. Unfortunately, trjconv -sep doesn’t work with binary files and trjcat doesn’t work with non-binary files since a decade or so.

  • separate the frames: mkdir FRAMES; echo System | $GMX trjconv -f my.xtc -o FRAMES/frame.pdb -s my.tpr -sep
  • join the ones you want (e.g., 0, 1, 5, and 9): cat $(for fr in 0 1 5 9; do echo -n "FRAMES/frame${fr}.pdb "; done) > clust1.pdb

Thank you for your reply; I was wondering is there a simpler way to do this.

What is the difference between -sub vs -fr options under gmx trjconv command?

Is there a reason why Chris’ suggestion is not working for you? It seems to be the answer you need.

@therealchrisneale Thank you, the command gave the expected output!