Overview
Every warp-md analysis starts with two fundamental objects:- System: The topology — atom names, residues, chains, masses
- Trajectory: The coordinate time-series — positions over time
traj-core crate via Python bindings.
System Class
TheSystem represents molecular topology and metadata.
Loading a System
System Methods
Returns the number of atoms in the system.
Compile and execute an atom selection expression. Results are cached.See Selections for syntax details.
Returns raw atom data as a dictionary with keys:
name: List of atom namesresname: List of residue namesresid: List of residue IDs (integers)chain_id: List of chain identifiersmass: List of atomic masses (float)element_id: Element type identifiers
Internal Structure
Fromcrates/traj-core/src/system.rs:29-52:
- atoms: Column-oriented storage for atom properties
- interner: String deduplication (names, residues, chains)
- positions0: Optional reference coordinates from topology file
- selection_cache: Compiled selections for reuse
The
System caches compiled selections. Calling system.select("backbone") multiple times returns the cached result without re-parsing.Trajectory Class
TheTrajectory reads coordinate frames from disk.
Opening a Trajectory
Trajectory Methods
Number of atoms per frame (must match system).
Total number of frames in the trajectory.
Read up to
max_frames frames. Returns None at EOF.Returns dict with:coords: np.ndarray shape(n_frames, n_atoms, 3), dtypefloat32box: Optional box vectorstime: Optional timestamps
Format Support
Frompython/warp_md/io.py:7:
| Format | Extension | Source | Notes |
|---|---|---|---|
| XTC | .xtc | GROMACS | Compressed, nanometer → Angstrom |
| DCD | .dcd | CHARMM/NAMD | Binary, specify length_scale |
| PDB | .pdb | Multi-MODEL | Text-based, slower |
| PDBQT | .pdbqt | AutoDock | Like PDB with charges |
Putting It Together
Typical workflow:The
system object is passed to both Trajectory.open_*() (for validation) and plan.run() (for atom metadata).See Also
- Selections — Atom selection syntax
- Analysis Plans — Using Plans to compute observables
- Devices — CPU vs GPU execution