# On the creating of new ndx file using gmx select

**URL:** <https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985>\
**Category:** User discussions\
**Created:** [October 20, 2020, 8:55am UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985 "2020-10-20T08:55:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Stoney](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@James\_Stoney](https://gromacs.bioexcel.eu/u/James_Stoney)\
**Post date:** [October 20, 2020, 8:55am UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/1 "2020-10-20T08:55:28Z")

</div>

GROMACS version:2019  
GROMACS modification: No  
Could someone give me some example for gmx select, which could create index file as an output contained centre of mass of the selected residue? For instance I need to specify COM of LiG residue, which I am going to use for another program for calculation (e.g. with gmx cluster that does not support selection in command line)?  
Would it be sufficient to make something like gmx select -f trajectory -s trajectory -select “LIG and COM” -on new\_index.ndx ? I am not sure in this example about selection statement …  
Cheers,

---

<div class="post-metadata">

**Author:** ![Teslim](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Teslim](https://gromacs.bioexcel.eu/u/Teslim)\
**Post date:** [October 20, 2020, 11:45am UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/2 "2020-10-20T11:45:52Z")

</div>

See this link. it may give you more insights into how to go about it.

> **[Tutorials](http://biophysics.med.jhmi.edu/~yliu120/tutorials.html)**

---

<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:** [October 20, 2020, 12:35pm UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/3 "2020-10-20T12:35:17Z")

</div>

The COM of a selection is a point in space, not a set of atoms, so `'com of group "LIG"'` will evaluate to (x,y,z) coordinates, which are intended for use with another expression, e.g. atoms within a radius of that COM position.

To calculate the COM of any selected group, use `gmx traj -ox -com`.

---

<div class="post-metadata">

**Author:** ![cblau](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/cblau/32/5_2.png) [@cblau](https://gromacs.bioexcel.eu/u/cblau)\
**Post date:** [October 21, 2020, 3:36pm UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/4 "2020-10-21T15:36:19Z")

</div>

Also, find some more description of the syntax here:

> **[Selection syntax and usage — GROMACS 2020.4 documentation](http://manual.gromacs.org/current/onlinehelp/selections.html)**

---

<div class="post-metadata">

**Author:** ![James\_Stoney](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@James\_Stoney](https://gromacs.bioexcel.eu/u/James_Stoney)\
**Post date:** [October 22, 2020, 11:27am UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/5 "2020-10-22T11:27:19Z")

</div>

Justin, could you precise probably more accurate selection for gmx select that I can use to evaluate COM, to store it in new ndx file and than to use it with others programs like gmx cluster (to cluster structures based on its COM) or gmx rms (to calculate RMSD based on COM). Probably, for this purpose I need rather another selection of a subset of atoms of residues LIG (within the radius of the COM of this residue) ?  
Thank you in advance!

---

<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:** [October 22, 2020, 12:28pm UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/6 "2020-10-22T12:28:23Z")

</div>

There are several relevant examples if you read the output of `gmx help selections examples`. I’m still not entirely sure I follow what you’re trying to do, but if you want to compute some properties of residues/atoms within some radius around a point in space, there are examples of doing that if you issue the above command.

---

<div class="post-metadata">

**Author:** ![James\_Stoney](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@James\_Stoney](https://gromacs.bioexcel.eu/u/James_Stoney)\
**Post date:** [October 22, 2020, 1:58pm UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/7 "2020-10-22T13:58:30Z")

</div>

> [@jalemkul](#):
>
> gmx help selections examples

Thank you, Justin!  
Actually I am trying to cluster conformations of the ligand from its multi model pdb (obtained from autodock) using gmx cluster. I’ve tested already classic clusterization based on rmsd and would like to compare it (notably, the number of detected clusters) via customization of the atom selection for this ligand ensemble (e.g. to cluster the ensemble based on the COM of the ligand).

Besides I am not sure whether I need to use -fit option for gmx cluster (for any types of clusterization). For example with (-fit) all of my structures felt into the same cluster, whereas with (-fit no) I obtained similar clusterization pattern as it had obserbed in autodock clusterization for same ensemble.

---

<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:** [October 23, 2020, 12:23pm UTC](https://gromacs.bioexcel.eu/t/on-the-creating-of-new-ndx-file-using-gmx-select/985/8 "2020-10-23T12:23:52Z")

</div>

If your results change as a function of `-fit` then the structures really aren’t different aside from being in different absolute coordinates; their internal structures are similar. If that’s the case, separating structures based on their COM position will probably just give you an artificially large number of clusters, because they will simply vary by their absolute location.
