Problem using Position restraints for multiple groups

GROMACS version: 2023.2
GROMACS modification: No

I have a membrane-protein system and during the pre-equilibration I’m applying different values of positional restraints for lipids (6 different species) and the protein.

In my mdp, I included:

define = -DPOSRES_PT

And in my topology, for each lipid, I created the following ifdef structure:

#include “./ITPs/martini_v3.0.0_phospholipids_PS_v2_openbeta.itp”
#ifdef POSRES_PT
#include “posre_POPS.itp”
#endif

#include “./ITPs/martini_v3.0.0_phospholipids_PI_v2_openbeta.itp”
#ifdef POSRES_PT
#include “posre_POP2.itp”
#endif

each posre_**.*itp file (created with gmx genrest) file has the following structure:

; position restraints for POP2.

; i funct fcx fcy fcz
1 1 200 200 200
2 1 200 200 200
3 1 200 200 200
4 1 200 200 200
5 1 200 200 200
6 1 200 200 200
7 1 200 200 200
8 1 200 200 200
9 1 200 200 200
10 1 200 200 200
11 1 200 200 200
12 1 200 200 200
13 1 200 200 200
14 1 200 200 200
15 1 200 200 200
16 1 200 200 200
17 1 200 200 200

Basically, when I execute gmx grompp (gmx grompp -f full-pr-md.mdp -c min.gro -r min.gro -p teste_update.top -n index.ndx -o pr_md.tpr), I always got the same error for the second if statement in my topology file.

ERROR 1 [file posre_POP2.itp, line 13]:
Atom index (9) in position_restraints out of bounds (1-8).
This probably means that you have inserted topology section
“position_restraints”
in a part belonging to a different molecule than you intended to.
In that case move the “position_restraints” section to the right
molecule.

Could someone help me to understand what I’m doing wrong? I’m able to create the tpr file without the position restraints sections.

Thanks in advance,

Fred

This mean the you included the file posre_POP2.itp after a declaration of a moleculetype with 8 atoms. You must have mixed up the files or made a typo.

hi Hess!

Thank you so much for your message. Apparently I solved the problem and I’d like to let here registered. I kept my topology file like this:

#include “./ITPs/martini_v3.0.0.itp”
#include “./ITPs/martini_v3.0.0_ffbonded_v2_openbeta.itp”
#include “./ITPs/martini_v3.0.0_phospholipids_PS_v2_openbeta.itp”
#include “./ITPs/martini_v3.0.0_phospholipids_PI_v2_openbeta.itp”
#include “./ITPs/martini_v3.0.0_phospholipids_PC_v2_openbeta.itp”
#include “./ITPs/martini_v3.0.0_phospholipids_PE_v2_openbeta.itp”
#include “./ITPs/martini_v3.0.0_phospholipids_SM_v2_openbeta.itp”
#include “./ITPs/martini_v3.0.0_sterols_v1.itp”
#include “./ITPs/martini_v3.0.0_solvents_v1.itp”
#include “./ITPs/martini_v3.0.0_ions_v1.itp”
#include “molecule_0.itp”

but now I included a position restraint section inside each lipid’s itp file, like this:

#ifdef POSRES_PT
; i funct fcx fcy fcz
1 1 200 200 200
2 1 200 200 200
3 1 200 200 200
4 1 200 200 200
5 1 200 200 200
6 1 200 200 200
7 1 200 200 200
8 1 200 200 200
9 1 200 200 200
#endif