Oliver Beckstein edited this page Sep 26, 2015 · 18 revisions

Project Information

GNU GPL v2 code license
Labels: python, molecular dynamics, analysis, DCD, CHARMM, LAMMPS, NAMD, Gromacs, computer simulation, atoms, coordinates, trajectory, XTC, Library, object-oriented
Core Developers


Release Notes
Guide for Developers
Google Summer of Code


@mdanalysis on Twitter
Downloads (PyPi)
Mailing Lists:
User discussion group
Developer mailing list

Clone this wiki locally

MDAnalysis is an object-oriented python toolkit to analyze molecular dynamics trajectories generated by CHARMM, Gromacs, NAMD, LAMMPS, or Amber.

MDAnalysis allows one to read molecular dynamics trajectories and access the atomic coordinates through numpy arrays. This provides a flexible and relatively fast framework for complex analysis tasks. In addition, CHARMM-style atom selection commands are implemented. Trajectories can also be manipulated (for instance, fit to a reference structure) and written out.

A typical usage pattern is to iterate through a trajectory and analyze coordinates for every frame. In the following example the end-to-end distance of a protein and the radius of gyration of the backbone atoms are calculated:

import MDAnalysis
from MDAnalysis.tests.datafiles import PSF,DCD   # test trajectory
import numpy.linalg
u = MDAnalysis.Universe(PSF,DCD)                 # always start with a Universe
nterm = u.s4AKE.N[0]   # can access structure via segid (s4AKE) and atom name
cterm = u.s4AKE.C[-1]  # ... takes the last atom named 'C'
bb = u.select_atoms('protein and backbone')  # a selection (a AtomGroup)
for ts in u.trajectory:     # iterate through all frames
  r = cterm.pos - nterm.pos # end-to-end vector from atom positions
  d = numpy.linalg.norm(r)  # end-to-end distance
  rgyr = bb.radius_of_gyration()  # method of a AtomGroup; updates with each frame
  print "frame = {}: d = {} Angstroem, Rgyr = {} Angstroem".format(ts.frame, d, rgyr)

Availability and Installing

From Source

Find the latest source release

Note that that MDAnalysis is still considered experimental software (although a growing number of people have been using it successfully for published work). Please report problems through the Issue Tracker.

The file INSTALL in the package itself and the wiki pages Install and InstallRecipes should help you compiling and installing MDAnalysis.

Python packages

The package is also listed on PyPI (the Python package index) and should be installable with pip, e.g.

pip install MDAnalysis

Learning MDAnalysis

The MDAnalysis Tutorial serves as an introduction to the library and there are other Tutorials available, too.

See the Online Documentation for more information on how to use MDAnalysis and the TableOfContents for a general overview of the available documentation on the Wiki. The paper on MDAnalysis contains a high-level description of the structure and philosophy of the library together with examples of its use.

MDAnalysis also comes with example scripts and fairly general analysis modules, available as MDAnalysis.analysis — you can use this code as a starting point for your own analysis scripts.

Finally, you can also ask for advice or help on the mdnalysis-discussion mailing list. If you find bugs or want to request enhancements please file a report in the Issue Tracker.


When using MDAnalysis in published work, please cite

  • N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein. MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. J. Comput. Chem. 32 (2011), 2319-2327, doi:10.1002/jcc.21787. PMCID:PMC3144279

    (If you are reading the HTML version of the paper, have a look at the PaperErrata. The free PubmedCentral manuscript PMC3144279 has correct code, which can be copied and pasted.)

Included algorithms

If you use the RMSD alignment code that uses the QCProt module please also cite

  • Douglas L. Theobald. Rapid calculation of RMSD using a quaternion-based characteristic polynomial. Acta Crystallographica A 61 (2005), 478-480.
  • Pu Liu, Dmitris K. Agrafiotis, and Douglas L. Theobald. Fast determination of the optimal rotational matrix for macromolecular superpositions. J. Comput. Chem. 31 (2010), 1561–1563.

If you use the helix analysis algorithm HELANAL in MDAnalysis.analysis.helanal please cite

  • Bansal M, Kumar S, Velavan R. HELANAL - A program to characterise helix geometry in proteins. J. Biomol. Struct. Dyn. 17 (2000), 811–819

If you use the GNM trajectory analysis code in MDAnalysis.analysis.gnm please cite

  • Benjamin A. Hall, Samantha L. Kaye, Andy Pang, Rafael Perera, and Philip C. Biggin. Characterization of Protein Conformational States by Normal-Mode Frequencies. JACS 129 (2007), 11394–11401.


Historical, Technical and Artistic Remarks

MDAnalysis was originally inspired by the Schulten Group's MDTools for Python, and the DCD reading code is derived from VMD's catdcd. MDAnalysis is GPL licensed, except for some 3rd party code that is included under GPL-compatible licenses; for instance the dcd reading code is under the UIUC Open Source Licence. See the files AUTHORS and LICENSE in the distribution for details.

Some time-critical routines are written in C or cython and require a working C compiler. The minimum required version of Python is 2.6. MDAnalysis has been successfully used on Linux and Mac OS X.

The MDAnalysis 'Atom' Logo was designed by Christian Beckstein and is licensed under a Creative Commons Attribution-NoDerivs 3.0 Unported License.