Skip to main content

Crate chematic_inchi

Crate chematic_inchi 

Source
Expand description

Pure Rust InChI and InChIKey generation and parsing for IUPAC standard molecules.

Generates deterministic InChI strings (formula, connectivity, hydrogen, charge, isotope layers) and parses InChI strings back to Molecule representation (simple molecules). Fully WASM-compatible, FFI-free.

§Examples

use chematic_smiles::parse;
use chematic_inchi::{inchi, parse_inchi};

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");

// Parse InChI back to Molecule
let mol2 = parse_inchi(&inchi_str).expect("parse");
assert_eq!(mol2.atom_count(), 6);

Re-exports§

pub use parser::parse_inchi;
pub use parser::InchiParseError;

Modules§

key
layers
parser
InChI string parser — reconstruct Molecule from InChI representation.

Functions§

build_inchi_index
Build a mapping from AtomIdx to InChI 1-indexed atom numbers (excluding H).
inchi
Generate InChI string for a molecule.
inchi_key
Generate InChIKey (27-character alphanumeric identifier) from an InChI string.