Skip to content

Rust API

The Rust API documentation is generated by rustdoc.

Crate Documentation
omgkit-core docs.rs/omgkit-core
omgkit-io docs.rs/omgkit-io
omgkit-chem docs.rs/omgkit-chem
omgkit-match docs.rs/omgkit-match
omgkit-conf docs.rs/omgkit-conf
omgkit-depict docs.rs/omgkit-depict

Or build it from a clone, which also documents the Python binding crate:

git clone https://github.com/zbc0315/omgkit
cd omgkit
cargo doc --workspace --no-deps --open

The crates

Crate Depends on Contains
omgkit-core MolBuilder, MolBatch, MolView, MolBatchBuilder, the scalar types (BondOrder, chirality, stereo, atom and bond flags)
omgkit-io core smiles — parsing and writing; smarts — query and reaction parsing and writing; molblock — V2000 and SDF, read and written; canon — canonical ranks; stereo — reading stereochemistry off coordinates
omgkit-chem core sanitize and the individual stages: valence, implicit hydrogens, rings, kekulization, aromaticity, conjugation, hybridization. Also two consumers of that output rather than stages of it: gasteiger — partial charges (PEOE); descriptors — the per-atom and per-bond values a graph model reads
omgkit-match core, io, chem substructure matching (VF2++-style ordering), MolProps, reaction application (run_reactants, run_on_substrate), byproduct reconstruction
omgkit-conf core, io, chem deterministic 3D structure generation: bounds matrix, triangle smoothing, metric-matrix embedding, L-BFGS refinement — see 3D structures
omgkit-depict core, io, chem, conf 2D coordinate generation and structure drawing, plus 3D figures; SVG with no dependencies, PNG/JPEG behind the raster feature — see Drawing structures
omgkit-py all the Python extension module — a cdylib, not published to crates.io; its distribution channel is the wheel

Documentation gates

Two lints are set to deny across the workspace, so the API documentation cannot drift:

[workspace.lints.rust]
missing_docs = "warn"

[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
private_intra_doc_links = "deny"
redundant_explicit_links = "deny"

Every public item is documented — cargo doc reports zero missing_docs warnings. Broken links are a build failure, not a warning: without a gate they accumulate silently (one sweep found 16, all historical).

Equivalents of the Python calls

Python Rust
omgkit.parse_smiles omgkit_io::smiles::parse
omgkit.parse_smarts omgkit_io::smarts::parse
omgkit.parse_reaction omgkit_io::smarts::parse_reaction
Mol.sanitize omgkit_chem::sanitize
Mol.to_canonical_smiles omgkit_io::canon::canonical_smiles
Query.match omgkit_match matching entry points
Reaction.run omgkit_match::run_reactants
Reaction.run_on_substrate omgkit_match::run_on_substrate
Mol.atom_descriptors omgkit_chem::atom_descriptors
Mol.bond_descriptors omgkit_chem::bond_descriptors

Names are indicative; see the generated documentation for exact signatures.

One difference worth knowing: Mol.sanitize() on the Python side runs two Rust calls — omgkit_chem::sanitize and then omgkit_io::stereo::perceive_bond_stereo, which turns the / and \ of the input into the double bond's own cis/trans property. Rust callers have to make that second call themselves. Skipping it does not raise; it leaves every double bond's geometry unset, so bond_descriptors reports BondStereo::None throughout and writing the molecule back out loses the geometry. The reason the two are separate is that stereo perception needs symmetry classes, which live in omgkit-io, a sibling of omgkit-chem rather than a dependency.