MDAnalysis 2.1 is out

We are happy to release the version 2.1.0 of MDAnalysis!

In line with ongoing attempts to keep MDAnalysis closer to NEP 29, this version now only supports Python 3.7 to 3.10, in addition to a minimum NumPy version of 1.18.0.

Further details about MDAnalysis’ support policy, including our release schedule, will be provided in an upcoming blog post.

Upgrading to MDAnalysis version 2.1.0

To install with conda from the conda-forge channel run

conda update -c conda-forge mdanalysis

To install from PyPi with pip run

pip install --upgrade MDAnalysis

For more help with installation see the installation instructions in the User Guide.

Notable new additions

Dielectric constant analysis

Mattia Felice Palermo and Philip Loche contributed a new analysis module to compute average dipole moments. The module can be accessed as MDAnalysis.analysis.dielectric. Here is an example from the documentations:

import MDAnalysis as mda
from MDAnalysis.analysis.dielectric import DielectricConstant
from MDAnalysisTests.datafiles import PSF_TRICLINIC, DCD_TRICLINIC

# Load a pure water system
universe = mda.Universe(PSF_TRICLINIC, DCD_TRICLINIC)

diel = DielectricConstant(universe.atoms)
{'M': array([ 1.54082059, -2.03885814,  3.37261771]), 'M2': array([ 5.71970697, 13.45815613, 18.24527209]), 'fluct': array([3.34557887, 9.3012136 , 6.87072189]), 'eps': array([2.47772633, 5.10830197, 4.0347653 ]), 'eps_mean': 3.873597866567474}

R/S chirality is read from RDKit objects

Richard Gowers made the reading of RDKit molecules aware of the R/S chirality when the information is available. The information can be accessed with the AtomGroup.chirality attribute and be used for selections.

import MDAnalysis as mda
from rdkit import Chem

molecule = Chem.MolFromSmiles('CC[[email protected]](C)[[email protected]](C(=O)O)N')
universe = mda.Universe(molecule)

# Read the chirality of each atom

# Select atoms from their chirality
universe.select_atoms('element C and chirality S')

Other enhancements

Thanks to Atharva Kulkarni, MDAnalysis.units.convert knows about milliseconds and microseconds. The function, as the name indicates, converts quantities from one unit to an other.

Edis Jakupovic improved the reading of H5MD files so it can better read files without a topology. For these files, the number of atoms is now read from the positions, velocities, or forces in the trajectory.

Thanks to Richard Gowers, again, one can apply the minimum image convention to a collection of vectors using MDAnalysis.lib.distances.minimize_vectors.

Thanks to Jonathan Barnoud, this version of MDAnalysis is compatible with TPR files produced with Gromacs 2022.

Thanks to Hugo MacDermott-Opeskin, you can now specify additional compiler flags for the C/C++ compiler to customise your installation. This can be used to improve performance by using architecture specific flags. See the detailed instructions in the User Guide for more information.

Other changes

Indexing a group (AtomGroup, ResidueGroup, or SegmentGroup) with None now raises a TypeError.

As announced with the previous release, the TZR reader now defaults to a dt of 1.0 ps, instead of 0.0 ps previously, when the time step cannot be read from the file.

For a full list of bugfixes see the CHANGELOG.


In methods of AtomGroup. ResidueGroup, and SegmentGroup, the argument pbc has been renamed wrap. This name makes the meaning of the argument clearer and mirrors the unwrap argument of these same methods. The use of pbc is still possible, bt it is deprecated and will be removed in version 3.0.

Author statistics

Altogether, this represents the work of 14 authors, 6 of which were new contributors:

MDAnalysis thanks NumFOCUS’s continued support as the organisation’s fiscal sponsor.