# Unable to Simulate Two Ligands Simulateously

**URL:** <https://gromacs.bioexcel.eu/t/unable-to-simulate-two-ligands-simulateously/5681>\
**Category:** User discussions\
**Created:** [January 30, 2023, 8:10pm UTC](https://gromacs.bioexcel.eu/t/unable-to-simulate-two-ligands-simulateously/5681 "2023-01-30T20:10:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlardy](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mlardy](https://gromacs.bioexcel.eu/u/mlardy)\
**Post date:** [January 30, 2023, 8:10pm UTC](https://gromacs.bioexcel.eu/t/unable-to-simulate-two-ligands-simulateously/5681/1 "2023-01-30T20:10:25Z")

</div>

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](http://www.gromacs.org/Documentation/Errors)

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

---

<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:** [January 30, 2023, 8:25pm UTC](https://gromacs.bioexcel.eu/t/unable-to-simulate-two-ligands-simulateously/5681/2 "2023-01-30T20:25:10Z")

</div>

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.

> [@mlardy](#):
>
> FYI- I’ve noticed people talking about a “prm” file. Never heard of that before, but if that works I am all ears!

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).

---

<div class="post-metadata">

**Author:** ![mlardy](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mlardy](https://gromacs.bioexcel.eu/u/mlardy)\
**Post date:** [January 30, 2023, 9:43pm UTC](https://gromacs.bioexcel.eu/t/unable-to-simulate-two-ligands-simulateously/5681/3 "2023-01-30T21:43:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ABHI7](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@ABHI7](https://gromacs.bioexcel.eu/u/ABHI7)\
**Post date:** [May 30, 2024, 4:08am UTC](https://gromacs.bioexcel.eu/t/unable-to-simulate-two-ligands-simulateously/5681/5 "2024-05-30T04:08:59Z")

</div>

I,m also try to add two ligands in a single topology file. But i get  
" \*\ ***Fatal error:**  
**No molecules were defined in the system "**  
[topol.top](https://gromacs.bioexcel.eu/uploads/short-url/4EgC47fxWjt3blrqKwUTHAZIiDG.top) (234.5 KB)  
this is my topol.top file… Please help me how to resolve this problem…?
