MDAnalysis

MDAnalysis is a Python library for the analysis of computer simulations of many-body systems at the molecular scale, spanning use cases from interactions of drugs with proteins to novel materials. It is widely used in the scientific community and is written by scientists for scientists.

It works with a wide range of popular simulation packages including Gromacs, Amber, NAMD, CHARMM, DL_Poly, HooMD, LAMMPS and many others — see the lists of supported trajectory formats and topology formats. MDAnalysis also includes widely used analysis algorithms in the MDAnalysis.analysis module.

The MDAnalysis project uses an open governance model and is fiscally sponsored by NumFOCUS. Consider making a tax-deductible donation to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.

If you use MDAnalysis in your project consider lettting your users and the world know about it by displaying the MDAnalysis badge! Embedding code is available for different markups.

Example analysis script

import MDAnalysis as mda

# Load simulation results with a single line
u = mda.Universe('topol.tpr','traj.trr')

# Select atoms
ag = u.select_atoms('name OH')

# Atom data made available as Numpy arrays
ag.positions
ag.velocities
ag.forces

# Iterate through trajectories
for ts in u.trajectory:
    print(ag.center_of_mass())