Add C preprocessor like functionality to mdp files
GROMACS currently does this for topology files with #include, #if, #define, etc. Depending on the application, some sets of simulations can have .mdp files that are almost identical except for a couple of modification. For example, running an NVT equilibration, then and NPT equilbiration, and lastly an NPT production run. The cutoffs, constraints, etc. are very likely the same in all of the files for many use cases, so they could benefit from an '#include' functionality, and even benefit from '#if' statements. There is already a 'define' directive in mdp files, but it is only used in topologies, as far as I can tell.
I saw on the Feature Wishlist (http://www.gromacs.org/Developer_Zone/Roadmap/Feature_wishlist) a desire to do mdp chaining, so maybe this could be related to that (although the link is broken there, so I don't know all the details). Looking through how GROMACS reads in mdp files and top files I can see they are treated differently, so I don't know the level of difficulty of this proposal.
#1 Updated by Mark Abraham over 5 years ago
There'd need to be some upgrade of the .mdp parsing gear, but at least in principle we could implement something like
gmx grompp -usual -stuff -define "NVT=1;POSRE=off"
to support an .mdp containing something like
pcoupltype = no
pcoupltype = Berendsen
tau-p = whatever
pcoupltype = Nose-Hoover
tau-p = whatever
#error "Need a simulation type in the .mdp file"
perhaps preserving the existing
define field of the .mdp (but have it only act upon the topology).
That does seem to violate "one tool, one function" principles, though. Building the .mdp from whatever inputs is a valid function. It makes sense to combine it with the .tpr compilation so long as "building" is simple (ie. like now, just read in the file and use it), but adding conditionality to it might suggest having a separate tool, and if so that should be (e.g.) a Python script, which is what a user can already do themselves...
It also makes it harder to share a grompp workflow - now you need all the files, and the contents of
gmx grompp -define and that does not seem like an advantage to me. For example, bug reports are even less likely to have all the relevant data for reproduction and testing...