How to update topology file after insert-molecules?

GROMACS version:2021
GROMACS modification: /No
Here post your question

To insert the ligand, I put ligand.gro,, ligand.itp files to the working directory (correct?). Then I use:
gmx insert-molecules -f protein_newbox.gro -nmol 26 -ci ligand.gro -o protein_ligand.gro

This only results in a new gro file, while the file is not updated. I will need to manually add certain lines to the file to reflect the adding of ligands. How to do this exactly? What else do I need to do?

Why there is not a way to automatically update the file for insert-molecules, e.g. -p

You can manually do this in file. Go to, type #include “ligand.itp” to add your forcefield file. Also, go to the number of molecules section, type name ref and the number of molecules

Thank you. What I have done is

(protein.pdb, ligand.gro,, ligand.itp are in the working directory)

    gmx pdb2gmx -f protein.pdb -o protein_processed.gro -water tip3p -ignh -merge interactive
    gmx editconf -f protein_processed.gro -o protein_newbox.gro -c -d 1.0 -bt dodecahedron
    gmx insert-molecules -f protein_newbox.gro -nmol 26 -ci ligand.gro -o protein_ligand.gro

) in the, go to [ molecules ], change “nmols” to 26
) in the, #include "ligand.itp" is already there

gmx solvate -cp protein_ligand.gro -cs spc216.gro -o protein_solv.gro -p
gmx grompp -f ions.mdp -c protein_solv.gro -p -o ions.tpr -maxwarn 1

But I got error:

Fatal error:
number of coordinates in coordinate file (protein_solv.gro, 332025)
             does not match topology (, 331167)

So I think I need to manually modify the, instead of How to do it?

I think I got the solution.

#include "ligand.itp"
#include "amber14sb.ff/forcefield.itp"

#include ""
#include "amber14sb.ff/tip3p.itp"

ligand 26
to the last line

Then, in the, disable the sections of [defaults], #include "ligand.itp", [molecules]

That’s the better approach. After using the insert molecules command, you gotta manual edit your topology file!