# Make custom specific trajectories

**URL:** <https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684>\
**Category:** User discussions\
**Created:** [August 26, 2022, 1:44pm UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684 "2022-08-26T13:44:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neena](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@Neena](https://gromacs.bioexcel.eu/u/Neena)\
**Post date:** [August 26, 2022, 1:44pm UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684/1 "2022-08-26T13:44:27Z")

</div>

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,  
Neena

---

<div class="post-metadata">

**Author:** ![therealchrisneale](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@therealchrisneale](https://gromacs.bioexcel.eu/u/therealchrisneale)\
**Post date:** [August 26, 2022, 4:57pm UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684/2 "2022-08-26T16:57:33Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![Neena](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@Neena](https://gromacs.bioexcel.eu/u/Neena)\
**Post date:** [August 30, 2022, 1:42am UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684/3 "2022-08-30T01:42:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Neena](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@Neena](https://gromacs.bioexcel.eu/u/Neena)\
**Post date:** [September 2, 2022, 1:00pm UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684/5 "2022-09-02T13:00:35Z")

</div>

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

---

<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:** [September 6, 2022, 7:23pm UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684/7 "2022-09-06T19:23:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Neena](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@Neena](https://gromacs.bioexcel.eu/u/Neena)\
**Post date:** [January 20, 2023, 1:46am UTC](https://gromacs.bioexcel.eu/t/make-custom-specific-trajectories/4684/8 "2023-01-20T01:46:08Z")

</div>

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