# Topology file error after adding dihedral

**URL:** <https://gromacs.bioexcel.eu/t/topology-file-error-after-adding-dihedral/9241>\
**Category:** User discussions\
**Tags:** mdp-parameters\
**Created:** [May 28, 2024, 12:58pm UTC](https://gromacs.bioexcel.eu/t/topology-file-error-after-adding-dihedral/9241 "2024-05-28T12:58:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TommasoChemEng](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@TommasoChemEng](https://gromacs.bioexcel.eu/u/TommasoChemEng)\
**Post date:** [May 28, 2024, 12:58pm UTC](https://gromacs.bioexcel.eu/t/topology-file-error-after-adding-dihedral/9241/1 "2024-05-28T12:58:46Z")

</div>

GROMACS version: 2022.5  
GROMACS modification: Plumed

Dear Gromacs users and developers,  
I am trying to add a new residue using OPLS/AA force field.

No problems until I added a custom dihedral angle in the aminoacids.rtp file, like this

[dihedrals]  
C8 N1 C6 O1 dih\_1

In the ffbonded.itp files, I used this syntax to add the parameters:

[dihedraltypes]  
#define dih\_1 3 …

where I added the correct parameters for a RB type dihedral.

When I generate the topology from a pdb using pdb2gmx, the topology file seems to be correct (no error messages about missing parameters for the ff) but this happens:

[dihedrals]  
; ai aj ak al funct  
29 35 45 34 3 dih\_1

The indeces of the atoms and the function are correct, but it includes the definition of the dihedral. When I use grompp to generate the .tpr file, it complains because it finds more parameters than expected.

I cannot find the mistake here.  
Have you some suggestions?

I thank you in advance for your support.

With my best regards,  
Tommaso

---

<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:** [May 29, 2024, 11:24am UTC](https://gromacs.bioexcel.eu/t/topology-file-error-after-adding-dihedral/9241/2 "2024-05-29T11:24:27Z")

</div>

The dihedral type (3 here) should not be part of the #defined variable - it will be inferred from the `.rtp` directive `[bondedtypes]` at the top of the file. So I guess instead of 6 values C0…C6 you’re introducing 7, and that’s what grompp complains about.

---

<div class="post-metadata">

**Author:** ![TommasoChemEng](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@TommasoChemEng](https://gromacs.bioexcel.eu/u/TommasoChemEng)\
**Post date:** [May 31, 2024, 12:50pm UTC](https://gromacs.bioexcel.eu/t/topology-file-error-after-adding-dihedral/9241/3 "2024-05-31T12:50:37Z")

</div>

Thanks for your reply, this solved my problem.
