Release 0.18.0

MDAnalysis version 0.18.0 has been released.

This release brings various fixes and new features and users should update with either pip install -U MDAnalysis or conda install -c conda-forge mdanalysis.

One exciting new feature is the addition of duecredit to keep track of what citations are appropriate. Once you have written an analysis script (e.g., and have installed the duecredit package (pip install duecredit), you can either set the environment variable DUECREDIT_ENABLE=yes and run your script python or to run python -m duecredit to be given a report of what citable software you have used. You can then use the data written by duecredit to export the bibliography and have it ready to be imported into your reference manager. We hope that this will allow all contributors of analysis packages within MDAnalysis to get properly cited and we are working on retroactively adding all required citations to duecredit.

The AtomGroup.groupby method now supports using multiple attributes to group by, for example one could create a dictionary which allows a particular residue name and atom name to be quickly queried:

>>> grouped = ag.groupby(['resnames', 'names'])

>>> grouped['MET', 'CA']
<AtomGroup with 6 atoms>

When writing GRO files, previously all atoms would have their indices reset so that they ran sequentially from 1. To preserve their original index, the reindex option has been added to the GROWriter. For example:

>>> u = mda.Universe()

>>> u.atoms.write('out.gro', reindex=False)


>>> with mda.Writer('out.gro', reindex=False) as w:
...     w.write(u.atoms)

Gromacs users can benefit from a new feature when reading TPR files. Now, when the topology is read from a TPR file, the atoms have a moltype and a molnum attribute. The moltype attribute is the molecule type as defined in ITP files, the molnum attribute is the index of the molecule. These attributes can be accessed for an atom group using the plural form:

>>> u = mda.Universe(TPR, XTC)
>>> u.atoms.moltypes
>>> u.atoms.molnums

These attributes can be used in groupby:

>>> u.atoms.groupby('moltypes')
>>> u.atoms.groupby('molnums')

to provide access to all atoms of a specific moleculr type or that are part of a particular molecule.

The AtomGroup.split method of atom groups can also work on molecules:

>>> u.atoms.split('molecule')

and will create a list of AtomGroup instances, one for each molecule.

For convenience, various Group classes have been moved to the top namespace (namely, AtomGroup, ResidueGroup, SegmentGroup):

import MDAnalysis as mda

u = mda.Universe(topology, trajectory)

# for creating AtomGroups from arrays of indices
ag = mda.AtomGroup([11, 15, 16], u)

# or for checking an input in a function:
def myfunction(thing):
    if not isinstance(thing, mda.AtomGroup):
        raise TypeError("myfunction requires AtomGroup")

And finally, this release includes fixes for many bugs. This includes a smaller memory footprint when reading NetCDF trajectories, better handling of time when reading DCD trajectories and adding support for Gromacs 2018 TPR files. For more details see the CHANGELOG entry for release 0.18.0.

As ever, this release of MDAnalysis was the product of collaboration of various researchers around the world featuring the work of 12 different contributors. We would especially like to welcome and thank our six new contributors: Ayush Suhane, Mateusz Bieniek, Davide Cruz, Navya Khare, Nabarun Pal, and Johannes Zeman.