chematic-rxn
Reaction SMILES and SMIRKS parser for Rust. Parses chemical transformations (reactants → products) and reaction patterns (transform rules). Pure Rust, RDKit-compatible, WASM-compatible.
Features
- Reaction SMILES parsing: parse reaction equations (e.g.,
CC(C)C>>CC(C)[O]) - SMIRKS parsing: transform patterns for reaction template matching
- Atom mapping: track which atoms in reactants map to which atoms in products
- Reaction properties: count reactants, products, and agents
- RDKit compatibility: parses RDKit reaction SMILES, produces identical results
- WASM-compatible: zero C/C++ dependencies
Quick Start
use parse_reaction;
// Parse a reaction SMILES
let rxn = parse_reaction
.expect;
println!;
println!;
// Access reactants and products as Molecule objects
for mol in rxn.reactants
API Overview
Parsing
parse_reaction(rxn_smiles: &str) -> Result<Reaction, ParseError>— parse reaction SMILESparse_smirks(pattern: &str) -> Result<ReactionPattern, ParseError>— parse SMIRKS pattern
Reaction Structure
Reaction— contains reactants, agents, products, and optional atom mappingsMolecule— each reactant/product is a standard MoleculeReactionPattern— SMIRKS pattern for template matching
Properties
let rxn = parse_reaction?;
assert_eq!;
assert_eq!;
assert_eq!;
// Get individual molecules
let mol1 = rxn.reactant.expect;
let prod = rxn.product.expect;
Dependencies
chematic-core— molecular graphchematic-smiles— SMILES parser
References
- Reaction SMILES: https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html#reactions
- SMIRKS: https://www.daylight.com/meetings/emug05/Friedman_SMIRKS.pdf
See Also
chematic— main umbrella cratechematic-smiles— SMILES parserchematic-smarts— substructure matching and reactionschematic-depict— reaction scheme visualization