DEV Community

kent-tokyo
kent-tokyo

Posted on

5 Features That Make chematic Stand Out as a Pure-Rust Cheminformatics Library

I'm building chematic, a pure-Rust cheminformatics toolkit. Every library worth using—RDKit, OpenBabel, CDK—requires C/C++ at its core. chematic targets RDKit-level coverage with zero FFI: compiles to WASM, native binaries, and everything in between, without a single line of C or C++.

chematic
Try the live demo
Source

Pure Rust — Reproducible and Instant Builds

Pure-Rust implementation means chematic compiles to identical binaries on any system—Linux, macOS, Windows, CI/CD pipelines, Docker containers—with zero configuration. No cmake, no pkg-config, no "works on my machine" surprises.

[dependencies]
chematic = "0.1"
Enter fullscreen mode Exit fullscreen mode

Compare with the typical RDKit setup:

# RDKit setup
$ brew install cmake boost eigen
$ pip install rdkit
# 5-10 minutes of C++ compilation, system-dependent

# chematic setup
$ cargo add chematic
$ cargo build --release
   Compiling chematic v0.1.89
    Finished `release` profile ... in 4.23s
Enter fullscreen mode Exit fullscreen mode

No cmake version mismatches, no missing nasm, no Boost library conflicts. Advantages:

  • CI/CD reliability — builds don't break due to system library drift
  • Containerization — minimal layer dependencies, smaller Docker images
  • Cross-compilation — compile for Linux/macOS/Windows/WASM from a single Rust toolchain
  • Embedded systems — deploy to constrained environments without external build tools

WebAssembly as a First-Class Target

chematic exports 137 JavaScript functions via the npm package @kent-tokyo/chematic. The demo at https://kent-tokyo.github.io/chematic/ shows 8 feature tabs (2D Viewer, Similarity, Molecular Report, Reaction, SAR Analysis, 3D Viewer, Gallery, Dynamics), all running client-side in pure WASM.

Embed cheminformatics directly in web applications:

const mol = parse_smiles('CC(=O)Oc1ccccc1C(=O)O');
const descriptors = get_descriptors_json(mol);     // {mw: 180.15, logp: 1.19, tpsa: 63.6, ...}
const scaffold = murcko_scaffold(mol);
const fragments = brics_fragments_json(mol);
Enter fullscreen mode Exit fullscreen mode

Benefits:

  • Interactive lead optimization — real-time descriptor updates as users draw structures
  • Offline-first tools — no backend server, no SaaS fees, no internet required
  • Collaborative chemistry — embed in Jupyter notebooks, Observable, or design tools
  • Instant feedback — sub-millisecond property calculations in the browser

Feature Flags for Modularity

chematic ships with 10 optional feature flags: smiles, perception, mol, depict, fp, chem, smarts, rxn, threed, inchi, iupac. Use the full omnibus flag for everything.

Practical effects:

  • WASM bundle size shrinks with every unused feature
  • Compile time drops when excluding heavy modules like 3D or fingerprints
  • Embedded targets can skip unnecessary functionality

3D Coordinate Generation and Force Field Minimization in Pure Rust

3D cheminformatics requires distance geometry for initial embedding, force field parameterization, and structure optimization. chematic implements three force fields—UFF, DREIDING, and MMFF94—entirely in Rust.

The pipeline:

  1. Generate 3D coordinates via distance geometry
  2. Embed into conformer ensemble
  3. Minimize geometry using selected force field
  4. Prune similar conformers by RMSD
  5. Optionally run short molecular dynamics (300 K, Berendsen thermostat)

You can also compute shape descriptors (principal moments of inertia, normalized principal ratios, asphericity) and export to PDB or XYZ format. This same 3D engine powers the demo's 3D Viewer and Dynamics tabs.

Drug Discovery Pipeline in ~20 Lines

The typical workflow compresses into a few method calls:

// In a single Rust binary:
// - 70+ molecular descriptors (MW, LogP, TPSA, Fsp3, exact mass, aromatic ring count, etc.)
// - Drug-likeness filtering
// - Standardization (tautomers, salts, charges)
// - Stereochemistry handling (R/S and E/Z assignment, isomer enumeration)
// - BRICS fragmentation for lead optimization
// - Fingerprints (ECFP, FCFP, MACCS, AtomPair, Torsion)
// - SMARTS and substructure search
Enter fullscreen mode Exit fullscreen mode

All linked statically. All open source. No external services.

Fingerprints and Similarity-Based Screening

Fingerprints encode molecules as bit vectors for bulk similarity comparison and identification of structurally related compounds. chematic implements six fingerprint algorithms in Rust:

  • ECFP and FCFP — circular fingerprints (radii 2, 4, 6)
  • MACCS — 166-bit key set (MDL standard)
  • AtomPair and Torsion — environment-based structural bits
  • TopoPF — RDKit-style topological path fingerprint

The demo's Similarity tab shows all six with their Tanimoto scores. Use cases:

  • Virtual screening — find actives from a library of millions
  • Scaffold hopping — discover chemically novel analogs
  • Compound clustering — group similar leads for follow-up synthesis
  • Hit triage — prioritize candidates by structural diversity

2D SVG Molecular Depiction

chematic generates publication-quality SVG output with:

  • CPK atom coloring (carbon gray, oxygen red, nitrogen blue, etc.)
  • Substructure highlighting for SMARTS matches
  • Reaction scheme visualization with arrow flow
  • Stereochemistry wedges — proper depiction of wedge/dash bonds
  • Customizable styling — line width, font, colors

The 2D Viewer tab renders every molecule as SVG, with live SMARTS-based highlighting. This eliminates the need for external rendering tools or server-side chemistry services.

3D Interactive Viewer and Molecular Dynamics

chematic includes a full 3D viewer powered by WebGL (via Three.js). The demo's 3D Viewer tab offers:

  • Multiple display modes: Stick, Ball & Stick, Spacefill (van der Waals surface)
  • Interactive rotation and zoom — drag to rotate, scroll to zoom
  • Real-time molecular dynamics — short MD runs at 300 K with live coordinate updates
  • Conformer ensemble support — explore multiple low-energy structures
  • PDB/XYZ export — save optimized 3D structures

Use cases:

  • ADMET prediction — shape-based descriptors from 3D coordinates
  • Protein-ligand docking — preparation and validation
  • Lead optimization — visual inspection of 3D conformations
  • Educational use — visualizing stereochemistry and molecular motion

Where to Start

Live demo: https://kent-tokyo.github.io/chematic/ — try all 8 tabs now in your browser

Get the code:

I released v0.1.89 in June 2026. The library has 1,521 passing tests. The goal is feature parity with RDKit, achievable purely in Rust without compromising performance or safety.

If you're building cheminformatics tools in Rust, exploring serverless drug discovery pipelines, or shipping molecular analysis to the browser, try chematic. Feedback and contributions on GitHub are welcome.

Top comments (0)