GromacsWrapper — a Python framework for GROMACS




November 20, 2023

GromacsWrapper is a pure Python package that wraps system calls to GROMACS tools into thin classes. This allows for fairly seamless integration of the GROMACS tools into Python scripts. This is generally superior to shell scripts because of Python’s better error handling and superior data structures. It also allows for modularization and code re-use. In addition, commands, warnings and errors are logged to a file so that there exists a complete history of what has been done.

GROMACS versions 4.6.x, 2016.x, 2018.x, 2019.x, 2020.x, 2021.x, 2022.x, and 2023.x are all supported. GromacsWrapper detects your Gromacs tools and provides them as gromacs.grompp(), gromacs.mdrun(), etc, regardless of your Gromacs version, which allows one to write scripts that are broadly Gromacs-version agnostic. Source your GMXRC file or make the gmx binary (for versions ≥ 5.x) or all the GROMACS tools available on your PATH for GromacsWrapper to find the GROMACS installation.


Although GromacsWrapper has been used in published research over the last 10 years or so, there is no guarantee that any of the defaults chosen are suitable for any particular project or simulation setup.

It is your responsibility to ensure that you are running simulations with sensible parameters. Provide appropriate template files instead of the bundled defaults and check the logger output!

Please report bugs in the issue tracker and go to the discussions forum for questions.

Contributions are very welcome — start by raising an issue in the issue tracker to describe what feature you’re adding or what bug you’re fixing.

See also

Other approaches to interfacing Python and GROMACS are listed under Alternatives to GromacsWrapper.

Getting started

See Installation for supported versions of Python and download and installation instructions. The Quick Start provides a brief example of how to use GromacsWrapper in the most basic fashion.

The source code itself is available in the GromacsWrapper git repository.

You also need to have a version of GROMACS installed.


The GromacsWrapper package is made available under the terms of the GNU Public License v3 (or any higher version at your choice) except as noted below. See the file COPYING for the licensing terms for all modules.


Latest release on zenodo (with DOI)

GromacsWrapper was written by Oliver Beckstein with contributions from many other people. Please see the file AUTHORS for all the names.

If you find this package useful and use it in published work I’d be grateful if it was acknowledged in text as

“… used GromacsWrapper (Oliver Beckstein et al, doi: 10.5281/zenodo.17901)”

or in the Acknowledgements section.

Thank you.


Please use the issue tracker to report bugs, installation problems, and feature requests (mention @orbeckst in the issue report) and use the discussions forum for general questions.