chematic
A pure-Rust cheminformatics library targeting RDKit feature parity, with no C/C++ FFI.
Live Demo
https://kent-tokyo.github.io/chematic/ — Interactive descriptor calculator, drug-likeness rules, and similarity comparison running entirely in your browser via WebAssembly.
Design Goals
Pure Rust, zero C/C++ FFI No rdkit-sys, no openbabel bindings. Every algorithm is implemented in safe Rust.
WASM-compatible and lightweight
Core crates compile to wasm32-unknown-unknown without modification. Binary size is in
the hundreds of KB range, versus tens of MB for C++ FFI wrappers.
Domain-specific algorithms Rather than wrapping a generic graph library, chematic implements chemistry-specific algorithms directly: Kekulization, Hückel aromaticity, CIP stereochemistry, SSSR ring perception.
Reproducible and deterministic Fingerprints use FNV-1a hashing with a fixed invariant ordering. Given the same SMILES input, the same bits are always produced. No RNG, no platform-specific behavior.
Current Status
All phases complete. 544 tests, all passing.
| Crate | Description | Tests |
|---|---|---|
chematic-core |
Atom, Bond, Molecule, Element, kekulization (no deps) | 30 |
chematic-smiles |
OpenSMILES parser, writer, canonical SMILES | 52 |
chematic-perception |
SSSR (Balducci-Pearlman), Huckel aromaticity | 14 |
chematic-mol |
MOL/SDF V2000+V3000 parser and writer | 37 |
chematic-depict |
2D SVG depiction with CPK coloring and atom/bond highlighting | 15 |
chematic-chem |
Descriptors, BRICS fragmentation, QED, standardization, Murcko scaffold, CIP | 216 |
chematic-fp |
ECFP4/6, MACCS 166-bit, topological path, AtomPair, Torsion FP, Tanimoto/Dice | 44 |
chematic-smarts |
SMARTS parser (recursive, valence, hybridization), VF2 subgraph isomorphism, MCS | 76 |
chematic-3d |
3D coordinate generation, PDB/XYZ file formats | 25 |
chematic-rxn |
Reaction SMILES parser and writer | 15 |
chematic-wasm |
WebAssembly bindings — npm: @kent-tokyo/chematic |
18 |
chematic |
Umbrella crate with feature flags (all sub-crates) | 1 |
cargo test --workspace # 544 tests, all passing
Quick Start
Using the umbrella crate
# Cargo.toml
[]
= { = "https://github.com/kent-tokyo/chematic", = ["smiles", "fp"] }
use ;
use ecfp4;
Using individual crates
# Cargo.toml
[]
= { = "https://github.com/kent-tokyo/chematic" }
= { = "https://github.com/kent-tokyo/chematic" }
= { = "https://github.com/kent-tokyo/chematic" }
use ;
use ;
use ;
SMARTS substructure search
use parse;
use ;
let mol = parse.unwrap; // aspirin
let query = parse_smarts.unwrap; // carboxylic / ester C
let matches = find_matches;
println!; // 2
Molecular descriptors
use parse;
use ;
let aspirin = parse.unwrap;
println!; // ~180.16
println!; // ~63.6
println!; // ~1.2
println!; // ~0.111
println!; // drug-likeness score
println!; // true
BRICS fragmentation
use parse;
use brics_fragments;
let aspirin = parse.unwrap;
let frags = brics_fragments;
println!; // ≥ 2
Fingerprints
use parse;
use ;
let aspirin = parse.unwrap;
let caffeine = parse.unwrap;
let sim_ecfp4 = ecfp4.tanimoto;
let sim_atompair = atom_pair_fp.tanimoto;
let sim_torsion = torsion_fp.tanimoto;
2D depiction
use parse;
use depict_svg;
let caffeine = parse.unwrap;
let svg = depict_svg;
write.unwrap;
Highlighted depiction
use HashSet;
use parse;
use depict_svg_highlighted;
let mol = parse.unwrap; // pyridine
let n_idx = mol.atoms.find
.map.unwrap;
let svg = depict_svg_highlighted;
JavaScript / TypeScript (WebAssembly)
import init from '@kent-tokyo/chematic';
await ;
const mol = ; // aspirin
console.log; // ~180.16
console.log; // ~1.2
console.log; // drug-likeness [0,1]
console.log; // fraction sp3 carbons
console.log; // number of BRICS fragments
const caffeine = ;
console.log; // ECFP4 similarity
console.log; // AtomPair similarity
Comparison with Other Cheminformatics Libraries
| Feature | chematic | RDKit (rdkit-sys) | OpenBabel FFI | chemcore / purr |
|---|---|---|---|---|
| Language | Pure Rust | Rust + C++ FFI | Rust + C++ FFI | Pure Rust |
| WASM target | Yes | No | No | Partial |
| Binary size (core) | ~500 KB | ~50 MB | ~20 MB | ~200 KB |
| OpenSMILES parser | Full | Full | Full | Partial |
| SMILES writer / canonical | Yes | Yes | Yes | No |
| Kekulization | Yes | Yes | Yes | No |
| Aromaticity perception | Yes (Huckel) | Yes | Yes | Partial |
| Ring perception (SSSR) | Yes | Yes | Yes | No |
| SDF/MOL V2000+V3000 | Yes | Yes | Yes | No |
| 2D depiction (SVG, CPK colors) | Yes | Yes | Yes | No |
| ECFP fingerprints | Yes (ECFP4/6) | Yes | Yes | No |
| AtomPair / Torsion fingerprints | Yes | Yes | Yes | No |
| MACCS fingerprints | Yes (166-bit) | Yes | Yes | No |
| SMARTS / substructure search | Yes (VF2 + recursive) | Yes | Yes | No |
| Molecular descriptors | Yes (MW/LogP/TPSA/Fsp3/QED/…) | Yes | Yes | No |
| BRICS fragmentation | Yes | Yes | No | No |
| 3D coordinate generation | Yes (rule-based) | Yes (ETKDG) | Yes | No |
| PDB/XYZ file formats | Yes | Yes | Yes | No |
| CIP stereochemistry (R/S, E/Z) | Yes | Yes | Yes | No |
| Force field minimization | Yes (rule-based) | Yes (UFF/MMFF) | Yes | No |
| Reaction SMILES/SMIRKS | Yes | Yes | Yes | No |
| Unsafe Rust | None | Extensive | Extensive | None |
| Maintenance (2026) | Active | Active | Minimal | Archived |
Notes:
- Binary sizes are approximate and depend on enabled features.
- chemcore and purr are archived; chematic supersedes their scope.
Roadmap
Phase 1 — Foundation (complete)
Core types, OpenSMILES parse/write, Kekulization, canonical SMILES.
Phase 2 — Molecular Perception (complete)
SSSR, Huckel aromaticity, SDF/MOL V2000+V3000, 2D SVG depiction.
Phase 3 — Chemical Intelligence (complete)
Descriptors (MW, LogP, TPSA, Fsp3, Lipinski), QED, BRICS fragmentation, ECFP4/6 fingerprints, SMARTS+VF2 (recursive SMARTS, valence, hybridization), molecular standardization, Murcko scaffold, CIP R/S and E/Z.
Phase 4 — Similarity and Search (complete)
MACCS 166-bit keys, topological path FP, AtomPair FP, Topological Torsion FP, MCS, tautomer normalization.
Phase 5 — 3D Chemistry (complete)
Rule-based 3D coordinate generation, PDB/XYZ formats, UFF-like minimization.
Phase 6 — RDKit Parity (complete)
Reaction SMILES/SMIRKS ✓, umbrella crate with feature flags ✓,
WASM npm package @kent-tokyo/chematic ✓, CPK coloring + highlighted depiction ✓,
ChEMBL 37 full-set validation (2,897,819 molecules, 100.000%) ✓.
See tasks/todo.md for the detailed per-task breakdown.
Repository Structure
chematic/
├── Cargo.toml workspace root
├── CHANGELOG.md version history
├── crates/
│ ├── chematic-core/ Atom, Bond, Molecule, Element, kekulization
│ ├── chematic-smiles/ OpenSMILES parser, writer, canonical SMILES
│ ├── chematic-perception/ SSSR ring perception, Huckel aromaticity
│ ├── chematic-mol/ MOL/SDF V2000+V3000 parser and writer
│ ├── chematic-depict/ 2D SVG depiction engine (CPK colors, highlighting)
│ ├── chematic-chem/ Descriptors, BRICS, QED, standardization, scaffold
│ ├── chematic-fp/ ECFP4/6, MACCS, path, AtomPair, Torsion FP
│ ├── chematic-smarts/ SMARTS parser + VF2 subgraph isomorphism, MCS
│ ├── chematic-3d/ 3D coordinate generation, PDB/XYZ formats
│ ├── chematic-rxn/ Reaction SMILES parser and writer
│ └── chematic/ Umbrella crate with feature flags
└── tasks/
├── todo.md full roadmap checklist (Japanese)
└── lessons.md development lessons learned
Development Commands
License
Licensed under either of Apache License 2.0 or MIT License, at your option.