# Gmx\_trajectory and dynamic index

**URL:** <https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423>\
**Category:** User discussions\
**Created:** [July 3, 2020, 4:32pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423 "2020-07-03T16:32:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![StephaneA](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@StephaneA](https://gromacs.bioexcel.eu/u/StephaneA)\
**Post date:** [July 3, 2020, 4:32pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/1 "2020-07-03T16:32:42Z")

</div>

GROMACS version: 2018- 2020  
GROMACS modification: NO

Hello,

I am using gmx select to select the water molecules within a given distance from a protein at different time of my simulation and output the corresponding index files. And from this index I would like to output the X,Y and Z coordinates . However I have seen that this not yet possible since the gmx trajectory plot the

" `gmx trajectory` plots coordinates, velocities, and/or forces for provided selections. By default, the X, Y, and Z … For dynamic selections, currently the values are written out for all positions that the selection could select."

Is there a workaround ?

Thank you

Stephane

---

<div class="post-metadata">

**Author:** ![Masrul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/masrul/32/234_2.png) [@Masrul](https://gromacs.bioexcel.eu/u/Masrul)\
**Post date:** [July 3, 2020, 8:39pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/2 "2020-07-03T20:39:18Z")

</div>

I never used ‘gmx select’ , but VMD has dynamics selection for visualization purpose.

---

<div class="post-metadata">

**Author:** ![StephaneA](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@StephaneA](https://gromacs.bioexcel.eu/u/StephaneA)\
**Post date:** [July 5, 2020, 3:39pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/3 "2020-07-05T15:39:09Z")

</div>

Yeah my objective is to obtain the X, Y and Z components for only the selected atoms. I see that it is only It is only possible if you provide a index file already generated with gmx select

Stéphane

---

<div class="post-metadata">

**Author:** ![JulioBarros](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@JulioBarros](https://gromacs.bioexcel.eu/u/JulioBarros)\
**Post date:** [June 11, 2021, 12:31pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/4 "2021-06-11T12:31:18Z")

</div>

Hi StephaneA,  
Did you find a way to do it?

Thank you,  
Júlio

---

<div class="post-metadata">

**Author:** ![StephaneA](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@StephaneA](https://gromacs.bioexcel.eu/u/StephaneA)\
**Post date:** [June 12, 2021, 3:21pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/5 "2021-06-12T15:21:44Z")

</div>

Unfortunately not dynamically. I had to use two steps and two gmx tools in a bash script to use

1. gmx select to obtain a ndx file with the selected water for each frame
2. the gmx trajectory with the ndx file for each frame to obtained the x; y, z coordinates

It was long

Yeah in two steps

1. Using gmx select to obtain a

---

<div class="post-metadata">

**Author:** ![Tijanar](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/tijanar/32/1498_2.png) [@Tijanar](https://gromacs.bioexcel.eu/u/Tijanar)\
**Post date:** [July 1, 2022, 6:42am UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/7 "2022-07-01T06:42:51Z")

</div>

Hello @StephaneA ,  
I want to do a similar analysis for my polymer-solvent system. If you can help me with the use of “gmx select”. My target is to select solvents near polymer walls. I wonder how to give the criteria like \<0.4 nm while extracting solvents.  
Thank you.  
Regards  
Ranajit

---

<div class="post-metadata">

**Author:** ![StephaneA](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@StephaneA](https://gromacs.bioexcel.eu/u/StephaneA)\
**Post date:** [July 1, 2022, 1:14pm UTC](https://gromacs.bioexcel.eu/t/gmx-trajectory-and-dynamic-index/423/8 "2022-07-01T13:14:51Z")

</div>

Hi Tijanar,

gmx select is a powerful tool. You could build an index file where you select for instance only the heavy atoms of your polymer “HEAVY\_POLYMER\_ATOM” this index file with gmx select with the following syntax

gmx select -f myxtc.xtc -s mytpr.tpr -select “resname SOL and name OW within 0.4 of group” “HEAVY\_POLYMER\_ATOM” -on mynew.ndx

see also [Selection syntax and usage — GROMACS 5.1 documentation](https://manual.gromacs.org/documentation/5.1/onlinehelp/selections.html) for syntax

HTH

Stéphane
