# Restrains positions issue of metal ions in protein active site

**URL:** <https://gromacs.bioexcel.eu/t/restrains-positions-issue-of-metal-ions-in-protein-active-site/7548>\
**Category:** User discussions\
**Tags:** mdp-parameters, simulation-setup\
**Created:** [November 4, 2023, 3:36pm UTC](https://gromacs.bioexcel.eu/t/restrains-positions-issue-of-metal-ions-in-protein-active-site/7548 "2023-11-04T15:36:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zahraibt7](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@Zahraibt7](https://gromacs.bioexcel.eu/u/Zahraibt7)\
**Post date:** [November 4, 2023, 3:36pm UTC](https://gromacs.bioexcel.eu/t/restrains-positions-issue-of-metal-ions-in-protein-active-site/7548/1 "2023-11-04T15:36:36Z")

</div>

GROMACS version:2021  
GROMACS modification: Yes/No  
Here post your question  
Hi all,  
I have prepared my metalloprotein-inhibitor model with CHARMM-GUI and need to restrains positions of Zn atoms. I have tried two different methods and got the same error for both of them:

1. Adding these lines into ZN2.itp file in toppar folder:  
#ifdef POSRES\_ZN  
[position\_restraints]  
; i funct fcx fcy fcz  
10952 1 1000 1000 1000  
10953 1 1000 1000 1000  
#endif
2. Adding these lines into topol.top file:  
; Include forcefield parameters  
#include “toppar/forcefield.itp”  
#include “toppar/PROA.itp”  
#include “toppar/ZN2.itp”  
#ifdef POSRES\_ZN  
#include “posre\_zn.itp”  
#endif  
#include “toppar/LHK.itp”  
#include “toppar/SOD.itp”  
#include “toppar/CLA.itp”  
#include “toppar/TIP3.itp”

ERROR 1 [file ZN2.itp, line 22]:  
Atom index (10952) in position\_restraints out of bounds (1-1).  
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.

Any help/suggest will be appreciated  
Bests  
Zahra

---

<div class="post-metadata">

**Author:** ![milosz.wieczor](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@milosz.wieczor](https://gromacs.bioexcel.eu/u/milosz.wieczor)\
**Post date:** [November 5, 2023, 7:26pm UTC](https://gromacs.bioexcel.eu/t/restrains-positions-issue-of-metal-ions-in-protein-active-site/7548/2 "2023-11-05T19:26:56Z")

</div>

Hi Zahra,

Based on the error, it seems that your `ZN2.itp` has just one atom (or perhaps two atoms) defined in the `[atoms]` section following the `[moleculetype]` with zinc ions. In that case, you should use numbering from that `[atoms]` section, so if there are two atoms, use `1` and `2` instead of `10952` and `10953`.

Note that `[atoms]` for each molecule defined in the topology have to have numbering starting with 1, so even if your `ZN2.itp` has different numbers, make sure to renumber it.

(This is all assuming that adding position restraints to zinc atoms only is what you want to do - keep in mind it will restrain them to their spatial location, but other parts of the system will be able to move freely.)

Best,  
MW

---

<div class="post-metadata">

**Author:** ![Zahraibt7](https://avatars.discourse-cdn.com/v4/letter/z/7ea924/32.png) [@Zahraibt7](https://gromacs.bioexcel.eu/u/Zahraibt7)\
**Post date:** [November 6, 2023, 6:00am UTC](https://gromacs.bioexcel.eu/t/restrains-positions-issue-of-metal-ions-in-protein-active-site/7548/3 "2023-11-06T06:00:20Z")

</div>

Dear Milosz,  
Hi. Thank you so much for your reply. I have used the following command line to make posre\_ZN.itp file so 10952 and 10953 are related to Zn atom numbers in .gro file:  
gmx genrestr -f step3\_input.gro -o posre\_ZN.itp -fc 1000 1000 1000

in ZN2.itp there is only one atom:  
[moleculetype]  
; name nrexcl  
ZN2 1

[atoms]  
; nr type resnr residu atom cgnr charge mass  
1 ZN 751 ZN2 ZN 1 2.000000 65.3700 ; qtot 2.0  
So I have changed it to:  
[atoms]  
; nr type resnr residu atom cgnr charge mass  
1 ZN 751 ZN2 ZN 1 2.000000 65.3700 ; qtot 2.0  
2 ZN 752 ZN2 ZN 1 2.000000 65.3700 ; qtot 2.0

#ifdef POSRES\_ZN  
[position\_restraints]  
; i funct fcx fcy fcz  
1 1 1000 1000 1000  
2 1 1000 1000 1000  
#endif

Using above mentioned ZN2.itp, I got this issue at the minimization step:  
Fatal error:  
number of coordinates in coordinate file (step3\_input.gro, 132816)  
does not match topology (topol.top, 132818)

For more information and tips for troubleshooting, please check the GROMACS  
website at [Common Errors — GROMACS webpage https://www.gromacs.org documentation](http://www.gromacs.org/Documentation/Errors)  
Can you please let know how to fix this issue.  
I appreciate your time and consideration  
Bests  
Zahra

---

<div class="post-metadata">

**Author:** ![milosz.wieczor](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@milosz.wieczor](https://gromacs.bioexcel.eu/u/milosz.wieczor)\
**Post date:** [November 6, 2023, 3:53pm UTC](https://gromacs.bioexcel.eu/t/restrains-positions-issue-of-metal-ions-in-protein-active-site/7548/4 "2023-11-06T15:53:11Z")

</div>

Hi Zahra, if your ZN2.itp only had 1 atom, then it could be fine too - the name was ambiguous as there’s a ZN2 residue but that could also be 2x ZN.

Now that you made a `ZN2` molecule that has two atoms in it, your `[system]` directive probably contains this molecule twice, so `grompp` will think there are 2x2 = 4 Zn ions while your `.gro` has only 2. Either decrease the number of `ZN2` molecules in `[system]` or make your `ZN2` with one atom only.
