chematic-inchi
Pure Rust InChI and InChIKey generation for IUPAC standard organic molecules. WASM-compatible, zero C/C++ dependencies.
Features
- InChI string generation: formula, connectivity, hydrogen, stereo (R/S, E/Z), charge, and isotope layers
- InChIKey generation: 27-character deterministic identifier
- Ring closure bonds: correctly appends back-edge bonds to connectivity layer
- Stereo chemistry: tetrahedral (R/S) and double-bond (E/Z) stereo layers via CIP rules
- WASM-compatible: no FFI, compiles to WebAssembly
Quick Start
use inchi;
use parse;
let mol = parse.expect;
let inchi_str = inchi;
assert_eq!;
// Generate InChIKey
let key = inchi_key;
assert_eq!;
Dependencies
chematic-core— molecular graph typeschematic-smiles— SMILES parserchematic-chem— CIP rules for stereo assignmentsha2— SHA256 for InChIKey hash
Layers Generated
| Layer | Description | Example |
|---|---|---|
/c |
Connectivity (atom adjacency) | /c1-2-3-4-5-6-1 |
/h |
Hydrogen count per atom | /h1-6H |
/b |
E/Z double bond stereo | /b2-3- |
/t |
R/S tetrahedral stereo | /t2- |
/q |
Formal charge (if net ≠ 0) | /q+1 |
/i |
Isotope information (if present) | /i1D |
References
- IUPAC InChI standard: https://iupac.org/what-we-do/inchi/
- InChI layer structure: https://www.inchi-trust.org/
See Also
chematic— main umbrella cratechematic-smiles— SMILES I/Ochematic-depict— SVG 2D structure drawing