Position restraints missing when .itp is printed to .top

GROMACS version: 2024.4
GROMACS modification: No

Hello,

I have been doing this tutorial where there are two protein chains. Using pdb2gmx, the .top file created is:

; Include forcefield parameters
#include "charmm27.ff/forcefield.itp"

; Include chain topologies
#include "protein_Protein_chain_A.itp"
#include "protein_Protein_chain_L.itp"

; Include water topology
#include "charmm27.ff/spc.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 "charmm27.ff/ions.itp"

[ system ]
; Name
COAGULATION FACTOR XA; COAGULATION FACTOR XA

[ molecules ]
; Compound        #mols
Protein_chain_A     1
Protein_chain_L     1

The protein_Protein_chain_A.itp file contains the normal information, and at the bottom has:

; Include Position restraint file
#ifdef POSRES
#include "posre_Protein_chain_A.itp"
#endif

When I do the genion step, the #include files are printed to the output .top file, but the protein position restraint section is missing:

; Include Position restraint file


; Include water topology
[ moleculetype ]

Therefore, when I try to do an NVT equilibration with restraints I get the following error:

 WARNING 1 [file em.top, line 47987]:
  The following macros were defined in the 'define' mdp field with the -D
  prefix, but were not used in the topology:
      POSRES
  If you haven't made a spelling error, either use the macro you defined,
  or don't define the macro

Do I need to manually add the position restraints into the .top file after it is first generated using pdb2gmx or is there another way to ensure it is printed into the .top file?

Hi!
What’s in your em.top file? There’s no such filename used in the tutorial, so did you just rename topol.top to em.top or is this something else?

Yes, I renamed topol.top to em.top so I could keep track of the .top files as they were generated