chematic-inchi 0.1.94

Pure Rust InChI and InChIKey generation for IUPAC standard organic molecules (WASM-compatible)
Documentation

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 chematic_inchi::inchi;
use chematic_smiles::parse;

let mol = parse("c1ccccc1").expect("benzene");
let inchi_str = inchi(&mol);
assert_eq!(inchi_str, "InChI=1S/C6H6/c1-2-3-4-5-6-1/h1-6H");

// Generate InChIKey
let key = chematic_inchi::inchi_key(&inchi_str);
assert_eq!(key.len(), 27);

Dependencies

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

See Also