# How to create two indexes groups using gmx select

**URL:** <https://gromacs.bioexcel.eu/t/how-to-create-two-indexes-groups-using-gmx-select/10035>\
**Category:** User discussions\
**Created:** [August 28, 2024, 11:07pm UTC](https://gromacs.bioexcel.eu/t/how-to-create-two-indexes-groups-using-gmx-select/10035 "2024-08-28T23:07:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredpontes20](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fredpontes20](https://gromacs.bioexcel.eu/u/fredpontes20)\
**Post date:** [August 28, 2024, 11:07pm UTC](https://gromacs.bioexcel.eu/t/how-to-create-two-indexes-groups-using-gmx-select/10035/1 "2024-08-28T23:07:45Z")

</div>

GROMACS version: 2019.6  
GROMACS modification: No

I’m trying to create a bash script to run several analyses in a single execution. My system is a protein embedded in a membrane and create some index files using gmx select as described below:

gmx select -s $tpr -f $gro -select ‘name CA and resid 1 to 250’ -on chain\_A.ndx

In this case, the created index file only have one group. Is it possible to create two indexes group in the same index file using gmx select only one time?  
I’m asking this question because I need to use gmx bundle that request two indexes group for execution that should be provided by an index file.

Thanks in advance,

Fred

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [August 29, 2024, 7:18am UTC](https://gromacs.bioexcel.eu/t/how-to-create-two-indexes-groups-using-gmx-select/10035/2 "2024-08-29T07:18:41Z")

</div>

If you accept using the interactive mode of gmx select, i.e., without the `-select` option, you can do multiple selections before finishing.

You can also combine multiple selection files, e.g.:  
`cat file1.ndx file2.ndx > combined.ndx`

---

<div class="post-metadata">

**Author:** ![fredpontes20](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fredpontes20](https://gromacs.bioexcel.eu/u/fredpontes20)\
**Post date:** [August 29, 2024, 9:35am UTC](https://gromacs.bioexcel.eu/t/how-to-create-two-indexes-groups-using-gmx-select/10035/3 "2024-08-29T09:35:11Z")

</div>

Hi Magnus,  
Thank you so much. It’s so easy that my question seems stupid now. Ask the experts in the gromacs’ forum is always the best alternative.  
Thank you again.
