# Invalid order for directive atom type

**URL:** <https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atom-type/7294>\
**Category:** User discussions\
**Tags:** simulation-setup\
**Created:** [September 29, 2023, 12:00pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atom-type/7294 "2023-09-29T12:00:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Saeed](https://gromacs.bioexcel.eu/u/Saeed)\
**Post date:** [September 29, 2023, 12:00pm UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atom-type/7294/1 "2023-09-29T12:00:24Z")

</div>

GROMACS version:2023.1  
GROMACS modification: Yes/No

Hi.  
I am almost new to using the Gromacs and sorry If this question is a boring one for you!  
I have two separate itp files for two different molecules from the LigPargen server!  
I used the insert-molecules command and mixed these two molecules together!  
By using the gmx solvate I could get a solvated system (mix\_solvated.gro).  
Now when I want to add ions to this system I get this error:

Last line read:  
‘[atomtypes]’  
Invalid order for directive atomtype

## I checked the two molecules itp files and the topol.top file and I think their orders are fine! Would you please let me know what is the reason for this error?!

## **mix\_solvated.gro** : 1CHO H0J 20 2.094 2.269 2.168 1CHO H0K 21 2.054 2.072 2.352 … 2AcOH O03 25 1.938 1.122 3.416 2AcOH H04 26 2.165 0.945 3.577 … 3SOL OW 30 0.230 0.628 0.113 3SOL HW1 31 0.137 0.626 0.150

**CHO.itp** :

## ; GENERATED BY LigParGen Server ; Jorgensen Lab @ Yale University ; [atomtypes] opls\_810 H810 1.0080 0.000 A 2.50000E-01 1.25520E-01 opls\_802 C802 12.0110 0.000 A 3.50000E-01 2.76144E-01 … [moleculetype] ; Name nrexcl CHO 3

**AcOH.itp** :

[atomtypes]  
opls\_800 C800 12.0110 0.000 A 3.50000E-01 2.76144E-01  
opls\_802 O802 15.9990 0.000 A 2.96000E-01 8.78640E-01  
…

## [moleculetype] ; Name nrexcl AcOH 3 [atoms] ; nr type resnr residue atom cgnr charge mass 1 opls\_800 1 AcOH C00 1 -0.3389 12.0110

**topol.top** :

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

; Include ligand parameters  
#include “CHO.itp”

; Include ligand parameters  
#include “AcOH.itp”

; Include water topology  
#include “oplsaa.ff/spce.itp”

; Include topology for ions  
#include “oplsaa.ff/ions.itp”

[system]  
; Name  
ACH in water

[molecules]  
; Compound #mols  
CHO 1  
AcOH 1  
SOL 3140

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [October 2, 2023, 8:47am UTC](https://gromacs.bioexcel.eu/t/invalid-order-for-directive-atom-type/7294/3 "2023-10-02T08:47:16Z")

</div>

All atomtypes (and all other interaction types) must be defined before the first moleculetype. See, [https://manual.gromacs.org/current/user-guide/run-time-errors.html#invalid-order-for-directive-xxx](https://manual.gromacs.org/current/user-guide/run-time-errors.html#invalid-order-for-directive-xxx).

You have atomtypes in your AcOH.itp file, after the moleculetype specification in CHO.itp

Make sure you set all forcefield parameters before starting to use them (i.e. by specifying moleculetype).
