Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

molex

molex (molecular exchange) is a Rust library for parsing, analyzing, transforming, and serializing molecular structure data. It supports PDB, mmCIF, BinaryCIF, MRC/CCP4 density maps, and DCD trajectories.

Key concepts

  • MoleculeEntity represents a single molecule: a protein chain, a DNA/RNA strand, a ligand, an ion, or a group of waters. Parsing a structure file produces a Vec<MoleculeEntity>.

  • Assembly is the top-level host container: it owns the entities, cross-entity bonds (disulfides), per-entity DSSP secondary structure, and backbone H-bonds, with a generation counter that increments on every mutation.

  • Atom holds a position, element, atom name, occupancy, and B-factor. Residue and chain context live on the entity that contains the atom.

  • AtomId and CovalentBond are the cross-cutting identifiers: bonds reference atoms by AtomId { entity, index } so they remain addressable across reorderings.

  • Coords is a flat binary serialization format used for FFI and IPC. ASSEM01 is the entity-aware counterpart that round-trips molecule type metadata.

  • Analysis includes covalent bond inference, DSSP hydrogen bond detection, disulfide bridges, secondary structure classification, AABBs, and volumetric/SES utilities.

  • VoxelGrid and Density represent 3D volumetric data (electron density, cryo-EM maps).

Crate features

FeatureDescription
defaultCore Rust library (no Python)
pythonPyO3 bindings + AtomWorks interop

API documentation

For the full Rust API reference, run:

cargo doc --open --document-private-items