omgkit
What is it?
omgkit is a cheminformatics toolkit written in Rust, with Python bindings. It is built around a columnar molecule representation so that large batches stay cheap to traverse, split across threads, and hand off to numpy or Arrow without a copy.
- BSD-3-Clause license
- Core data structures and algorithms in Rust, no
unsafe - Python 3.9+ wrapper built with PyO3 and maturin — one abi3 wheel covers every supported version, and there are no system dependencies
- SMILES parsing and writing, including tetrahedral chirality, double-bond geometry, dative bonds and explicit hydrogens
- Canonical SMILES
- A sanitization pipeline: valence, implicit hydrogens, ring perception, kekulization, aromaticity, conjugation, hybridization
- SMARTS parsing, substructure matching (VF2++, optionally stereo-aware), and SMARTS writing for both molecules and reactions
- Reaction templates and product generation, with optional atom-atom mapping
- Reconstruction of the fragments a template discards (the water an esterification drops) into balanced byproduct molecules — or an explicit "cannot tell" when the record itself does not balance
- Columnar batches (
MolBatch) with zero-copy per-molecule views
Status: under development. The API still changes between commits. Every layer is checked against an external reference implementation record by record (see Documentation), but the surface is not yet stable enough for production use. Bug reports are welcome.
Installation
Python
Requires maturin:
$ maturin build --release -m crates/omgkit-py/Cargo.toml --out dist
$ pip install dist/omgkit-*.whl
Rust
[]
= { = "https://github.com/zbc0315/omgkit" } # data structures
= { = "https://github.com/zbc0315/omgkit" } # SMILES / SMARTS
= { = "https://github.com/zbc0315/omgkit" } # sanitization
= { = "https://github.com/zbc0315/omgkit" } # matching, reactions
Take only the layers you need; each depends only on the ones below it.
Getting started
=
=
# molecule atom indices, in query atom order
=
,
The Rust equivalents live in omgkit_io::smiles, omgkit_chem::sanitize and
omgkit_match; see the crate documentation for runnable examples.
Documentation
docs/design.md— what each layer does, why it is built that way, and how each design choice was validatedharness/README.md— the differential-testing setup: how the oracles are generated and how a test is kept from passing vacuouslycargo doc --workspace --no-deps --open— API documentation
Contributing
Issues and pull requests are welcome. Four gates have to pass, and they are the same four that CI runs:
$ cargo fmt --all --check
$ cargo clippy --workspace --all-targets -- -D warnings
$ cargo test
$ cargo doc --workspace --no-deps
cargo test is green on a fresh clone: the smoke oracles are committed. The
large-corpus tier is marked #[ignore] and needs oracles you generate yourself
— see harness/README.md.
License
Code released under the BSD-3-Clause license.
Test corpora and the element table are redistributed from other projects and
carry their own terms; each file is traced to its origin in
THIRD-PARTY-NOTICES.md.