Skip to content


Switch branches/tags


CI codecov slack heroku

For reporting bugs or suggesting new features/improvements to the code, please open an issue.

What is Auto_Martini?

A toolkit that enables automatic generation of Martini forcefields for small organic molecules.

For a detailed account of the software, see:

Bereau and Kremer, J Chem Theory Comput, DOI:10.1021/acs.jctc.5b00056 (2015)

DOI for Citing auto_martini

Please consider citing the paper if you find auto_martini useful in your research.

author = {Bereau, Tristan and Kremer, Kurt},
title = {Automated parametrization of the coarse-grained MARTINI force field 
    for small organic molecules},
journal = {J Chem Theory Comput},
year = {2015},
volume = {11},
number = {6},
pages = {2783-2791},
doi = {10.1021/acs.jctc.5b00056}

For full documentation, click here.


  • Tristan Bereau (University of Amsterdam, Netherlands)
  • Kiran Kanekal (Max Planck Institute for Polymer Research, Mainz, Germany)
  • Andrew Abi-Mansour (Molecular Sciences Software Institute, Virginia Tech, Blacksburg, US)

‼️ Online web app

auto_martini can now be run in the browser! The Heroku-based auto_martini web app allows you to try out auto_martini without any installation. (Please be patient on the first connection: the web app may take up to 30s to boot up after staying idle for a while.)

Heroku demo

Update to Python3

The main branch is now fully compatible with Python 3. For the original Python2-based version of the code used in the JCTC 2015 paper, see branch original_jctc2015.


Installation with conda

The easiest way to install auto_martini is with conda:

conda env create -f environment.yaml

This will create a conda environment called autom which you can activate with

conda activate autom

Now use pip from the auto_martini src dir to run the installation:

pip install .

Installation with pip

If you wish to install auto_martini with setuptools, take note of the following dependencies:

Note: for optimal performance, we recommend installing cython as well. We also recommend installing the latest version of rdkit with conda. If no rdkit installation is found, auto_martini will attempt to compile it from its source code. For a detailed installation, see the documentation.

Once cython is installed, installation of auto_martini can be done using

python install

Once all the dependencies are correctly installed, auto_martini can be tested or run.


To run the test cases and validate your installation, you will need to have pytest installed. If you installed auto_martini with conda, then pytest should already be available in your environment.

To initiate the testing, run the following:

pytest -v tests

All tests should pass within few minutes. If any of the tests fail, please open an issue.

Command-line Interface

You can invoke auto_martini from the command-line via:

python -m auto_martini [mode] [options]

By default, mode is set to 'run', which computes the MARTINI forcefield for a given molecule.

To display the usage-information (help), either supply -h, --help, or nothing to auto_martini:

usage: auto_martini [-h] [--mode {run,test}] [--sdf SDF | --smi SMI]
                    [--mol MOLNAME] [--aa AA] [--cg CG] [--top TOPFNAME] [-v]

Generates Martini force field for atomistic structures of small organic molecules

optional arguments:
  -h, --help         show this help message and exit
  --mode {run,test}  mode: run (compute FF) or test (validate)
  --sdf SDF          SDF file of atomistic coordinates
  --smi SMI          SMILES string of atomistic structure
  --mol MOLNAME      Name of CG molecule
  --aa AA            filename of all-atom structure .gro file
  --cg CG            filename of coarse-grained structure .gro file
  --top TOPFNAME     filename of output topology file
  -v, --verbose      increase verbosity
  --fpred            Atomic partitioning prediction

Tristan Bereau (bereau [at]
Kiran Kanekal (kanekal [at]
Andrew Abi-Mansour (andrew.gaam [at]


To coarse-grain a molecule, simply provide its SMILES code (option --smi SMI) or a .SDF file (option '--sdf file.sdf). You also need to provide a name for the CG molecule (not longer than 5 characters) using the --mol option. For instance, to coarse grain guanazole, you can either obtain/generate (e.g., from Open Babel) an SDF file:

python -m auto-martini --sdf guanazole.sdf --mol GUA --top GUA.itp

(the name GUA is arbitrary) or use its SMILES code within double quotes

python -m auto-martini --smi "N1=C(N)NN=C1N" --mol GUA --top GUA.itp

In case no problem arises, it will output the gromacs GUA.itp file:

;;;; GENERATED WITH auto-martini
; Tristan Bereau (2014)

; molname       nrexcl
  GUA           2

; id    type    resnr   residu  atom    cgnr    charge  smiles
  1     SP2     1       GUA     S01     1       0     ; Nc1ncnn1
  2     SP2     1       GUA     S02     2       0     ; Nc1ncnn1

;  i   j     funct   length
   1   2     1       0.21

Optionally, the code can also output a corresponding .gro file for the coarse-grained coordinates

python -m auto-martini --smi "N1=C(N)NN=C1N" --mol GUA --cg gua.gro --top GUA.itp

Atomistic coordinates can be written using the --aa output.gro option.


For frequently encountered problems, see FEP.


Automatic MARTINI parametrization of small organic molecules







No packages published