Unable to Simulate Two Ligands Simulateously

GROMACS version: 2022.4
GROMACS modification: No

Here is an issue I’ve had with Gromacs for almost 15 years. Running two ligands with a protein, simultaneously, is an absolutely miserable experience. Normally I bounce and use NAMD, which makes this a cakewalk. To parameterize the small molecules I use acpype, which for a single ligand works beautifully.

I’m aware of how fussy Gromacs is about the order that it receives its instructions, but the following error has never made any sense to me. Why would something work for a single ligand that fails when you add a second ligand?

– complex.top –
; Include forcefield parameters
#include “amber99.ff/forcefield.itp”
; Include ligand parameters
#include “FAD.itp”
#include “LIG.itp”
; Include ligand parameters

; Include chain topologies
#include “protein_Protein_chain_B.itp”
#include “protein_Ion_chain_B2.itp”

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

[ system ]
; Name
Protein in water

[ molecules ]
; Compound #mols
Protein_chain_B 1
Ion_chain_B2 1
FAD 1
LIG 1
SOL 9740

Here is the error I get:

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

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

For more information and tips for troubleshooting, please check the GROMACS
website at Common Errors — GROMACS webpage https://www.gromacs.org documentation

The structure of the itp files for both ligands look the same. I can get this to run, if I hand change the atom typing from one of the two ligands. That’s crazy to do at scale. Is there something I am just missing, or am I doomed to use NAMD?

FYI- I’ve noticed people talking about a “prm” file. Never heard of that before, but if that works I am all ears!

Thanks in advance!
Matt

GROMACS requires that all [atomtypes] (and all force field parameters, in fact) be defined before any [moleculetype] can be introduced. If you have multiple ligands that both introduce new parameters (atom types or anything else at the force-field level), these need to be introduced all at once, before any [moleculetype] can be declared.

This comes from our CHARMM → GROMACS conversion script, which writes an .itp file with all “new” parameters that it finds from the ligand .str file, using an extension that is so named in CHARMM because it holds “parameters.” If you extract all parameters from any ligand topology and consolidate them in a separate file, you can just #include this before any ligand [moleculetype] and you won’t have an issue (provided there are no parameters that get redefined between the two).

Hi Justin,

Wild, just copying the atomtypes over worked as long as that occurs in the first ITP file (and that I pulled the atomtypes from the second ITP file). Obviously I need to handle all of the duplicated atomtypes, but that’s easy enough. Finally I can completely ditch NAMD!

Thanks much!
Matt