[gmx-developers] IMdpOptionProvider: How to read enum-style options from the .mdp ?

Kutzner, Carsten ckutzne at gwdg.de
Thu Sep 21 14:49:21 CEST 2017

Dear developers,

I want to read in an additional option from the .mdp file that is entered as a string and
is one of several choices. How should/can such enum-style options be implemented within 
the IMdpOptionProvider framework? An example would be a temperature coupling 
option with possible values

mytcoupl = no  ; or andersen, or v-rescale, ...

I have defined
enum TempCouplType { tc_none, tc_andersen, tc_vrescale };
const char *const TempCouplDesc[] = { "no", "andersen", "v-rescale" }

The following three methods need to be implemented:
1) buildMdpOutput()
2) initMdpOptions()
3) initMdpTransform()

in (1) I use 
TempCouplType myTcoupl = 1; // e.g.
builder->addValue<string>("tcoupl", TempCouplDesc[myTcoupl] ); // outputs "tcoupl = andersen" in mdout.mdp

in (2)

for (3) at the moment I use the following, which allows me to put _integers_ in the .mdp,
but not _strings_ as I would like to:

IKeyValueTreeTransformRules *rules;

Thanks for any hint!

More information about the gromacs.org_gmx-developers mailing list