Expand description
InChI and InChIKey generation and parsing.
§Default (pure Rust, WASM-compatible)
inchi and inchi_key are a pure-Rust, FFI-free approximation.
They are not bit-exact with the IUPAC reference implementation.
Use them when WASM compatibility or zero C dependencies are required.
§Standard InChI (native-inchi feature)
Enable the native-inchi Cargo feature to build with the vendored
IUPAC InChI C library (v1.07.5, MIT license). This provides
[standard_inchi] and [standard_inchi_key] which produce output
bit-exact with the IUPAC reference. Requires a C compiler; not
available for WASM targets.
[dependencies]
chematic-inchi = { version = "0.4", features = ["native-inchi"] }§Examples
ⓘ
use chematic_smiles::parse;
use chematic_inchi::{inchi, parse_inchi};
let mol = parse("c1ccccc1").expect("benzene");
let inchi_str = inchi(&mol);
// Parse InChI back to Molecule
let mol2 = parse_inchi(&inchi_str).expect("parse");
assert_eq!(mol2.atom_count(), 6);Re-exports§
pub use parser::InchiParseError;pub use parser::parse_inchi;
Modules§
Functions§
- build_
inchi_ index - Build a mapping from AtomIdx to InChI 1-indexed atom numbers (excluding H).
- inchi
- Generate an InChI-like string for a molecule using the pure-Rust implementation.
- inchi_
key - Generate an InChIKey from an InChI string using the pure-Rust implementation.
- reaction_
inchi - Simplified Reaction InChI (not IUPAC-standard, WASM-compatible).
- reaction_
inchi_ key - Compute an RInChIKey from a
reaction_inchi()string.