Is it possible to output the topology file without include

I’m interested in parsing the Gromacs topology file for my analysis script. However, the include fields are making my life harder. I wonder if there is a gmx command that takes in a gmx topology with those include fields and then output a topology where the fields are explicitly written? Thanks.

For example, before the conversion

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

...

[ bonds ]
;  ai    aj funct            c0            c1            c2            c3
    1     2     1 

[ angles ]
;  ai    aj    ak funct            c0            c1            c2            c3
    2     1     3     1 

[ dihedrals ]
;  ai    aj    ak    al funct            c0            c1            c2            c3
    5    10     8     9     4

After the conversion

[ defaults ]
; nbfunc        comb-rule       gen-pairs       fudgeLJ fudgeQQ
1               2               yes             0.5     0.8333
[ atomtypes ]
; name      at.num  mass     charge ptype  sigma      epsilon
Br          35      79.90    0.0000  A   4.64693e-01  2.45414e-01

...

[ bonds ]
;  ai    aj funct            c0            c1            c2            c3
    1     2     1 0.15250   259408.0

[ angles ]
;  ai    aj    ak funct            c0            c1            c2            c3
    2     1     3     1  104.520    836.800

[ dihedrals ]
;  ai    aj    ak    al funct            c0            c1            c2            c3
    5    10     8     9     4 180.00     4.60240     2

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

gmx grompp -pp will give you most of this information explicitly (replacing the #include statements with actual contents) but it will not populate parameter fields. You can get this information from gmx dump with the .tpr file, as all the parameters are explicitly present there, but not mapped in this exact way. Between the two, you should be able to retrieve the information you need.

1 Like

Thank you.