MDTraj Used by MolForge
Fast, lightweight trajectory analysis that fits the scientific Python stack.
Tool 044 of 100 in the MolForge directory of open-source tools. Every fact below was read from the repository's host on 2026-11-28.

What MDTraj is
MDTraj is a Python library for loading and analysing molecular dynamics trajectories. It represents a trajectory as a NumPy array of coordinates attached to a Topology object, so the usual scientific Python tools, from NumPy and SciPy to scikit-learn and matplotlib, apply directly. The design favours a small, consistent API: load a file, select atoms with a text query, call a function, get an array.
MDTraj reads DCD, XTC, TRR, AMBER NetCDF and restart files, its own HDF5 format, PDB, MOL2, LAMMPS and Tinker trajectories among others, and the mdconvert command-line tool translates between them. Analysis functions compute RMSD, distances, angles and dihedrals, radius of gyration, secondary structure by DSSP, hydrogen bonds with several criteria, solvent-accessible surface area, contact maps and NMR observables such as predicted chemical shifts and scalar couplings. It is the trajectory layer beneath OpenMM reporters, MSMBuilder and nglview, and feeds feature matrices to deeptime for Markov modelling.
MDTraj centres on proteins and nucleic acids; it has less to offer for materials or coarse-grained systems without a conventional topology.
Features
- Loaders for DCD, XTC, TRR, NetCDF, HDF5, PDB, MOL2, LAMMPS and Tinker formats
- Atom selection by a text query language
- DSSP secondary structure, hydrogen bonds, SASA and contact maps
- Distances, angles, dihedrals, RMSD and radius of gyration as NumPy arrays
- NMR observables: chemical shift prediction and scalar couplings
- mdconvert command-line tool and OpenMM trajectory reporters
What it is for
- Compute secondary structure and hydrogen bonds along a protein trajectory
- Convert between trajectory formats from the command line
- Build feature vectors of distances and dihedrals for Markov state models
- Load simulation output into NumPy for custom analysis
Verified facts
| Family | Trajectory analysis and Markov state models |
|---|---|
| Language or basis | Python |
| Repository | https://github.com/mdtraj/mdtraj (GitHub) |
| Licence | LGPL-2.1 (SPDX identifier as declared in the repository) |
| Main language on GitHub | Python |
| Last commit | 2026-11-03 |
| Latest release | 1.11.2 (2026-10-05) |
| Stars | 746 on 2026-11-28 |
| Open issues and pull requests | 129 on 2026-11-28 |
| Repository created | 2012-11-08 |
| Verified | 2026-11-28 by MolForge's checking script, against the host's API |
Where MDTraj fits
Turn molecular-dynamics output into observables: RMSD, radial distributions, diffusion, kinetics.
MDTraj appears in this chain of the directory: Biomolecular molecular dynamics.
Questions people ask
- How is MDTraj different from MDAnalysis?
- MDTraj loads a trajectory into memory as NumPy arrays and offers a compact functional API with protein-centred analyses such as DSSP and NMR predictions. MDAnalysis streams frames, supports more formats and exposes a richer object model of atoms, residues and segments. They overlap heavily and are often used together.
- Can MDTraj compute secondary structure?
- Yes. mdtraj.compute_dssp implements the DSSP algorithm and returns per-residue assignments for every frame, in either the full eight-state or a simplified three-state scheme. It needs backbone atoms including hydrogens or will infer them where possible.
- Does MDTraj load the whole trajectory into memory?
- By default, yes, which is convenient but limits size. The iterload function reads chunks of frames in sequence, and the stride and atom_indices arguments reduce what is loaded. For very long trajectories people iterate over chunks or use the HDF5 format for random access.
- Is MDTraj open source?
- Yes. The repository declares the LGPL-2.1 licence (SPDX identifier read from the host on 2026-11-28). Read the licence text in the repository before redistributing or embedding it.
- Where is the MDTraj source code?
- At https://github.com/mdtraj/mdtraj (GitHub). This is the address the host reported on the day of verification; renamed repositories are followed to their new home.
- Is MDTraj still maintained?
- The last commit was pushed on 2026-11-03 and the latest tagged release is 1.11.2 from 2026-10-05; the repository had 129 open issues and pull requests on 2026-11-28.
- Does MolForge use MDTraj?
- MDTraj 1.10.1 reads the trajectories our dynamics tool produces and computes RMSD and the other observables shown after a run.
How MolForge uses MDTraj
MDTraj 1.10.1 reads the trajectories our dynamics tool produces and computes RMSD and the other observables shown after a run.
Test status
Indirect coverage through the dynamics tests and QA test MF-44.