# Dihedral restraints

**URL:** <https://gromacs.bioexcel.eu/t/dihedral-restraints/1607>\
**Category:** User discussions\
**Created:** [February 17, 2021, 1:07pm UTC](https://gromacs.bioexcel.eu/t/dihedral-restraints/1607 "2021-02-17T13:07:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertc](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@robertc](https://gromacs.bioexcel.eu/u/robertc)\
**Post date:** [February 17, 2021, 1:07pm UTC](https://gromacs.bioexcel.eu/t/dihedral-restraints/1607/1 "2021-02-17T13:07:43Z")

</div>

GROMACS version: 2019.3  
GROMACS modification: No

Hi I’ve got a system in which I’m trying to restrain two dihedrals.

I’ve tried by amending ffbonded.itp of my FF, as follows

[dihedraltypes]  
; ai aj ak al func phi kphi  
a b c d 10 -160 10  
e f c d 10 83 10

I also amended the .rtp file, as well as the topology .itp file accordingly.

When I try to run grompp I get the mysterious errors (the line numbers correspond to the two specified dihedrals in ffbonded.itp)

ERROR 1 [file ffbonded.itp, line 61]:  
Incorrect number of atomtypes for dihedral (4 instead of 2 or 4)

ERROR 2 [file ffbonded.itp, line 62]:  
Incorrect number of atomtypes for dihedral (4 instead of 2 or 4)

I then tried another approach, which was to remove all this from ffbonded.itp, and instead use the following in the topology .itp file itself

[dihedral\_restraints]  
; ai aj ak al funct phi dphi kfac  
2 1 7 8 1 -160 0 1  
16 15 7 8 1 83 0 1

Having had a very good look online I amended the .mdp file too, starting it off with  
define = -DDIHRES  
and adding  
dihre = yes

as they are the only relatively recent posts I could find, even though in the GROMACS 2019 documentation on mdp files, these aren’t mentioned in there at all (they’ve been deprecated?)

Running the equilibration however it’s clear that the dihedral restraints have not worked at all as they are varying widely (between + and - 180).

Any suggestions what I can do to solve this please? I’ve spent days trying to look for anything regarding this, and I’m still no closer to restraining these two dihedrals. Am I missing something? I’ve had a look at the GROMACS documentation multiple times, so if you can not just refer me to that again it would be appreciated, as I can’t find much information on how to implement this.

Thanks,

Robert

---

<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:** [February 17, 2021, 4:42pm UTC](https://gromacs.bioexcel.eu/t/dihedral-restraints/1607/2 "2021-02-17T16:42:24Z")

</div>

Hi Robert,  
You can set “10” for restricted dihedral in place of 1 (see for syntax here [File formats — GROMACS 2021 documentation](https://manual.gromacs.org/current/reference-manual/topologies/topology-file-formats.html) and urea example).

Best regards  
Alessandra

---

<div class="post-metadata">

**Author:** ![robertc](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@robertc](https://gromacs.bioexcel.eu/u/robertc)\
**Post date:** [February 18, 2021, 8:23am UTC](https://gromacs.bioexcel.eu/t/dihedral-restraints/1607/3 "2021-02-18T08:23:42Z")

</div>

Hi Alessandra,

Thanks for your reply, however as I mentioned in my original post, I’ve already done this, as follows, but I also get a very strange error when I do this.

I’ve tried by amending ffbonded.itp of my FF, as follows

[dihedraltypes]  
; ai aj ak al func phi kphi  
a b c d 10 -160 10  
e f c d 10 83 10

I also amended the .rtp file, as well as the topology .itp file accordingly.

When I try to run grompp I get the mysterious errors (the line numbers correspond to the two specified dihedrals in ffbonded.itp)

ERROR 1 [file ffbonded.itp, line 61]:  
Incorrect number of atomtypes for dihedral (4 instead of 2 or 4)

ERROR 2 [file ffbonded.itp, line 62]:  
Incorrect number of atomtypes for dihedral (4 instead of 2 or 4)

---

<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:** [February 19, 2021, 11:30am UTC](https://gromacs.bioexcel.eu/t/dihedral-restraints/1607/4 "2021-02-19T11:30:49Z")

</div>

Hi,  
I meant to have them in the topology file as in the urea example here [File formats — GROMACS 2021 documentation](https://manual.gromacs.org/current/reference-manual/topologies/topology-file-formats.html)  
I know you try to have in the topology file but you had a different sintax of what show in the urea example  
\Alessandra
