Adding user-defined mdp option

GROMACS version: 2021.3
GROMACS modification: Yes

I am trying to add user defined variables to the source code that are booleans and tensors.

I have added these new variables to src/gromacs/mdtypes/inputrec.cpp, src/gromacs/gmxpreprocess/readir.cpp, gromacs/fileio/readinp.cpp, and src/gromacs/filio/tpxio.cpp. I am able to recompile the code without errors and I see my new variables show up in the mdout.mdp file, but in the log file of the run the variable is set to the default value (false for the boolean variable even when the mdp file says “yes” and a 3x3 matrix of zeros rather than filling in what I have defined in the mdp file).

How do I make sure that gromacs is reading the actual values in the mdp file rather than filling in defaults for the user-defined mdp options?
If anyone has any insight on adding new variables to the mdp options and how to find all the relevant source files that need to be edited for this, it would be greatly appreciated!


We don’t have a definitive list, but your list of relevant files looks complete, so perhaps something else is going wrong. Do you have your code available anywhere?

P.S. I moved your post to “Developers discussions”.

Thank you for moving my post. I couldn’t find the developer option when I created this discussion. I have added the src/gromacs/ folders with the edited files onto github (

My added user inputs have the prefix sinp and are listed near the “userint” options in src/gromacs/mdtypes/inputrec.cpp, src/gromacs/gmxpreprocess/readir.cpp, gromacs/fileio/readinp.cpp, and src/gromacs/fileio/tpxio.cpp.