chematic-inchi
InChI and InChIKey generation for Rust. Two modes:
| Mode | Function | Compliance | WASM |
|---|---|---|---|
Standard (native-inchi feature) |
standard_inchi / standard_inchi_key |
Bit-exact with IUPAC InChI 1.07.5 | No (requires C compiler) |
| Approximate (default) | inchi / inchi_key |
Non-standard — different canonical order, no tautomer normalization | Yes (zero C deps) |
Standard IUPAC InChI (native-inchi feature)
Enable the native-inchi feature to link the vendored IUPAC InChI C library (v1.07.5, MIT).
Output is bit-exact with the reference implementation.
[]
= { = "0.4", = ["native-inchi"] }
use ;
use parse;
let mol = parse.expect;
let inchi_str = standard_inchi.unwrap;
// Produces the IUPAC-standard InChI (canonical order matches reference):
// InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H
let key = standard_inchi_key.unwrap;
assert_eq!;
All layers are handled by the IUPAC reference library: formula, connectivity, hydrogen, tautomer normalization, mobile-H, stereo (/t, /m, /s), charge (/q, /p), and isotope (/i).
Approximate InChI (WASM / zero-C-dependency fallback)
The default inchi() / inchi_key() functions are not standard IUPAC InChI. They use
a different canonical ordering and do not implement tautomer or mobile-H normalization.
Use them only when WASM compatibility or a zero-C-dependency build is required.
use inchi;
use parse;
let mol = parse.expect;
// Non-standard approximation — does NOT match the IUPAC reference:
let approx = inchi;
Dependencies
chematic-core— molecular graph typeschematic-smiles— SMILES parserchematic-chem— CIP rules for stereo assignmentsha2— SHA-256 for approximate InChIKey hashcc(optional,native-inchionly) — C compiler for vendored IUPAC library
References
- IUPAC InChI standard: https://iupac.org/what-we-do/inchi/
- InChI Trust: https://www.inchi-trust.org/
See Also
chematic— main umbrella cratechematic-smiles— SMILES I/Ochematic-depict— SVG 2D structure drawing