GromacsWrapper — a Python framework for Gromacs




September 09, 2021

GromacsWrapper is a Python package (Python 2.7.x and Python ≥ 3.6) 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, and 2021.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!

Any feedback, bug reports, suggestions and contributions are very welcome.

See also

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

Getting started

See Installation for 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).