chematic-smiles
OpenSMILES parser and writer for Rust. Parses arbitrary SMILES strings into a molecular graph and generates canonical SMILES. Pure Rust, no FFI, WASM-compatible.
Features
- SMILES parsing: read OpenSMILES syntax (aromatic, charges, bonds, isotopes, stereo)
- Canonical SMILES: deterministic round-trip generation with sorted atom ordering
- Stereo chemistry: Up/Down bonds for 3D chirality, E/Z double bonds
- Aromaticity perception: automatic aromatic ring detection (Hückel 4n+2)
- Hydrogen handling: implicit/explicit hydrogens, valence checks
- WASM-compatible: zero C/C++ dependencies
Quick Start
use parse;
// Parse SMILES
let mol = parse.expect;
println!;
println!;
// Iterate atoms
for i in 0..mol.atom_count
// Iterate bonds
for in mol.bonds
API Overview
parse(smiles: &str) -> Result<Molecule, ParseError>— parse SMILES stringcanonical_smiles(mol: &Molecule) -> String— generate canonical SMILESMolecule— molecular graph with atoms, bonds, and bond ordersAtom,Bond— low-level types for graph data
Dependencies
chematic-core— graph and chemistry types
References
- OpenSMILES spec: https://opensmiles.org/
- SMILES tutorial: https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html
See Also
chematic— main umbrella cratechematic-inchi— InChI generationchematic-smarts— SMARTS matching and reactions