Error "Invalid order for directive defaults"

GROMACS version: 2023
GROMACS modification: No
I am using graphene oxide topology from the ERG research group and successfully generated topology file for my protein using the OPLSAA-ERG (I downloaded from literature). When executing the grompp command I am getting this error
Fatal error:
Syntax error - File forcefield.itp, line 20
Last line read:
‘[ defaults ]’
Invalid order for directive defaults

My topol.top has the following:

; Include Position restraint file
#ifdef POSRES
#include “posre.itp”
#endif

; Include ligand topology
#include “oriented.itp”

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

[ system ]
; Name
VON WILLEBRAND FACTOR

[ molecules ]
; Compound #mols
Protein_chain_A 1
RET 1
SOL 55099

I made some changes to the oriented.itp file and once again I got an error

Fatal error:
number of coordinates in coordinate file (solv.gro, 169013)
does not match topology (topol.top, 171556)
Please help me find the solution.

Could you list out all the commands you used while setting up the system and a screenshot of the full error message? That could help with identifying where the problem might have occurred.

#use -ignh for protein
#Error in generating topology for oriented.pdb (Residue mismatch)
#proceeding with the provided oriented.top and lack.itp
#Topology for protein was generated with the oplsaaerg.ff > topol.top
#C1.gro complex of GO/Protein was prepared using VMD
#Proceeding for newbox with editconf
#gmx editconf -f c1.gro -o newbox.gro -bt dodecahedron -d 1.0
#newbox.gro generated
#Proceeding for solvation with solvate
#gmx solvate -cp newbox.gro -cs spc216.gro -p topol.top -o solv.gro
#solv.gro generated line added to topol.top

Changes made to topol.top

; Include ligand topology
#include "lack.itp"

[ molecules ]
; Compound        #mols
Protein_chain_A     1
RET                 1
SOL             55099

#proceeding for grompp
#gmx grompp -f ions.mdp -c solv.gro -p topol.top -o ions.tpr
#Error [file topol.top, line 11119]: No such molecule type RET

Changes made to topol.top

; Include ligand topology
#include "oriented.itp"

#gmx grompp -f ions.mdp -c solv.gro -p topol.top -o ions.tpr
Error forcefield.itp > Invalid order for directive defaults
Changes made in the oriented.itp
lines deleted

	#include "oplsaaerg.ff/forcefield.itp"
	#include "lack.itp"

	;#ifndef TPPREV_jan17
	;  #error CORRECT VERSION OF FORCE FIELD [TPPREV_jan17] WAS NOT INCLUDED
	;#endif

#gmx grompp -f ions.mdp -c solv.gro -p topol.top -o ions.tpr
Fatal error:
number of coordinates in coordinate file (solv.gro, 169013)
does not match topology (topol.top, 171556)

Regarding the changes to the topol.top file you mention, was the #include “lack.itp” and the #include “oriented.itp” lines only added after the solvate command? To my understanding based on the gromacs tutorial, they should already be in topol.top before the editconf command for generating newbox.gro, could you see if that changes anything?

I followed the commands according to the protein-ligand tutorial. When I checked the number of coordinates error, I found that the difference between solv.gro and topol.top to be 2543 which is exactly the number of atoms in the ligand. I took the ligand, its modified force field (oplsaaerg) and topology files from literature. I generated the topology of the protein using the modified force field.

Your system has a number of major problems - missing parameters, what appears to be duplicated entries for the RET [moleculetype] and a physically impossible net charge, meaning a totally broken topology. I would suggest honestly starting over, because whatever you’re doing to try to fix issues is probably breaking more things.

Note that the original error about the [defaults] directive means you’re trying to #include a topology file that is designed to be a standalone topology, with a complete force field definition within it. That’s what some programs output, but it’s problematic when trying to use that new molecule within the context of another system.

Dear Justin, when I convert the graphene structure to PDB the residue appears to be unavailable in the force field residue database. How do I modify the force field so that it can recognize the graphene structure and generate topology?

You don’t. See my reply to your other post.