# Making the .ndx file with the exact numbering with the structure file

**URL:** <https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257>\
**Category:** User discussions\
**Created:** [September 30, 2024, 9:42am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257 "2024-09-30T09:42:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Novaars](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Novaars](https://gromacs.bioexcel.eu/u/Novaars)\
**Post date:** [September 30, 2024, 9:42am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257/1 "2024-09-30T09:42:40Z")

</div>

GROMACS version:2019.6  
GROMACS modification: Yes/No  
Here post your question  
I am encountering an issue while using the GROMACS make\_ndx command to generate an index file (.ndx). The atom numbering in my structure file does not correspond to the numbering in the resulting .ndx file.

For example, in my structure file, the atoms are numbered 1, 5, and 6, while in the .ndx file they are renumbered as 1, 2, and 3.

Could someone please advise on how to use the make\_ndx command to generate an index file with the correct atom numbering? I would greatly appreciate any assistance in resolving this issue.

Thank you for your time.

---

<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:** [October 1, 2024, 7:42am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257/2 "2024-10-01T07:42:10Z")

</div>

What kind of input file are you using? Is the atom numbering sequential in the input file? What selections are you choosing when you run `gmx make_ndx`?

---

<div class="post-metadata">

**Author:** ![Novaars](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Novaars](https://gromacs.bioexcel.eu/u/Novaars)\
**Post date:** [October 2, 2024, 3:42am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257/3 "2024-10-02T03:42:04Z")

</div>

My input file i am using is .pdb file.The atom numbering sequential is in the inpute file.I am not using any selections when running gmx make\_ndx.The code i use is like this :gmx make\_ndx -f input\_file.pdb -o ouput.ndx

---

<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:** [October 2, 2024, 6:10am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257/4 "2024-10-02T06:10:14Z")

</div>

OK. Now I see in your original post that the numbering is not sequential in your input file. I’m sorry that I read too quickly.

No, it’s not possible to keep the atom numbers matching the ones in the pdb file, unless they start from 1 and are sequential. The index file corresponds to the numbering GROMACS uses, i.e. starting from 1 and no gaps. If you want the atoms to match a coordinate file, convert your pdb file into a gro file using, e.g., `gmx editconf`.

---

<div class="post-metadata">

**Author:** ![Novaars](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Novaars](https://gromacs.bioexcel.eu/u/Novaars)\
**Post date:** [October 3, 2024, 7:38am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257/5 "2024-10-03T07:38:40Z")

</div>

“Thank you for your advice. I apologize for the lack of context in my previous request.  
I am aiming to create an index file that will enable me to select specific atoms during the use of the ‘gmx trjconv’ for my ‘.tpr’ and ‘.xtc’ files. Could you please provide any suggestions for this problem?”

---

<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:** [October 3, 2024, 9:20am UTC](https://gromacs.bioexcel.eu/t/making-the-ndx-file-with-the-exact-numbering-with-the-structure-file/10257/6 "2024-10-03T09:20:01Z")

</div>

The numbers in the index file is supposed to be used for selecting the corresponding atoms in `.gro`, `.tpr` and `.xtc` files using GROMACS tools. What you should avoid is comparing the numbers in the index file to the atom numbers in a `.pdb` file.
