# Distance Restraints type 6

**URL:** <https://gromacs.bioexcel.eu/t/distance-restraints-type-6/456>\
**Category:** User discussions\
**Created:** [July 9, 2020, 6:11pm UTC](https://gromacs.bioexcel.eu/t/distance-restraints-type-6/456 "2020-07-09T18:11:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anna](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anna](https://gromacs.bioexcel.eu/u/anna)\
**Post date:** [July 9, 2020, 6:11pm UTC](https://gromacs.bioexcel.eu/t/distance-restraints-type-6/456/1 "2020-07-09T18:11:18Z")

</div>

GROMACS version: version 2020.1  
GROMACS modification: No  
Hi gromacs user!

I am new to gromacs and I am not familiar with the files and sometimes I get a little confused.

I am trying to apply a distance restraint type 6 between an specific ions and some residues of the protein.  
In my system I have different group of molecules. The protein present one \*.itp file and the ions another \*.itp file.

There exist a way to apply the distance restraints not merging the ions in the protein \*.itp file.  
If is possible how can I define the distance\_restraints section? and in which file I have to added?

Inside the protein.itp file I have the distance restraints specified like this:

#ifdef DISRES  
[distance\_restraints]  
atom1 atom2 type dist. between atoms force constant  
2401 21343 6 3.75 0.0 DISRES\_FC  
[…]  
#endif

- For me atom1 = atom index of a protein residue, and atom2 = atom index of the ion

This way an error appears related to the atom index:

ERROR 1 [file PROA.itp, line 105582]:  
Atom index (21343) in distance\_restraints out of bounds (1-10671).  
This probably means that you have inserted topology section  
“distance\_restraints”  
in a part belonging to a different molecule than you intended to.  
In that case move the “distance\_restraints” section to the right molecule.

I take a look at the itp files, and I see that they do not correspond to the atomic index, because the atom index corresponds to the ones defined in the pdb file of the total complex.  
How can I fix it without merging the two type of molecules in one \*.itp file?

It would be grateful if you could help me with this mistake.

Thank you very much in advanced for your help

Regards,

Anna

---

<div class="post-metadata">

**Author:** ![Dr\_DBW](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/dr_dbw/32/42_2.png) [@Dr\_DBW](https://gromacs.bioexcel.eu/u/Dr_DBW)\
**Post date:** [July 13, 2020, 11:31am UTC](https://gromacs.bioexcel.eu/t/distance-restraints-type-6/456/2 "2020-07-13T11:31:10Z")

</div>

Distance restraints have to be contained within the `[moleculetype]` directive/section as noted at [http://manual.gromacs.org/documentation/current/reference-manual/topologies/topology-file-formats.html#id36](http://manual.gromacs.org/documentation/current/reference-manual/topologies/topology-file-formats.html#id36)

Suspect that you are going to have to combine the two together to get that specific functionality.

What exactly is it that you are wanting to do? There may be other ways to achieve it.

---

<div class="post-metadata">

**Author:** ![apandey29](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@apandey29](https://gromacs.bioexcel.eu/u/apandey29)\
**Post date:** [January 5, 2025, 6:11pm UTC](https://gromacs.bioexcel.eu/t/distance-restraints-type-6/456/3 "2025-01-05T18:11:32Z")

</div>

Could you solve this problem??
