# Creating ndx files

**URL:** <https://gromacs.bioexcel.eu/t/creating-ndx-files/4464>\
**Category:** User discussions\
**Created:** [July 14, 2022, 4:22pm UTC](https://gromacs.bioexcel.eu/t/creating-ndx-files/4464 "2022-07-14T16:22:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priya](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@Priya](https://gromacs.bioexcel.eu/u/Priya)\
**Post date:** [July 14, 2022, 4:22pm UTC](https://gromacs.bioexcel.eu/t/creating-ndx-files/4464/1 "2022-07-14T16:22:01Z")

</div>

Hi,

I would like to know is there a gromacs method to create index files (ndx) files showing the atoms of sulfonated carbons and non-sulfonated carbons in the sulfonated polystyrene polymer system.

Thanks,  
Priya

---

<div class="post-metadata">

**Author:** ![TreeLife](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@TreeLife](https://gromacs.bioexcel.eu/u/TreeLife)\
**Post date:** [July 16, 2022, 3:36pm UTC](https://gromacs.bioexcel.eu/t/creating-ndx-files/4464/2 "2022-07-16T15:36:17Z")

</div>

Hi,

Have you tried? gmx make\_ndx  
To my knowledge that the only way to create an index file in gromacs atoms in your system.

On a second thought, are you asking how to define the atoms of your interest for creating groups in index file?

---

<div class="post-metadata">

**Author:** ![ostueker](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/ostueker/32/4918_2.png) [@ostueker](https://gromacs.bioexcel.eu/u/ostueker)\
**Post date:** [July 16, 2022, 8:38pm UTC](https://gromacs.bioexcel.eu/t/creating-ndx-files/4464/3 "2022-07-16T20:38:41Z")

</div>

There is also `gmx select`, which can write index files with the `-on` option, though I’ve never used it myself.

The selection syntax is explained [here](https://manual.gromacs.org/current/onlinehelp/selections.html).

Selecting the sulfonated carbons should work analogous to the first example (selecting oxygen in water):

```auto
resname SOL and name OW

```

Just replace SOL with the residue name of the polystyrene and OW with the atomname of the sultanated carbon.

For the other group you can list the atom names for the other carbons.

Maybe even something like this works:

```auto
resname STYR and type C and not name CS

```

(assuming the residue name is `STYR` and `type C` selects by element and not by atomtype of the forcefield; as I said, I’ve never tried `gmx select)`
