Invalid order for directive atomtypes (error)

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

lig.itp

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

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.

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

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.

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