Read, write and analyze MD trajectories with only a few lines of Python code.

MDTraj is a python library that allows users to manipulate molecular dynamics (MD) trajectories. Extensive trajectory analysis routines are implemented. With MDTraj, you can

  • Read and write from every MD format imaginable (pdb, xtc, trr, dcd, binpos, netcdf, mdcrd, prmtop, ...)
  • Run blazingly fast RMSD calculations (4x the speed of the original Theobald QCP).
  • Use tons of analysis functions like bonds/angles/dihedrals, hydrogen bonding identification, secondary structure assignment, NMR observables.
  • Lightweight API, with a focus on speed and vectorized operations.

The library also ships with a flexible command-line application for converting trajectories between formats. When you install MDTraj, the script will be installed under the name mdconvert.

Citation DOI for Citing MDTraj

MDTraj is research software. If you make use of MDTraj in scientific publications, please cite it. The BibTeX reference is

    title = {MDTraj: A Modern Open Library for the Analysis of Molecular Dynamics Trajectories},
    author = {McGibbon, Robert T. and Beauchamp, Kyle A. and Harrigan, Matthew P. and Klein, Christoph and Swails, Jason M. and Hern{\'a}ndez, Carlos X.  and Schwantes, Christian R. and Wang, Lee-Ping and Lane, Thomas J. and Pande, Vijay S.},
    journal = {Biophysical Journal},
    volume = {109},
    number = {8},
    pages = {1528 -- 1532},
    year = {2015},
    doi = {10.1016/j.bpj.2015.08.015}


MDTraj is licensed under the Lesser GNU General Public License (LGPL v2.1+).