trajectory
Analyze MD trajectories frame by frame. Every subcommand reads a topology
and a trajectory file and writes results to a signed .pta HDF5 artifact.
Supported topology formats: .tpr, .prmtop, .parm7, .psf, .dms
Supported trajectory formats: .xtc, .trr, .dcd, .nc
Tip
Pre-image your trajectory with the MD engine instead of relying on
-at. Several subcommands accept -at / --add-transformations to
unwrap → center → wrap a periodic system on the fly, but that pipeline is
lazy: MDAnalysis re-evaluates it on every frame of every run, so the
cost is paid again on each analysis and can dominate the total runtime.
The strongly recommended workflow is to image the trajectory once with
your engine’s native, C/Fortran tooling and feed that cleaned trajectory to
Pharmacon without -at — it is dramatically faster and numerically
identical:
GROMACS —
gmx trjconv -pbc wholethengmx trjconv -center -pbc mol -ur compactAmber / cpptraj —
autoimagethencenter+image familiarCHARMM / NAMD (VMD) — the
pbctoolsplugin (pbc unwrap/pbc wrap)
Reach for -at only as a convenience when you cannot pre-process. See
Periodic Boundary Conditions (PBC) for the full rationale and engine-specific commands.
rmsd
Calculate Root Mean Square Deviation of atomic positions relative to a reference frame. Supports multiple selections per run with a dedicated fitting (alignment) group.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
One or more MDAnalysis selection strings for RMSD calculation |
|
Yes |
Label for each selection (must match count of |
|
Yes |
MDAnalysis selection used for structural alignment before RMSD |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Frame index used as RMSD reference (default: 0) |
|
No |
First frame to process (default: 0) |
|
No |
Last frame to process (default: last) |
|
No |
Process every Nth frame (default: 1) |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
Examples
RMSD of C-alpha atoms aligned on C-alpha:
pharmacon trajectory rmsd \
-p topol.tpr \
-x traj.xtc \
-o rmsd.pta \
-sel "protein and name CA" \
-f "protein and name CA" \
-n calpha
Multiple selections in a single run (backbone, C-alpha, and ligand):
pharmacon trajectory rmsd \
-p topol.tpr \
-x traj.xtc \
-o rmsd.pta \
-sel "protein and name CA" "backbone" "resname LIG and not name H*" \
-f "protein and name CA" \
-n calpha backbone ligand_heavy
Process frames 100–500 with stride 5, using frame 100 as reference:
pharmacon trajectory rmsd \
-p topol.tpr \
-x traj.xtc \
-o rmsd_subset.pta \
-sel "protein and name CA" \
-f "protein and name CA" \
-n calpha \
-b 100 -e 500 -s 5 -r 100
Full run with debug logging:
pharmacon trajectory rmsd \
-p protein.prmtop \
-x md.nc \
-sel "protein and name CA" "resname LIG and not name H*" \
-n bb_ca ligand_heavy \
-f "protein and name CA" \
-r 0 -b 0 -e 10000 -s 10 \
-o rmsd.pta \
-l rmsd.log -fl DEBUG -tl WARNING
rmsf
Calculate per-atom Root Mean Square Fluctuation (RMSF) over a trajectory.
The trajectory is aligned in-memory on the fitting group, then rms.RMSF
is computed for each selection. By default alignment is two-pass (align to
the initial frame, build the average structure, then re-align to it); pass
-r to align to a single reference frame instead.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
One or more MDAnalysis selection strings for per-atom RMSF |
|
Yes |
Label for each selection (must match count of |
|
Yes |
MDAnalysis selection used for in-memory alignment before RMSF |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Frame index used as the alignment reference; omit to align to the average structure (two-pass, recommended) |
|
No |
First frame to process (default: 0) |
|
No |
Last frame to process (default: last) |
|
No |
Process every Nth frame (default: 1) |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
Examples
Per-atom RMSF of C-alpha atoms (two-pass alignment to the average structure):
pharmacon trajectory rmsf \
-p topol.tpr \
-x traj.xtc \
-o rmsf.pta \
-sel "protein and name CA" \
-f "protein and name CA" \
-n calpha
Multiple selections aligned to a single reference frame:
pharmacon trajectory rmsf \
-p topol.tpr \
-x traj.xtc \
-o rmsf.pta \
-sel "protein and name CA" "backbone" \
-f "protein and name CA" \
-n calpha bb \
-r 0
distances
Compute pairwise or group-to-group distance time series between user-defined atom selections. Supports minimum-distance, maximum-distance, centre-of-mass, and centre-of-geometry modes with PBC awareness.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
First atom group selection(s) |
|
Yes |
Second atom group selection(s) |
|
Yes |
Distance method per pair: |
|
Yes |
Label for each distance pair |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
All four lists (-sel1, -sel2, -m, -n) must have the same
number of entries.
Distance methods:
MIN — minimum distance between any atom pair across the two groups
MAX — maximum distance between any atom pair across the two groups
COM — distance between the centres of mass
COG — distance between the centres of geometry
Examples
Centre-of-mass distance between ligand and C-alpha atoms:
pharmacon trajectory distances \
-p topol.tpr \
-x traj.xtc \
-o distances.pta \
-sel1 "resname LIG" \
-sel2 "protein and name CA" \
-m COM \
-n lig_to_ca
Multiple distance pairs in one run:
pharmacon trajectory distances \
-p topol.tpr \
-x traj.xtc \
-o distances.pta \
-sel1 "resname LIG" "resname LIG" \
-sel2 "resid 45" "resid 102" \
-m MIN MIN \
-n lig_res45 lig_res102
With PBC unwrapping enabled:
pharmacon trajectory distances \
-p topol.tpr \
-x traj.xtc \
-o distances_pbc.pta \
-sel1 "protein" \
-sel2 "resname LIG" \
-m COM \
-n prot_lig \
--add-transformations
angles
Measure geometric angles across a trajectory. Three measurement types are supported:
Three-atom angle — select three atoms; Pharmacon measures the angle at the central atom. Example selection:
"index 10 or index 11 or index 12"Vector angle — define two vectors using the
->syntax; Pharmacon measures the angle between the two vectors. Example:"index 10 or index 100 -> index 300 or index 301"Dihedral / torsion angle — select four atoms; Pharmacon measures the torsion around the central bond. Example:
"index 10 or index 11 or index 12 or index 13"
All calculations are PBC-aware when box dimensions are available.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
Selection strings defining each angle (see syntax above) |
|
Yes |
Label for each angle measurement |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
Examples
Vector angle relative to the x-axis:
pharmacon trajectory angles \
-p topol.tpr \
-x traj.xtc \
-o angles.pta \
-sel "index 4 or index 5 -> x-axis" \
-n vector1
Dihedral angle of a backbone torsion:
pharmacon trajectory angles \
-p topol.tpr \
-x traj.xtc \
-o angles.pta \
-sel "index 10 or index 11 or index 12 or index 13" \
-n phi_backbone
Multiple angle measurements in one run:
pharmacon trajectory angles \
-p topol.tpr \
-x traj.xtc \
-o angles.pta \
-sel "index 4 or index 5 -> x-axis" "index 10 or index 11 -> z-axis" \
-n vec1 vec2
h-bonds
Detect and count hydrogen bonds over a trajectory using donor–acceptor geometry with distance and angle criteria. Produces a focused output of hydrogen-bond records only. Useful when the hydrogen-bonding network is the sole interest; for full interaction profiling see pl-interactions.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
Atom group to analyse for hydrogen bonds |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Number of parallel worker processes (default: 1) |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
Examples
Hydrogen bonds within the protein:
pharmacon trajectory h-bonds \
-p topol.tpr \
-x traj.xtc \
-o hbonds.pta \
-sel "protein"
Use 4 parallel workers for faster processing:
pharmacon trajectory h-bonds \
-p topol.tpr \
-x traj.xtc \
-o hbonds.pta \
-sel "protein" \
--workers 4
Hydrogen bonds in chain A, every 10th frame:
pharmacon trajectory h-bonds \
-p topol.tpr \
-x traj.xtc \
-o hbonds_chainA.pta \
-sel "chainid A" \
-s 10
pl-interactions
Detect and quantify nine types of protein–ligand non-covalent interactions on a per-frame basis. Uses RDKit SMARTS pattern matching for accurate atom-type classification.
Detected interaction types:
Hydrophobic contacts — distance-based between non-polar atoms
Hydrogen bonds — donor–hydrogen–acceptor geometry
Ionic / salt-bridge — oppositely charged groups within cutoff
Halogen bonds — C–X···A geometry with angle validation
Metal contacts — metal ion coordination to electronegative atoms
Water bridges (1st degree) — single bridging water mediating an H-bond chain
Water bridges (2nd degree) — two bridging waters (not yet implemented)
Pi–cation — aromatic ring to charged group
Pi–stacking — parallel or T-shaped aromatic ring pairs
Each record includes full atom metadata (name, residue, chain, segment) for both partners plus interaction-specific geometric details.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
MDAnalysis selection for the protein / receptor |
|
Yes |
MDAnalysis selection for the ligand |
|
No |
MDAnalysis selection for water molecules (required for water-bridge detection) |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Number of parallel worker processes (default: 1) |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
Skip hydrophobic contact detection |
|
No |
Skip hydrogen-bond detection |
|
No |
Skip pi-stacking detection |
|
No |
Skip pi-cation detection |
|
No |
Skip ionic / salt-bridge detection |
|
No |
Skip water-bridge detection |
|
No |
Skip halogen-bond detection |
|
No |
Skip metal-contact detection |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Log file (default: |
Caution
Always scope the water selection dynamically around the ligand.
Prefer -w "resname WAT and around 5 resname LIG" over a global
-w "resname WAT". A global selection forces Pharmacon to test
every water molecule in the box for bridging on every frame, which
can dramatically increase runtime. Restricting waters to the
neighbourhood of the binding site yields identical results for the relevant
bridges at a fraction of the cost. (Adjust WAT/LIG and the
around cutoff to match your system.)
Examples
Full interaction profile with water bridges:
pharmacon trajectory pl-interactions \
-p topol.tpr \
-x traj.xtc \
-o pl_interactions.pta \
-prt "protein" \
-lig "resname LIG" \
-w "resname WAT and around 5 resname LIG"
Specific chain against the ligand, PBC-corrected:
pharmacon trajectory pl-interactions \
-p topol.tpr \
-x traj.xtc \
-o pl_interactions.pta \
-prt "chainid A" \
-lig "resname LIG" \
--add-transformations
Hydrophobic and hydrogen bonds only (all others disabled):
pharmacon trajectory pl-interactions \
-p topol.tpr \
-x traj.xtc \
-o pl_hbonds_hydro.pta \
-prt "protein" \
-lig "resname LIG" \
--disable-pi-stacking \
--disable-pi-cation \
--disable-ionic \
--disable-water-bridges \
--disable-halogen \
--disable-metal
Parallel processing with 8 workers:
pharmacon trajectory pl-interactions \
-p topol.tpr \
-x traj.xtc \
-o pl_interactions.pta \
-prt "protein" \
-lig "resname LIG" \
--workers 8
pp-interactions
Detect protein–protein non-covalent interactions between two chains or groups over a trajectory. Supports the same nine interaction types as pl-interactions.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
MDAnalysis selection for the first protein / chain |
|
Yes |
MDAnalysis selection for the second protein / chain |
|
No |
MDAnalysis selection for water molecules (required for water-bridge detection) |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Number of parallel worker processes (default: 1) |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
Skip hydrophobic contact detection |
|
No |
Skip hydrogen-bond detection |
|
No |
Skip pi-stacking detection |
|
No |
Skip pi-cation detection |
|
No |
Skip ionic / salt-bridge detection |
|
No |
Skip water-bridge detection |
|
No |
Skip halogen-bond detection |
|
No |
Skip metal-contact detection |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Log file (default: |
Caution
Always scope the water selection dynamically around the interface.
Prefer -w "resname WAT and around 5 chainid B" over a global
-w "resname WAT". A global selection forces Pharmacon to test
every water molecule in the box for bridging on every frame, which
can dramatically increase runtime. Restricting waters to the
neighbourhood of the protein–protein interface yields identical results for
the relevant bridges at a fraction of the cost. (Adjust the resname and the
around cutoff to match your system.)
Examples
Interactions between chain A and chain B:
pharmacon trajectory pp-interactions \
-p topol.tpr \
-x traj.xtc \
-o pp_interactions.pta \
-prt1 "chainid A" \
-prt2 "chainid B"
Interface between two specific residue ranges:
pharmacon trajectory pp-interactions \
-p topol.tpr \
-x traj.xtc \
-o pp_interface.pta \
-prt1 "resid 1:50" \
-prt2 "resid 51:100"
Parallel run keeping only H-bond and ionic interactions:
pharmacon trajectory pp-interactions \
-p topol.tpr \
-x traj.xtc \
-o pp_hbond_ionic.pta \
-prt1 "chainid A" \
-prt2 "chainid B" \
--disable-hydrophobic \
--disable-pi-stacking \
--disable-pi-cation \
--disable-water-bridges \
--disable-halogen \
--disable-metal \
--workers 4
pca
Principal Component Analysis on atomic positions over a trajectory. Outputs
eigenvalues (explained variance ratios), eigenvectors (principal components),
and per-frame projections. Results support scatter plots, time-series
projections, variance scree plots, free-energy surface (FES) heatmaps, and
probability density heatmaps via pharmacon plot pta.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
MDAnalysis selection of atoms to include in PCA |
|
No |
Number of principal components to retain (default: 3) |
|
No |
Output |
|
No |
Overwrite existing output file |
|
No |
Number of parallel worker processes (default: 1) |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
Examples
PCA on C-alpha atoms, 5 components:
pharmacon trajectory pca \
-p topol.tpr \
-x traj.xtc \
-o pca.pta \
-sel "protein and name CA" \
-c 5
PCA on backbone, 10 components, every 5th frame:
pharmacon trajectory pca \
-p topol.tpr \
-x traj.xtc \
-o pca_bb.pta \
-sel "backbone" \
-c 10 \
-s 5
Then generate all PCA plots:
pharmacon plot pta -i pca.pta -o pca_plots/ --overwrite
average-st
Compute the per-atom mean coordinates over a specified frame range, with optional alignment to a reference frame. Writes the average structure as a coordinate file for visualisation or further analysis.
Arguments
Flag |
Required |
Description |
|---|---|---|
|
Yes |
Input topology file |
|
Yes |
Input trajectory file |
|
Yes |
MDAnalysis selection of atoms to average |
|
No |
Output coordinate file (default: |
|
No |
Overwrite existing output file |
|
No |
Reference frame for alignment before averaging (default: 0) |
|
No |
First frame (default: 0) |
|
No |
Last frame (default: last) |
|
No |
Frame stride (default: 1) |
|
No |
Apply PBC wrap/unwrap transformations |
|
No |
Log file (default: |
|
No |
File log verbosity (default: |
|
No |
Terminal log verbosity (default: |
Examples
Average C-alpha structure over the full trajectory:
pharmacon trajectory average-st \
-p topol.tpr \
-x traj.xtc \
-o average.pdb \
-sel "protein and name CA" \
-r 0
Average over the last 500 frames:
pharmacon trajectory average-st \
-p topol.tpr \
-x traj.xtc \
-o average_last500.pdb \
-sel "protein" \
-b 500
Average every 10th frame using frame 50 as reference:
pharmacon trajectory average-st \
-p topol.tpr \
-x traj.xtc \
-o average_stride.pdb \
-sel "protein and name CA" \
-r 50 -s 10