pygromacs package¶
Submodules¶
pygromacs.gmxfiles module¶
- class pygromacs.gmxfiles.MdpFile(path='')[source]¶
Bases: builtins.object
Container for MDP files.
Parameters: path (str, optional) – Read from file at this path - lines¶
This is an ordered list of MdpOption objects, containing the parameters, values, and comments which together make up a file. It is a list to keep a read file as close to the original as possible when modifying it.
- options¶
This is a dictionary of parameters, linking to objects in lines. Used internally to quickly access any parameter of that list and thus file.
- class MdpOption(parameter='', value='', comment='', index=None)[source]¶
Bases: builtins.object
Container for an MDP option.
Parameters: - parameter (str) – A parameter,
- value (str) – its value
- comment (str) – and comment
- index (int) – Index of option in MdpFile.lines
- MdpFile.get_option(parameter)[source]¶
Return the value of a parameter.
Parameters: parameter (str) – A parameter Returns: The parameter value, empty if not found Return type: str
- MdpFile.print(comment=True)[source]¶
Print the current file.
Parameters: comment (bool, optional) – Print or ignore comments
- MdpFile.read(path)[source]¶
Read an MDP file at path.
Updates path to given value. Parameters and lines are stored in lines and options.
- MdpFile.save(path='', verbose=True, ext='mdp')[source]¶
Save current MDP file.
The written content is set in lines.
Parameters: - path (str, optional) – Write file to this path (default: path)
- verbose (bool, optional) – Print information about save
- ext (str, optional) – Use this file extension (default: ‘mdp’)
pygromacs.utils module¶
- pygromacs.utils.prepare_path(path, verbose=True)[source]¶
Prepare a path for writing.
Creates required directories and backs up any conflicting file.
Parameters: - path (str) – Path to file
- verbose (bool, optional) – Whether or not to print information about a performed backup
Returns: The path to a backed up file, empty if no backup was taken
Return type: str