Gromacs parameter MDP file format — GromacsWrapper 0.5.0-dev documentation

# Gromacs parameter MDP file format

The .mdp file contains a list of keywords that are used to set up a simulation with `Grompp`. The class `MDP` parses this file and provides access to the keys and values as ordered dictionary.

class `gromacs.fileformats.mdp.` `MDP`(filename=None, autoconvert=True, **kwargs)

  Class that represents a Gromacs mdp run input file.

  The MDP instance is an ordered dictionary.

  > - Parameter names are keys in the dictionary.
  > - Comments are sequentially numbered with keys Comment0001, Comment0002, ...
  > - Empty lines are similarly preserved as Blank0001, ....

  When writing, the dictionary is dumped in the recorded order to a file. Inserting keys at a specific position is not possible.

  Currently, comments after a parameter on the same line are discarded. Leading and trailing spaces are always stripped.

  See also

  For editing a mdp file one can also use `gromacs.cbook.edit_mdp()` (which works like a poor replacement for sed).

  Initialize mdp structure.

  Arguments: | filename read from mdp file autoconvert : boolean `True` converts numerical values to python numerical types; `False` keeps everything as strings [`True`] kwargs Populate the MDP with key=value pairs. (NO SANITY CHECKS; and also does not work for keys that are not legal python variable names such as anything that includes a minus ‘-‘ sign or starts with a number).

  `read`(filename=None)

    Read and parse mdp file filename.

  `write`(filename=None, skipempty=False)

    Write mdp file to filename.

    Keywords: | filename output mdp file; default is the filename the mdp was read from skipempty : boolean `True` removes any parameter lines from output that contain empty values [`False`]

    Note

    Overwrites the file that the mdp was read from if no filename supplied.