Overview
In warp-md, Plans are the analysis primitives. Each Plan:- Compiles a specific analysis (RMSD, Rg, RDF, etc.)
- Validates inputs at construction time
- Executes on CPU or GPU via the
run()method
traj-engine crate) and exposed to Python via bindings.
The Plan Lifecycle
1. Create Plan
Instantiate with aSelection and parameters:
Plan construction is cheap. Validation happens immediately, but no trajectory I/O occurs until
run().2. Run Plan
Execute over the trajectory:Common Plan Interface
All Plans follow this signature:Parameters
The trajectory to analyze. Must match
system.n_atoms().The system providing topology and atom metadata.
Execution device:
"auto": Use CUDA GPU if available, else CPU"cpu": Force CPU execution"cuda": Use GPU device 0"cuda:1": Use GPU device 1
crates/traj-engine/src/executor.rs:21-52:Number of frames to read per I/O chunk. Larger values improve throughput but increase memory usage.Tuning advice:
- Small trajectories: 128-512
- Large trajectories: 64-128
- GPU runs: 256-1024 (GPUs amortize transfer overhead)
Optional list of frame indices to analyze. Supports negative indexing.From
crates/traj-engine/src/executor.rs:200-212:Example Plans
Radius of Gyration
Frompython/warp_md/__init__.py:12:
RMSD with Alignment
Distance Between Selections
Clustering Trajectories
Frompython/warp_md/tests/test_clustering.py:32-76:
Plan Catalog
Frompython/warp_md/__init__.py:8-107, 96 Plans are available:
RMSD & Structural
RMSD & Structural
RmsdPlan— RMSD with optional alignmentRmsdPerResPlan— Per-residue RMSDRmsfPlan— Root mean square fluctuationSymmRmsdPlan— RMSD with symmetry equivalentsDistanceRmsdPlan— Distance-based RMSD (dRMSD)PairwiseRmsdPlan— All-vs-all RMSD matrix
Geometry & Coordinates
Geometry & Coordinates
RgPlan— Radius of gyrationRadgyrTensorPlan— Gyration tensor eigenvaluesDistancePlan— Distance between two selectionsPairDistPlan— Distance between atom pairsAnglePlan— Bond anglesDihedralPlan— Dihedral anglesVectorPlan— Geometric vectors
Transformations
Transformations
AlignPlan— Align trajectory to referenceSuperposePlan— Superpose structuresTranslatePlan— Translate coordinatesRotatePlan— Rotate coordinatesScalePlan— Scale coordinatesTransformPlan— Apply transformation matrix
Analysis & Clustering
Analysis & Clustering
TrajectoryClusterPlan— Cluster frames (DBSCAN/k-means)PcaPlan— Principal component analysisProjectionPlan— Project onto modesMatrixPlan— Covariance/correlation matrix
Dynamics & Correlation
Dynamics & Correlation
MsdPlan— Mean square displacementAtomicCorrPlan— Atomic correlation functionsVelocityAutoCorrPlan— Velocity autocorrelationXcorrPlan— Cross-correlationRotAcfPlan— Rotational autocorrelation
Solvation & Grid
Solvation & Grid
RdfPlan— Radial distribution functionDensityPlan— 3D density gridVolmapPlan— Volumetric mapGistGridPlan— GIST analysis (grid-based)GistDirectPlan— GIST analysis (direct)HbondPlan— Hydrogen bond analysis
NMR & Spectroscopy
NMR & Spectroscopy
NmrIredPlan— NMR relaxation (iRED)WaveletPlan— Wavelet transform
Polymer Metrics
Polymer Metrics
EndToEndPlan— End-to-end distanceContourLengthPlan— Contour lengthChainRgPlan— Radius of gyration per chainPersistenceLengthPlan— Persistence lengthBondLengthDistributionPlan— Bond length distributionBondAngleDistributionPlan— Bond angle distribution
See the API Reference for complete documentation of all 96 Plans.
Execution Model
Fromcrates/traj-engine/src/executor.rs:74-78:
Executor:
- Chunk reading: Trajectory read in chunks (size =
chunk_frames) - Device dispatch: Coords copied to CPU/GPU
- Kernel execution: Plan-specific compute (Rust or CUDA)
- Accumulation: Results aggregated across chunks
- Finalization: Return NumPy array
Streaming vs Batch
Most Plans stream data:PairwiseRmsdPlan(all-vs-all matrix)TrajectoryClusterPlan(DBSCAN/k-means)PcaPlan(covariance matrix)
Error Handling
Plans raise Python exceptions on errors:- Atom count mismatch:
Trajectory has 1000 atoms, System has 999 - Invalid selection:
Selection contains out-of-bounds indices - Device error:
CUDA unavailable; rebuild with --features cuda
See Also
- Systems and Trajectories — Loading data
- Selections — Atom selection syntax
- Devices — CPU vs GPU execution
- API Reference — All 96 Plans