[gmx-developers] grompp .mdp processing

Mark Abraham Mark.Abraham at anu.edu.au
Mon Feb 23 21:45:28 CET 2009

Tsjerk Wassenaar wrote:
> Hey Chris, e.a.
> Just on an efficiency note:
>> {
>> NEWVAL=1993
>> cat orig.mdp | grep -v '^gen_seed '
>> echo "gen_seed  = ${NEWVAL}"
>> } > new.mdp
> sed "/^gen_seed/s/=.*/= $NEWVAL/" orig.mdp > new.mdp
>> $sed "s/TINIT/${tinit}/" template.mdp | sed "s/TSTEP/${tstep}/" | sed
>> "s/NSTEPS/${nsteps}/" | sed "s/SAVE_FREQUENCY/${save_frequency}/" >
>> actual.mdp
> sed -e "/^tinit/s/=.*/= $TINIT/" -e "/^nsteps/s/=.*/= $NSTEPS/" ...
> template.mdp > new.mdp
> No need for a template with named variables... (and no need for piping
> sed output to sed input).

Thanks! I'd never seen this "/grepmatch/s/original/replacement/" syntax 
before. It runs rings around some of my sed monstrosities.

> Then adding my two cents, to my opinion, the 'option = value' approach
> now offered in the .mdp file is one of the most useful parameter
> control methods. It's trivial to edit with sed (and perl for that
> matter) and easy enough to manage with python as it is. Some kind of
> hierarchy might be useful, especially as the number of options keeps
> increasing, but maybe that's better tackled using hierarchical naming
> as Chris suggests.

Indeed, I also approve of some hierarchiality (:-P), but don't mind 
whether we do it with some matching brace-pairs or 
master_subname_subname variable naming.

Either way, some correspondence between the naming and the underlying 
data structure has some merit - but the .mdp contents should be as close 
to plain English as reasonable. I think "tc-grps" is unnecessarily 
cryptic. This is not FORTRAN77 any more kids :-) 
"temperature_coupling_groups" is quite fine when the user will not be 
typing it often.


More information about the gromacs.org_gmx-developers mailing list