# Atom index Out of bounds

**URL:** <https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627>\
**Category:** User discussions\
**Created:** [August 6, 2020, 10:20am UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627 "2020-08-06T10:20:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumedha](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sumedha](https://gromacs.bioexcel.eu/u/Sumedha)\
**Post date:** [August 6, 2020, 10:20am UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/1 "2020-08-06T10:20:05Z")

</div>

GROMACS version: 5.1.2  
GROMACS modification: Yes/No  
Here post your question  
This is most common error I received while simulating protein dimers. Gromacs error help page says “to look into topol file and check the [moleculetype] section”. Here is my topol file - I tried checking it twice-thrice but couldn’t find error. Kindly help me to figure out what’s wrong in my topol.top file?

;  
; File ‘topol.top’ was generated  
; By user: root (4215)  
; On host: ycn215.en.yuva.param  
; At date: Wed Aug 5 21:32:07 2020

;  
; This is a standalone topology file  
;  
; Created by:  
; :-) GROMACS - gmx pdb2gmx, VERSION 5.1.2 (double precision) (-:  
;   
; Executable: /opt/app/GROMACS/gromacs-5.1.2/bin/gmx\_mpi\_d  
; Data prefix: /opt/app/GROMACS/gromacs-5.1.2  
; Command line:  
; gmx\_mpi\_d pdb2gmx -f 4j72\_New.pdb -o 4j72\_processed.gro -ignh -ter  
; Force field was read from current directory or a relative path - path added.  
;

; Include forcefield parameters  
#include “./charmm36-mar2019.ff/forcefield.itp”

; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
; Include Position restraint file  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#endif

#include “topol\_Protein\_chain\_B.itp”  
; Include Position restraint file  
#ifdef POSRES  
#include “posre\_Protein\_chain\_B.itp”  
#endif

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre.itp”  
#endif

; Include POPE chain topology  
#include “pope.itp”

; Include water topology  
#include “./charmm36-mar2019.ff/tip3p.itp”

#ifdef POSRES\_WATER  
; Position restraint for each water oxygen  
[position\_restraints]  
; i funct fcx fcy fcz  
1 1 1000 1000 1000  
#endif

; Include topology for ions  
#include “./charmm36-mar2019.ff/ions.itp”

[system]  
; Name  
Protein

[molecules]  
; Compound #mols  
Protein\_chain\_A 1  
Protein\_chain\_B 1  
POPE 289

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [August 7, 2020, 8:03am UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/2 "2020-08-07T08:03:22Z")

</div>

Hi,  
could you report which error exactly you got?  
I notice that you have 2 protein chains and POPE lipids in your system, but not water in your topol file. If you have water molecules in your system ( in the structure file, gro or pdb), you should have them also in topol.top file.

Best regards  
Alessandra

---

<div class="post-metadata">

**Author:** ![Sumedha](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sumedha](https://gromacs.bioexcel.eu/u/Sumedha)\
**Post date:** [August 7, 2020, 3:47pm UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/3 "2020-08-07T15:47:41Z")

</div>

Hi Alessandra,  
Thank for the message. As you pointed out, I have done adding POPE lipid to my protein **with**  **Inflategro perl** script. Right after that, I am trying to **minimize** the system so to begin with shrinking. (According to Gromacs tutorials- KALP)

Here is the error I am getting :

Fatal error:  
[file strong\_posre.itp, line 898]:  
Atom index (4781) in position\_restraints out of bounds (1-4779).  
This probably means that you have inserted topology section “position\_restraints”  
in a part belonging to a different molecule than you intended to.  
In that case move the “position\_restraints” section to the right molecule.  
For more information and tips for troubleshooting, please check the GROMACS  
website at [http://www.gromacs.org/Documentation/Errors](http://www.gromacs.org/Documentation/Errors)

Strong posres were added to Chain A.

Thanks,  
Sumedha

---

<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:** [August 7, 2020, 4:43pm UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/4 "2020-08-07T16:43:24Z")

</div>

Did you visit the link in the error message? It directly addresses your situation: [http://www.gromacs.org/Documentation/Errors#Atom\_index\_n\_in\_position\_restraints\_out\_of\_bounds](http://www.gromacs.org/Documentation/Errors#Atom_index_n_in_position_restraints_out_of_bounds)

If you have two chains, you need to have two different restraint files, not one.

---

<div class="post-metadata">

**Author:** ![Sumedha](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sumedha](https://gromacs.bioexcel.eu/u/Sumedha)\
**Post date:** [August 8, 2020, 5:10am UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/5 "2020-08-08T05:10:14Z")

</div>

Yes sir. I have visited the error documentation. Likely, changed my topol file and [molecule section].  
I have two posre.itp files for two chains (“posre\_Protein\_chain\_A.itp” and “posre\_Protein\_chain\_B.itp”). And I have added strong\_posre on Chain A only - file for which is “strong\_posre.itp”.  
I only understood that there is difference in numbering in gro and itp files.  
But how to eliminate this error is still unclear.  
Help would be much appreciated. Thanks in advance

Regards,  
Sumedha

---

<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:** [August 10, 2020, 12:35am UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/6 "2020-08-10T00:35:03Z")

</div>

if `strong_posre.itp` is for chain A, you have placed the `#include` statement in the wrong place, since it follows the topology for chain B. You should instead have:

```
#include “topol_Protein_chain_A.itp”
; Include Position restraint file
#ifdef POSRES
#include “posre_Protein_chain_A.itp”
#endif

; Strong position restraints for InflateGRO
#ifdef STRONG_POSRES
#include “strong_posre.itp”
#endif

#include “topol_Protein_chain_B.itp”
; Include Position restraint file
#ifdef POSRES
#include “posre_Protein_chain_B.itp”
#endif
```

---

<div class="post-metadata">

**Author:** ![Sumedha](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sumedha](https://gromacs.bioexcel.eu/u/Sumedha)\
**Post date:** [August 12, 2020, 6:32am UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/7 "2020-08-12T06:32:28Z")

</div>

Thank you. It worked. i want to place strong posre on chain B too.  
I tried  
; chain A topology  
#include “topol\_Protein\_chain\_A.itp”  
; Include Position restraint file  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#endif  
#ifdef STRONG\_POSRES  
#include “strong\_posre\_A.itp”  
#endif  
; chain B topology  
#include “topol\_Protein\_chain\_B.itp”  
; Include Position restraint file  
#ifdef POSRES  
#include “posre\_Protein\_chain\_B.itp”  
#endif  
#ifdef STRONG\_POSRES  
#include “strong\_posre\_B.itp”  
#endif

But it still gives me error for “Atom index out of bounds”. Should I use define keyword separately for both strong\_posre files in mdp file ?

Thanks,  
Sumedha

---

<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:** [August 12, 2020, 12:26pm UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/8 "2020-08-12T12:26:49Z")

</div>

> [@Sumedha](#):
>
> But it still gives me error for “Atom index out of bounds”. Should I use define keyword separately for both strong\_posre files in mdp file ?

No, what this means is you have generated an incorrect `strong_posre_B.itp` file. You **must** supply `genrestr` with a coordinate file that starts from 1 for any species to be restrained. If you have multiple chains, you have to renumber them in separate coordinate files. This is a major limitation of `genrestr` that people often encounter.

---

<div class="post-metadata">

**Author:** ![Sumedha](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@Sumedha](https://gromacs.bioexcel.eu/u/Sumedha)\
**Post date:** [August 12, 2020, 1:49pm UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/9 "2020-08-12T13:49:27Z")

</div>

Thanks ! Working on it.

---

<div class="post-metadata">

**Author:** ![Fayaz](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@Fayaz](https://gromacs.bioexcel.eu/u/Fayaz)\
**Post date:** [July 22, 2024, 5:35pm UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/10 "2024-07-22T17:35:28Z")

</div>

can u please tell me how u solve the issue … i face also same error

---

<div class="post-metadata">

**Author:** ![scinikhil](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/scinikhil/32/3483_2.png) [@scinikhil](https://gromacs.bioexcel.eu/u/scinikhil)\
**Post date:** [July 22, 2024, 6:57pm UTC](https://gromacs.bioexcel.eu/t/atom-index-out-of-bounds/627/11 "2024-07-22T18:57:01Z")

</div>

@Fayaz start a new thread with details
