pytraj
The Python interface to cpptraj from AmberTools, efficient on large data sets.
Tool 045 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 pytraj is
pytraj is the Python interface to cpptraj, the trajectory analysis program of AmberTools. cpptraj implements a large set of actions, from RMSD fitting and hydrogen-bond detection to clustering and nucleic-acid structure analysis, controlled by a command language. pytraj exposes those actions as Python functions that return NumPy arrays, so that Amber users can analyse trajectories in a notebook while reusing the same compiled routines they already know from cpptraj.
Trajectories are loaded with an Amber prmtop or any topology cpptraj understands, and frames can be read into memory or iterated out of core for large data sets. pytraj reads Amber NetCDF and ASCII trajectories, restarts, DCD, XTC, TRR, PDB and MOL2, and writes most of them. Functions cover distances, dihedrals, radius of gyration, RMSD and RMSF, hydrogen bonds, native contacts, DSSP, atomic fluctuations, water shells, volume maps, matrices for principal component analysis and clustering. Any cpptraj command string can also be passed directly. It installs with AmberTools and works alongside ParmEd.
pytraj depends on cpptraj and therefore on an AmberTools installation; its documentation assumes familiarity with cpptraj concepts and Amber mask syntax.
Features
- Python bindings to the cpptraj action library with NumPy output
- Out-of-core iteration over large trajectories and MPI parallelism through mpi4py
- Amber atom mask syntax for selecting atoms and residues
- RMSD, hydrogen bonds, native contacts, DSSP, clustering and PCA matrices
- Readers for Amber NetCDF, DCD, XTC, TRR, PDB and MOL2 files
- Direct execution of cpptraj command strings from Python
What it is for
- Analyse Amber simulations in a Jupyter notebook with cpptraj actions
- Cluster conformations and compute principal components across a trajectory
- Measure hydration shells and water residence around a solute
- Process large trajectories in parallel across MPI ranks
Verified facts
| Family | Trajectory analysis and Markov state models |
|---|---|
| Language or basis | Python |
| Repository | https://github.com/Amber-MD/pytraj (GitHub) |
| Licence | No licence detected by GitHub; read the repository before reuse |
| Main language on GitHub | Jupyter Notebook |
| Last commit | 2026-03-06 |
| Latest release | v.2.0.5 (2020-05-04) |
| Stars | 192 on 2026-11-28 |
| Open issues and pull requests | 39 on 2026-11-28 |
| Repository created | 2015-02-02 |
| Verified | 2026-11-28 by MolForge's checking script, against the host's API |
Where pytraj fits
Turn molecular-dynamics output into observables: RMSD, radial distributions, diffusion, kinetics.
Questions people ask
- Do I need Amber to use pytraj?
- You need AmberTools, which is free and includes cpptraj and pytraj, available through conda. The commercial Amber MD engine is not required, and pytraj reads trajectories from other engines in DCD, XTC or TRR format as long as a compatible topology is provided.
- How is pytraj different from cpptraj?
- They share the same engine. cpptraj is a command-line program driven by scripts of text commands; pytraj wraps those routines as Python functions returning NumPy arrays and adds Python-side conveniences such as out-of-core iteration and integration with matplotlib and pandas. Anything cpptraj can do is reachable from pytraj.
- How is pytraj different from MDAnalysis or MDTraj?
- pytraj inherits cpptraj's action set, including nucleic-acid analysis, clustering and Amber-specific features, and uses Amber mask syntax. MDAnalysis and MDTraj are independent libraries with their own selection languages and broader format support outside the Amber ecosystem. Users already in Amber workflows tend to prefer pytraj.
- Where is the pytraj source code?
- At https://github.com/Amber-MD/pytraj (GitHub). This is the address the host reported on the day of verification; renamed repositories are followed to their new home.
- Is pytraj still maintained?
- The last commit was pushed on 2026-03-06 and the latest tagged release is v.2.0.5 from 2020-05-04; the repository had 39 open issues and pull requests on 2026-11-28.
- Does MolForge use pytraj?
- No. MolForge runs nine of the hundred tools in this directory (RDKit, OpenMM, AutoDock Vina, Open Babel, MDTraj, pymbar and NGL, plus PySCF and xTB in MFsig); pytraj is listed because of its place in trajectory analysis and Markov state models, not because we run it.
Our comments on pytraj
MolForge does not run pytraj in production. This page is a verified pointer, not a review: the facts above come from the repository on the date shown, the description is ours, and we make no claim about accuracy or speed that we have not measured. If you maintain pytraj and something here is wrong or out of date, write to hello@molforge.ai and we will correct the source file.
Test status
Not tested by MolForge. To check pytraj yourself: clone the repository, follow the installation section of its README, and run the test suite the project ships before trusting a result; the last-commit date and the open issue count above tell you how alive the project is.