# Invalid order for directive atomtypes (error)

**URL:** <https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859>\
**Category:** User discussions\
**Tags:** grompp\
**Created:** [March 18, 2022, 9:19am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859 "2022-03-18T09:19:10Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![merry](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@merry](https://gromacs.bioexcel.eu/u/merry)\
**Post date:** [March 18, 2022, 9:19am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/1 "2022-03-18T09:19:10Z")

</div>

GROMACS version: 2019.4  
GROMACS modification: No  
Here post your question

Hi GMX users,

## In my studied system there are 2 types of small molecules (LIG and POV). I prepared the itp files for them using antechamber module. Topol.top and pov.itp and lig.itp files are as follows:

; Include forcefield parameters  
#include “amber03.ff/forcefield.itp”

[moleculetype]  
; Name nrexcl  
complex 3

; Include pov topology  
#include “pov.itp”

; Include lig topology  
#include “lig.itp”

; Include water topology  
#include “amber03.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 “amber03.ff/ions.itp”

[system]  
; Name  
pov-lig in water

## [molecules] ; Compound #mols LIG 2 POV 2

## [pov.itp](https://drive.google.com/file/d/1ZCGAKiVLs-aqJsAv0H-Cx2HCFvz60MKn/view?usp=sharing)

## [lig.itp](https://drive.google.com/file/d/1nZkqfGDGla1oyNECVLWA_s13pLSasOxr/view?usp=sharing)

After following coommand I encountered with error:  
gmx\_mpi grompp -f em1.mdp -c sol.gro -p topol.top -o em1.tpr

Program: gmx grompp, version 2019.4  
Source file: src/gromacs/gmxpreprocess/topio.cpp (line 607)

## Fatal error: Syntax error - File pov.itp, line 1 Last line read: ‘[atomtypes]’ Invalid order for directive atomtypes

How to fix this issue?

Best,  
Merry

---

<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:** [March 18, 2022, 5:41pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/2 "2022-03-18T17:41:36Z")

</div>

If your ligand topologies both introduce new atom types (or any other force field parameters), you have to collect them and declare those directives before any `[moleculetype]` can be introduced. The entire force field has to be complete before any molecules can be defined. See the Error FAQ page for more information.

---

<div class="post-metadata">

**Author:** ![merry](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@merry](https://gromacs.bioexcel.eu/u/merry)\
**Post date:** [March 19, 2022, 6:30am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/3 "2022-03-19T06:30:30Z")

</div>

## **Dear Justin,** Thanks for your answer. You are right. In first lines of both itp file of my ligands there are [atomtypes]. I collected them and put them in the first lines of topol.top file, as follows:

[atomtypes]  
;name bond\_type mass charge ptype sigma epsilon Amb  
n4 n4 0.00000 0.00000 A 3.25000e-01 7.11280e-01 ; 1.82 0.1700  
p5 p5 0.00000 0.00000 A 3.74177e-01 8.36800e-01 ; 2.10 0.2000  
c3 c3 0.00000 0.00000 A 3.39967e-01 4.57730e-01 ; 1.91 0.1094  
os os 0.00000 0.00000 A 3.00001e-01 7.11280e-01 ; 1.68 0.1700  
o o 0.00000 0.00000 A 2.95992e-01 8.78640e-01 ; 1.66 0.2100  
c c 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860  
c2 c2 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860  
hc hc 0.00000 0.00000 A 2.64953e-01 6.56888e-02 ; 1.49 0.0157  
h1 h1 0.00000 0.00000 A 2.47135e-01 6.56888e-02 ; 1.39 0.0157  
hx hx 0.00000 0.00000 A 1.95998e-01 6.56888e-02 ; 1.10 0.0157  
ha ha 0.00000 0.00000 A 2.59964e-01 6.27600e-02 ; 1.46 0.0150  
h2 h2 0.00000 0.00000 A 2.29317e-01 6.56888e-02 ; 1.29 0.0157  
oh oh 0.00000 0.00000 A 3.06647e-01 8.80314e-01 ; 1.72 0.2104  
ho ho 0.00000 0.00000 A 0.00000e+00 0.00000e+00 ; 0.00 0.0000  
ce ce 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860  
cf cf 0.00000 0.00000 A 3.39967e-01 3.59824e-01 ; 1.91 0.0860

; Include pov topology  
#include “pov.itp”

; Include lig topology  
#include “lig.itp”

; Include water topology  
#include “amber03.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 “amber03.ff/ions.itp”

[system]  
; Name  
pov-lig in water

[molecules]  
; Compound #mols  
POV 2  
LIG 2

* * *

**Now, there is no [atomtypes] in pov.itp and lig.itp and these files starts with:**

[moleculetype]  
;name nrexcl  
POV 3

## [atoms] ; nr type resi res atom cgnr charge mass ; qtot bond\_type 1 n4 1 POV N 1 -0.582801 14.01000 ; qtot -0.583 2 p5 1 POV P 2 1.447798 30.97000 ; qtot 0.865 3 c3 1 POV C1 3 0.159400 12.01000 ; qtot 1.024 . . .

Thus, [atomtypes] is before any [moleculetype]. But I have the same error as before:

## **Fatal error:** Syntax error - File topol.top, line 1 Last line read: ‘[atomtypes]’ Invalid order for directive atomtypes

How to fix it?

Best,  
Merry

---

<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:** [March 21, 2022, 1:23am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/4 "2022-03-21T01:23:26Z")

</div>

The first valid directive in any topology is `[defaults]`, which governs all aspects of the energy function and how topology entries are interpreted. You can either enter this by hand, or, since it appears you are using AMBER ion parameters, just `#include` the parent AMBER force field itself, then declare new `[atomtypes]` and the rest of the topology.

---

<div class="post-metadata">

**Author:** ![merry](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@merry](https://gromacs.bioexcel.eu/u/merry)\
**Post date:** [March 22, 2022, 5:38am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/5 "2022-03-22T05:38:49Z")

</div>

Dear Justin,  
Many thanks for your useful guidance. My problem was solved by including the parent AMBER force field in the topol.top file.

Best,  
Merry

---

<div class="post-metadata">

**Author:** ![juhidutta10](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@juhidutta10](https://gromacs.bioexcel.eu/u/juhidutta10)\
**Post date:** [July 10, 2024, 3:08pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/6 "2024-07-10T15:08:06Z")

</div>

Dear Jalemkul,  
I have been using Gromacs 2021.7. I wanted to simulate two small molecules in water. But, while generating the ions.tpr, I am getting the following error. The topol.top and .itp files for each molecule are given below. Kindly help me out. I am new to Gromacs.

Fatal error:  
Syntax error - File receptor.itp, line 8  
Last line read:  
‘[atomtypes] ’  
Invalid order for directive atomtypes’

My topol.top file looks like below:

; Include forcefield parameters  
#include “charmm27.ff/forcefield.itp”

; Include drg topology  
#include “H2PO4.itp”

; Include lig topolgy  
#include “receptor.itp”

; Include water topology  
#include “charmm27.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 “charmm27.ff/ions.itp”

[system]  
; Name  
System in water

[molecules]  
; Compound #mols  
LIG 1  
DRG 1  
SOL 6436

The two .itp files mentioned for those two molecules are as follows:

H2PO4.itp

[atomtypes]  
; name at.num mass charge ptype sigma epsilon  
PO4 15 30.9738 0.0 A 0.383086 2.447640  
O2CM 8 15.9994 0.0 A 0.302905 0.502080  
OR 8 15.9994 0.0 A 0.315378 0.636386  
HOCO 1 1.0079 0.0 A 0.040001 0.192464

[pairtypes]  
; i j func sigma1-4 epsilon1-4 ; THESE ARE 1-4 INTERACTIONS

[moleculetype]  
; Name nrexcl  
DRG 3

[atoms]  
; nr type resnr resid atom cgnr charge mass  
1 PO4 1 DRG P 1 1.7089 30.9738  
2 O2CM 1 DRG O 2 -0.9718 15.9994  
3 O2CM 1 DRG O1 3 -0.8613 15.9994  
4 OR 1 DRG O2 4 -0.8821 15.9994  
5 OR 1 DRG O3 5 -0.8625 15.9994  
6 HOCO 1 DRG H 6 0.4341 1.0079  
7 HOCO 1 DRG H1 7 0.4347 1.0079

[bonds]  
; ai aj fu b0 kb, b0 kb  
5 6 1 0.09810 445818.6 0.09810 445818.6  
5 1 1 0.16300 315740.5 0.16300 315740.5  
2 1 1 0.15100 499596.4 0.15100 499596.4  
1 3 1 0.15100 499596.4 0.15100 499596.4  
1 4 1 0.16300 315740.5 0.16300 315740.5  
4 7 1 0.09810 445818.6 0.09810 445818.6

[pairs]  
; ai aj fu  
2 7 1  
2 6 1  
3 7 1  
3 6 1  
4 6 1  
5 7 1

[angles]  
; ai aj ak fu th0 kth ub0 kub th0 kth ub0 kub  
2 1 3 1 122.8570 751.56 122.8570 751.56  
2 1 4 1 109.6880 903.91 109.6880 903.91  
2 1 5 1 109.6880 903.91 109.6880 903.91  
3 1 4 1 109.6880 903.91 109.6880 903.91  
3 1 5 1 109.6880 903.91 109.6880 903.91  
4 1 5 1 99.3110 1065.30 99.3110 1065.30  
1 4 7 1 118.5330 365.54 118.5330 365.54  
1 5 6 1 118.5330 365.54 118.5330 365.54

[dihedrals]  
; ai aj ak al fu phi0 kphi mult phi0 kphi mult  
2 1 4 7 9 0.00 -12.3261 1 0.00 -12.3261 1  
2 1 4 7 9 180.00 -6.9705 2 180.00 -6.9705 2  
2 1 4 7 9 0.00 0.6067 3 0.00 0.6067 3  
2 1 5 6 9 0.00 -12.3261 1 0.00 -12.3261 1  
2 1 5 6 9 180.00 -6.9705 2 180.00 -6.9705 2  
2 1 5 6 9 0.00 0.6067 3 0.00 0.6067 3  
3 1 4 7 9 0.00 -12.3261 1 0.00 -12.3261 1  
3 1 4 7 9 180.00 -6.9705 2 180.00 -6.9705 2  
3 1 4 7 9 0.00 0.6067 3 0.00 0.6067 3  
3 1 5 6 9 0.00 -12.3261 1 0.00 -12.3261 1  
3 1 5 6 9 180.00 -6.9705 2 180.00 -6.9705 2  
3 1 5 6 9 0.00 0.6067 3 0.00 0.6067 3  
4 1 5 6 9 0.00 -6.7153 1 0.00 -6.7153 1  
4 1 5 6 9 180.00 -15.9452 2 180.00 -15.9452 2  
4 1 5 6 9 0.00 2.2259 3 0.00 2.2259 3  
5 1 4 7 9 0.00 -6.7153 1 0.00 -6.7153 1  
5 1 4 7 9 180.00 -15.9452 2 180.00 -15.9452 2  
5 1 4 7 9 0.00 2.2259 3 0.00 2.2259 3

[dihedrals]  
; ai aj ak al fu xi0 kxi xi0 kxi  
1 4 5 2 2 0.00 0.0000 0.00 0.0000  
1 2 5 3 2 0.00 0.0000 0.00 0.0000

#ifdef POSRES\_LIGAND  
[position\_restraints]  
; atom type fx fy fz  
1 1 1000 1000 1000  
…  
#endif

receptor.itp

[atomtypes]  
; name at.num mass charge ptype sigma epsilon  
CB 6 12.0110 0.0 A 0.355005 0.292880  
O=C 8 15.9994 0.0 A 0.302905 0.502080  
CE4R 6 12.0110 0.0 A 0.370614 0.284512  
C=O 6 12.0110 0.0 A 0.356359 0.460240  
NC=C 7 14.0067 0.0 A 0.329632 0.836800  
HNCO 1 1.0079 0.0 A 0.040001 0.192464  
CR 6 12.0110 0.0 A 0.387541 0.230120  
HCMM 1 1.0079 0.0 A 0.235197 0.092048  
NC=O 7 14.0067 0.0 A 0.329632 0.836800

[pairtypes]  
; i j func sigma1-4 epsilon1-4 ; THESE ARE 1-4 INTERACTIONS  
O=C CB 1 0.302228 0.383470  
O=C O=C 1 0.249452 0.502080  
O=C CE4R 1 0.310033 0.377952  
O=C C=O 1 0.302905 0.480705  
O=C NC=C 1 0.289542 0.648182  
O=C HNCO 1 0.144726 0.310857  
O=C CR 1 0.293997 0.144938  
O=C HCMM 1 0.242324 0.214978  
O=C NC=O 1 0.289542 0.648182  
CR CB 1 0.346773 0.110698  
CR CE4R 1 0.354578 0.109105  
CR C=O 1 0.347450 0.138768  
CR NC=C 1 0.334087 0.187114  
CR HNCO 1 0.189271 0.089737  
CR CR 1 0.338541 0.041840  
CR HCMM 1 0.286869 0.062059  
CR NC=O 1 0.334087 0.187114

[moleculetype]  
; Name nrexcl  
LIG 3

[atoms]  
; nr type resnr resid atom cgnr charge mass  
1 CB 1 LIG C10 1 -0.1435 12.0110  
2 CB 1 LIG C11 2 -0.1500 12.0110  
3 CB 1 LIG C12 3 -0.1500 12.0110  
4 CB 1 LIG C13 4 -0.1500 12.0110  
5 CB 1 LIG C14 5 -0.1500 12.0110  
6 CB 1 LIG C15 6 -0.1500 12.0110  
7 CB 1 LIG C16 7 -0.1435 12.0110  
8 CB 1 LIG C17 8 -0.1500 12.0110  
9 CB 1 LIG C18 9 -0.1500 12.0110  
10 CB 1 LIG C19 10 -0.1500 12.0110  
11 CB 1 LIG C20 11 -0.1500 12.0110  
12 CB 1 LIG C21 12 -0.1500 12.0110  
13 O=C 1 LIG O 13 -0.5700 15.9994  
14 O=C 1 LIG O1 14 -0.5700 15.9994  
15 CE4R 1 LIG C 15 0.0270 12.0110  
16 CE4R 1 LIG C1 16 0.0270 12.0110  
17 C=O 1 LIG C2 17 0.6410 12.0110  
18 C=O 1 LIG C3 18 0.6410 12.0110  
19 NC=C 1 LIG N 19 -0.8671 14.0067  
20 NC=C 1 LIG N1 20 -0.8671 14.0067  
21 HNCO 1 LIG H 21 0.4000 1.0079  
22 HNCO 1 LIG H1 22 0.4000 1.0079  
23 CR 1 LIG C4 23 0.4301 12.0110  
24 CR 1 LIG C5 24 0.3691 12.0110  
25 HCMM 1 LIG H2 25 0.0000 1.0079  
26 HCMM 1 LIG H3 26 0.0000 1.0079  
27 HCMM 1 LIG H4 27 0.0000 1.0079  
28 C=O 1 LIG C6 28 0.5690 12.0110  
29 CR 1 LIG C7 29 0.3001 12.0110  
30 O=C 1 LIG O2 30 -0.5700 15.9994  
31 NC=O 1 LIG N2 31 -0.7301 14.0067  
32 HNCO 1 LIG H5 32 0.3700 1.0079  
33 CR 1 LIG C8 33 0.1435 12.0110  
34 CR 1 LIG C9 34 0.1435 12.0110  
35 HCMM 1 LIG H6 35 0.0000 1.0079  
36 HCMM 1 LIG H7 36 0.0000 1.0079  
37 HCMM 1 LIG H8 37 0.0000 1.0079  
38 HCMM 1 LIG H9 38 0.0000 1.0079  
39 HCMM 1 LIG H10 39 0.1500 1.0079  
40 HCMM 1 LIG H11 40 0.1500 1.0079  
41 HCMM 1 LIG H12 41 0.1500 1.0079  
42 HCMM 1 LIG H13 42 0.1500 1.0079  
43 HCMM 1 LIG H14 43 0.1500 1.0079  
44 HCMM 1 LIG H15 44 0.1500 1.0079  
45 HCMM 1 LIG H16 45 0.1500 1.0079  
46 HCMM 1 LIG H17 46 0.1500 1.0079  
47 HCMM 1 LIG H18 47 0.1500 1.0079  
48 HCMM 1 LIG H19 48 0.1500 1.0079  
49 HCMM 1 LIG H20 49 0.0000 1.0079  
50 C=O 1 LIG C22 50 0.5690 12.0110  
51 O=C 1 LIG O3 51 -0.5700 15.9994  
52 CR 1 LIG C23 52 0.0610 12.0110  
53 HCMM 1 LIG H21 53 0.0000 1.0079  
54 HCMM 1 LIG H22 54 0.0000 1.0079  
55 HCMM 1 LIG H23 55 0.0000 1.0079  
56 NC=O 1 LIG N3 56 -0.7301 14.0067  
57 HNCO 1 LIG H24 57 0.3700 1.0079  
58 CR 1 LIG C24 58 0.3001 12.0110  
59 HCMM 1 LIG H25 59 0.0000 1.0079  
60 HCMM 1 LIG H26 60 0.0000 1.0079  
61 HCMM 1 LIG H27 61 -0.0000 1.0079

[bonds]  
; ai aj fu b0 kb, b0 kb  
41 4 1 0.10840 319534.6 0.10840 319534.6  
…

[pairs]  
; ai aj fu  
1 6 1  
1 41 1  
…

[angles]  
; ai aj ak fu th0 kth ub0 kub th0 kth ub0 kub  
2 1 3 1 119.9770 402.88 119.9770 402.88  
…

[dihedrals]  
; ai aj ak al fu phi0 kphi mult phi0 kphi mult  
1 2 4 6 9 180.00 14.6440 2 180.00 14.6440 2  
…

[dihedrals]  
; ai aj ak al fu xi0 kxi xi0 kxi  
1 3 34 2 2 0.00 24.0915 0.00 24.0915  
…

#ifdef POSRES\_LIGAND  
[position\_restraints]  
; atom type fx fy fz  
1 1 1000 1000 1000  
…  
#endif

---

<div class="post-metadata">

**Author:** ![juhidutta10](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@juhidutta10](https://gromacs.bioexcel.eu/u/juhidutta10)\
**Post date:** [July 19, 2024, 6:45am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/7 "2024-07-19T06:45:59Z")

</div>

[quote=“juhidutta10, post:6, topic:3859”]  
I have been using Gromacs 2021.7. I wanted to simulate two small molecules in water. But, while generating the ions.tpr, I am getting the following error. The topol.top and .itp files for each molecule are given below. Kindly help me out. I am new to Gromacs. Also, I want to mention, I have tried all of your solutions, mentioned in the discussion. But nothing was fruitful.

Fatal error:  
Syntax error - File receptor.itp, line 8  
Last line read:  
‘[atomtypes] ’  
Invalid order for directive atomtypes’

My topol.top file looks like below:

; Include forcefield parameters  
#include “charmm27.ff/forcefield.itp”

; Include drg topology  
#include “H2PO4.itp”

; Include lig topolgy  
#include “receptor.itp”

; Include water topology  
#include “charmm27.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 “charmm27.ff/ions.itp”

[system]  
; Name  
System in water

[molecules]  
; Compound #mols  
LIG 1  
DRG 1  
SOL 6436

The two .itp files mentioned for those two molecules are as follows:

H2PO4.itp

[atomtypes]  
; name at.num mass charge ptype sigma epsilon  
PO4 15 30.9738 0.0 A 0.383086 2.447640  
O2CM 8 15.9994 0.0 A 0.302905 0.502080  
OR 8 15.9994 0.0 A 0.315378 0.636386  
HOCO 1 1.0079 0.0 A 0.040001 0.192464

[pairtypes]  
; i j func sigma1-4 epsilon1-4 ; THESE ARE 1-4 INTERACTIONS

[moleculetype]  
; Name nrexcl  
DRG 3

[atoms]  
; nr type resnr resid atom cgnr charge mass  
1 PO4 1 DRG P 1 1.7089 30.9738  
2 O2CM 1 DRG O 2 -0.9718 15.9994  
3 O2CM 1 DRG O1 3 -0.8613 15.9994  
4 OR 1 DRG O2 4 -0.8821 15.9994  
5 OR 1 DRG O3 5 -0.8625 15.9994  
6 HOCO 1 DRG H 6 0.4341 1.0079  
7 HOCO 1 DRG H1 7 0.4347 1.0079

[bonds]  
; ai aj fu b0 kb, b0 kb  
5 6 1 0.09810 445818.6 0.09810 445818.6  
5 1 1 0.16300 315740.5 0.16300 315740.5  
2 1 1 0.15100 499596.4 0.15100 499596.4  
1 3 1 0.15100 499596.4 0.15100 499596.4  
1 4 1 0.16300 315740.5 0.16300 315740.5  
4 7 1 0.09810 445818.6 0.09810 445818.6

[pairs]  
; ai aj fu  
2 7 1  
2 6 1  
3 7 1  
3 6 1  
4 6 1  
5 7 1

[angles]  
; ai aj ak fu th0 kth ub0 kub th0 kth ub0 kub  
2 1 3 1 122.8570 751.56 122.8570 751.56  
2 1 4 1 109.6880 903.91 109.6880 903.91  
2 1 5 1 109.6880 903.91 109.6880 903.91  
3 1 4 1 109.6880 903.91 109.6880 903.91  
3 1 5 1 109.6880 903.91 109.6880 903.91  
4 1 5 1 99.3110 1065.30 99.3110 1065.30  
1 4 7 1 118.5330 365.54 118.5330 365.54  
1 5 6 1 118.5330 365.54 118.5330 365.54

[dihedrals]  
; ai aj ak al fu phi0 kphi mult phi0 kphi mult  
2 1 4 7 9 0.00 -12.3261 1 0.00 -12.3261 1  
2 1 4 7 9 180.00 -6.9705 2 180.00 -6.9705 2  
2 1 4 7 9 0.00 0.6067 3 0.00 0.6067 3  
2 1 5 6 9 0.00 -12.3261 1 0.00 -12.3261 1  
2 1 5 6 9 180.00 -6.9705 2 180.00 -6.9705 2  
2 1 5 6 9 0.00 0.6067 3 0.00 0.6067 3  
3 1 4 7 9 0.00 -12.3261 1 0.00 -12.3261 1  
3 1 4 7 9 180.00 -6.9705 2 180.00 -6.9705 2  
3 1 4 7 9 0.00 0.6067 3 0.00 0.6067 3  
3 1 5 6 9 0.00 -12.3261 1 0.00 -12.3261 1  
3 1 5 6 9 180.00 -6.9705 2 180.00 -6.9705 2  
3 1 5 6 9 0.00 0.6067 3 0.00 0.6067 3  
4 1 5 6 9 0.00 -6.7153 1 0.00 -6.7153 1  
4 1 5 6 9 180.00 -15.9452 2 180.00 -15.9452 2  
4 1 5 6 9 0.00 2.2259 3 0.00 2.2259 3  
5 1 4 7 9 0.00 -6.7153 1 0.00 -6.7153 1  
5 1 4 7 9 180.00 -15.9452 2 180.00 -15.9452 2  
5 1 4 7 9 0.00 2.2259 3 0.00 2.2259 3

[dihedrals]  
; ai aj ak al fu xi0 kxi xi0 kxi  
1 4 5 2 2 0.00 0.0000 0.00 0.0000  
1 2 5 3 2 0.00 0.0000 0.00 0.0000

#ifdef POSRES\_LIGAND  
[position\_restraints]  
; atom type fx fy fz  
1 1 1000 1000 1000  
…  
#endif

receptor.itp

[atomtypes]  
; name at.num mass charge ptype sigma epsilon  
CB 6 12.0110 0.0 A 0.355005 0.292880  
O=C 8 15.9994 0.0 A 0.302905 0.502080  
CE4R 6 12.0110 0.0 A 0.370614 0.284512  
C=O 6 12.0110 0.0 A 0.356359 0.460240  
NC=C 7 14.0067 0.0 A 0.329632 0.836800  
HNCO 1 1.0079 0.0 A 0.040001 0.192464  
CR 6 12.0110 0.0 A 0.387541 0.230120  
HCMM 1 1.0079 0.0 A 0.235197 0.092048  
NC=O 7 14.0067 0.0 A 0.329632 0.836800

[pairtypes]  
; i j func sigma1-4 epsilon1-4 ; THESE ARE 1-4 INTERACTIONS  
O=C CB 1 0.302228 0.383470  
O=C O=C 1 0.249452 0.502080  
O=C CE4R 1 0.310033 0.377952  
O=C C=O 1 0.302905 0.480705  
O=C NC=C 1 0.289542 0.648182  
O=C HNCO 1 0.144726 0.310857  
O=C CR 1 0.293997 0.144938  
O=C HCMM 1 0.242324 0.214978  
O=C NC=O 1 0.289542 0.648182  
CR CB 1 0.346773 0.110698  
CR CE4R 1 0.354578 0.109105  
CR C=O 1 0.347450 0.138768  
CR NC=C 1 0.334087 0.187114  
CR HNCO 1 0.189271 0.089737  
CR CR 1 0.338541 0.041840  
CR HCMM 1 0.286869 0.062059  
CR NC=O 1 0.334087 0.187114

[moleculetype]  
; Name nrexcl  
LIG 3

[atoms]  
; nr type resnr resid atom cgnr charge mass  
1 CB 1 LIG C10 1 -0.1435 12.0110  
2 CB 1 LIG C11 2 -0.1500 12.0110  
3 CB 1 LIG C12 3 -0.1500 12.0110  
4 CB 1 LIG C13 4 -0.1500 12.0110  
5 CB 1 LIG C14 5 -0.1500 12.0110  
6 CB 1 LIG C15 6 -0.1500 12.0110  
7 CB 1 LIG C16 7 -0.1435 12.0110  
8 CB 1 LIG C17 8 -0.1500 12.0110  
9 CB 1 LIG C18 9 -0.1500 12.0110  
10 CB 1 LIG C19 10 -0.1500 12.0110  
11 CB 1 LIG C20 11 -0.1500 12.0110  
12 CB 1 LIG C21 12 -0.1500 12.0110  
13 O=C 1 LIG O 13 -0.5700 15.9994  
14 O=C 1 LIG O1 14 -0.5700 15.9994  
15 CE4R 1 LIG C 15 0.0270 12.0110  
16 CE4R 1 LIG C1 16 0.0270 12.0110  
17 C=O 1 LIG C2 17 0.6410 12.0110  
18 C=O 1 LIG C3 18 0.6410 12.0110  
19 NC=C 1 LIG N 19 -0.8671 14.0067  
20 NC=C 1 LIG N1 20 -0.8671 14.0067  
21 HNCO 1 LIG H 21 0.4000 1.0079  
22 HNCO 1 LIG H1 22 0.4000 1.0079  
23 CR 1 LIG C4 23 0.4301 12.0110  
24 CR 1 LIG C5 24 0.3691 12.0110  
25 HCMM 1 LIG H2 25 0.0000 1.0079  
26 HCMM 1 LIG H3 26 0.0000 1.0079  
27 HCMM 1 LIG H4 27 0.0000 1.0079  
28 C=O 1 LIG C6 28 0.5690 12.0110  
29 CR 1 LIG C7 29 0.3001 12.0110  
30 O=C 1 LIG O2 30 -0.5700 15.9994  
31 NC=O 1 LIG N2 31 -0.7301 14.0067  
32 HNCO 1 LIG H5 32 0.3700 1.0079  
33 CR 1 LIG C8 33 0.1435 12.0110  
34 CR 1 LIG C9 34 0.1435 12.0110  
35 HCMM 1 LIG H6 35 0.0000 1.0079  
36 HCMM 1 LIG H7 36 0.0000 1.0079  
37 HCMM 1 LIG H8 37 0.0000 1.0079  
38 HCMM 1 LIG H9 38 0.0000 1.0079  
39 HCMM 1 LIG H10 39 0.1500 1.0079  
40 HCMM 1 LIG H11 40 0.1500 1.0079  
41 HCMM 1 LIG H12 41 0.1500 1.0079  
42 HCMM 1 LIG H13 42 0.1500 1.0079  
43 HCMM 1 LIG H14 43 0.1500 1.0079  
44 HCMM 1 LIG H15 44 0.1500 1.0079  
45 HCMM 1 LIG H16 45 0.1500 1.0079  
46 HCMM 1 LIG H17 46 0.1500 1.0079  
47 HCMM 1 LIG H18 47 0.1500 1.0079  
48 HCMM 1 LIG H19 48 0.1500 1.0079  
49 HCMM 1 LIG H20 49 0.0000 1.0079  
50 C=O 1 LIG C22 50 0.5690 12.0110  
51 O=C 1 LIG O3 51 -0.5700 15.9994  
52 CR 1 LIG C23 52 0.0610 12.0110  
53 HCMM 1 LIG H21 53 0.0000 1.0079  
54 HCMM 1 LIG H22 54 0.0000 1.0079  
55 HCMM 1 LIG H23 55 0.0000 1.0079  
56 NC=O 1 LIG N3 56 -0.7301 14.0067  
57 HNCO 1 LIG H24 57 0.3700 1.0079  
58 CR 1 LIG C24 58 0.3001 12.0110  
59 HCMM 1 LIG H25 59 0.0000 1.0079  
60 HCMM 1 LIG H26 60 0.0000 1.0079  
61 HCMM 1 LIG H27 61 -0.0000 1.0079

[bonds]  
; ai aj fu b0 kb, b0 kb  
41 4 1 0.10840 319534.6 0.10840 319534.6  
…

[pairs]  
; ai aj fu  
1 6 1  
1 41 1  
…

[angles]  
; ai aj ak fu th0 kth ub0 kub th0 kth ub0 kub  
2 1 3 1 119.9770 402.88 119.9770 402.88  
…

[dihedrals]  
; ai aj ak al fu phi0 kphi mult phi0 kphi mult  
1 2 4 6 9 180.00 14.6440 2 180.00 14.6440 2  
…

[dihedrals]  
; ai aj ak al fu xi0 kxi xi0 kxi  
1 3 34 2 2 0.00 24.0915 0.00 24.0915  
…

#ifdef POSRES\_LIGAND  
[position\_restraints]  
; atom type fx fy fz  
1 1 1000 1000 1000  
…  
#endif

---

<div class="post-metadata">

**Author:** ![zhq](https://avatars.discourse-cdn.com/v4/letter/z/ecd19e/32.png) [@zhq](https://gromacs.bioexcel.eu/u/zhq)\
**Post date:** [November 18, 2024, 11:18am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/8 "2024-11-18T11:18:33Z")

</div>

Hey dear friend，according to your first issue about mismatching coordinate and topology files，I got the same error. I appreciate knowing your answer.

---

<div class="post-metadata">

**Author:** ![sizhe\_Li](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sizhe\_Li](https://gromacs.bioexcel.eu/u/sizhe_Li)\
**Post date:** [December 17, 2024, 12:32pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/9 "2024-12-17T12:32:15Z")

</div>

The same question, I’m using the Amber to generate two proteins’ top gro and itp，but it only shows：  
[position\_restraints]  
; atom type fx fy fz  
in itp documents  
May it be possible to tell how to integrate the content of the two proteins in the top file to make the support run.  
I was trying to break the complex to AB chains in pymol. Then I executed pdb2gmx, editconf, and solvate for the two proteins, but when grompp it show me the error. The force field I used is AMBER99SB-ILDN.  
Here is part of my itp file:  
protein\_A:  
; In this topology include file, you will find position restraint  
; entries for all the heavy atoms in your original pdb file.  
; This means that all the protons which were added by pdb2gmx are  
; not restrained.

[position\_restraints]  
; atom type fx fy fz  
1 1 1000 1000 1000  
5 1 1000 1000 1000  
7 1 1000 1000 1000

11779 1 1000 1000 1000  
11780 1 1000 1000 1000  
protein\_B:  
; In this topology include file, you will find position restraint  
; entries for all the heavy atoms in your original pdb file.  
; This means that all the protons which were added by pdb2gmx are  
; not restrained.

[position\_restraints]  
; atom type fx fy fz  
1 1 1000 1000 1000  
5 1 1000 1000 1000  
7 1 1000 1000 1000  
5463 1 1000 1000 1000  
5464 1 1000 1000 1000  
And i contact my top.top :  
; Command line:  
; gmx pdb2gmx -f …/Roq1-pdb.pdb -o Roq1.gro  
; Force field was read from the standard GROMACS share directory.

; Include forcefield parameters  
#include “amber99sb-ildn.ff/forcefield.itp”

[moleculetype]  
; Name nrexcl  
Protein\_chain\_A 3

[atoms]  
; nr type resnr residue atom cgnr charge mass typeB chargeB massB  
; residue 526 ILE rtp NILE q +1.0  
1 N3 526 ILE N 1 0.0311 14.01  
2 H 526 ILE H1 2 0.2329 1.008  
3 H 526 ILE H2 3 0.2329 1.008  
4 H 526 ILE H3 4 0.2329 1.008  
5 CT 526 ILE CA 5 0.0257 12.01

```auto
[bonds]

[angles]
[pairs]

[angles]
[dihedrals]

[dihedrals]
; Include Position restraint file
#ifdef POSRES
#include “proteinA.itp”
#endif

; Include water topology
#include “amber99sb-ildn.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 “amber99sb-ildn.ff/ions.itp”

[moleculetype]
; Name nrexcl
Protein_chain_B 3
[atoms]
; nr type resnr residue atom cgnr charge mass typeB chargeB massB
; residue 89 LEU rtp NLEU q +1.0
1 N3 89 LEU N 1 0.101 14.01
2 H 89 LEU H1 2 0.2148 1.008
3 H 89 LEU H2 3 0.2148 1.008

```

[bonds]

[angles]  
[pairs]

[angles]  
[dihedrals]

[dihedrals]  
; Protein Position restraint file  
#ifdef POSRES  
#include “ProteinB.itp”  
#endif

; Include water topology  
#include “amber99sb-ildn.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 “amber99sb-ildn.ff/ions.itp”

[system]  
; Name  
Protein in water

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

---

<div class="post-metadata">

**Author:** ![sizhe\_Li](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sizhe\_Li](https://gromacs.bioexcel.eu/u/sizhe_Li)\
**Post date:** [December 17, 2024, 1:55pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/10 "2024-12-17T13:55:32Z")

</div>

Hello, have you solved the problem yet?I don t include atomtypes in itp. How can you generate this item?

---

<div class="post-metadata">

**Author:** ![sizhe\_Li](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sizhe\_Li](https://gromacs.bioexcel.eu/u/sizhe_Li)\
**Post date:** [December 17, 2024, 1:56pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/11 "2024-12-17T13:56:12Z")

</div>

The same

---

<div class="post-metadata">

**Author:** ![juhidutta10](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@juhidutta10](https://gromacs.bioexcel.eu/u/juhidutta10)\
**Post date:** [December 20, 2024, 6:55am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/12 "2024-12-20T06:55:58Z")

</div>

Hi,  
I use SwissParam to generate the .itp files for small molecules.

---

<div class="post-metadata">

**Author:** ![sizhe\_Li](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sizhe\_Li](https://gromacs.bioexcel.eu/u/sizhe_Li)\
**Post date:** [December 24, 2024, 3:23am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/13 "2024-12-24T03:23:07Z")

</div>

Well, I try to generate protein’s itp, it seems different

---

<div class="post-metadata">

**Author:** ![juhidutta10](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@juhidutta10](https://gromacs.bioexcel.eu/u/juhidutta10)\
**Post date:** [December 24, 2024, 4:19am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/14 "2024-12-24T04:19:58Z")

</div>

I was talking about small molecules.

---

<div class="post-metadata">

**Author:** ![shatabdi](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shatabdi](https://gromacs.bioexcel.eu/u/shatabdi)\
**Post date:** [January 6, 2025, 4:11pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/15 "2025-01-06T16:11:26Z")

</div>

[topol.top](https://gromacs.bioexcel.eu/uploads/short-url/lkhwbZ4BNSkBdNqREoZwU2AZgj1.top) (703.1 KB)

 ![Screenshot 2025-01-06 204748](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/a/ac155948d35716a50c7fedd641c7082df713b093.png)  
Hello Juhi, Can you help me with this error?

---

<div class="post-metadata">

**Author:** ![juhidutta10](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@juhidutta10](https://gromacs.bioexcel.eu/u/juhidutta10)\
**Post date:** [January 7, 2025, 4:37am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/16 "2025-01-07T04:37:01Z")

</div>

Hi Shatabdi,  
From the topol.top I found that you have put the ligand topology after the protein topology. I always put it before protein to avoid this error. It will define the atom types of the ligand at the beginning.

---

<div class="post-metadata">

**Author:** ![shatabdi](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shatabdi](https://gromacs.bioexcel.eu/u/shatabdi)\
**Post date:** [January 8, 2025, 9:58am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/17 "2025-01-08T09:58:09Z")

</div>

Thank you, Juhi.

---

<div class="post-metadata">

**Author:** ![asim.rs](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@asim.rs](https://gromacs.bioexcel.eu/u/asim.rs)\
**Post date:** [January 13, 2025, 12:11pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atomtypes-error/3859/18 "2025-01-13T12:11:56Z")

</div>

Dear Juhi,  
For multi-ligand simulation I am also using swissparam for topology preparation for ligands. The error i get is the smae like you, I have tried by changing atomtypes box and incorporate ino .top file. But in the end I get the same result as previous. I am very curious to learn multiligand simulation. Please help me by giving the path by which enthusiast like me can solve this problem, eagerly waiting for your reply. Thank You.
