sci-form
High-performance 3D molecular conformer generation using ETKDG distance geometry, written in Rust.
Generates chemically valid 3D coordinates from SMILES strings, matching RDKit's ETKDGv2 quality while offering native bindings for Rust, Python, TypeScript/JavaScript (WASM), and a cross-platform CLI.
Features
- ETKDG Distance Geometry — Cambridge Structural Database torsion preferences (837 SMARTS patterns)
- High Accuracy — 0.00% heavy-atom RMSD > 0.5 Å vs RDKit on GDB-20 (2000 molecules, ensemble comparison)
- Fast — 60+ molecules/second in Rust, parallel batch processing via rayon
- Multi-platform — Rust lib, Python (PyO3), TypeScript/JS (WASM), CLI (Linux/macOS/Windows)
- Zero runtime dependencies — pure Rust, no C++ toolchain needed
- SMILES + SMARTS — full SMILES parser and SMARTS pattern matching engine
Installation
Rust
[]
= "0.1"
let result = embed;
println!;
Python
The Python package is published as sciforma on PyPI.
The import name is sci_form.
= # seed=42 is default
= # list of (x, y, z) tuples
# Batch
=
TypeScript / JavaScript (Node.js + Browser)
The npm package is sci-form-wasm.
Node.js (CommonJS)
const sci = require;
const result = JSON.;
console.log;
ES Module / TypeScript
import init, { embed } from 'sci-form-wasm';
await init();
const result = JSON.parse(embed('CC(=O)O', 42));
console.log(`Atoms: ${result.num_atoms}`);
CLI
Download prebuilt binary from GitHub Releases:
| Platform | File |
|---|---|
| Linux x86_64 | sci-form-linux-x86_64 |
| Linux aarch64 | sci-form-linux-aarch64 |
| macOS x86_64 | sci-form-macos-x86_64 |
| macOS Apple Silicon | sci-form-macos-aarch64 |
| Windows x86_64 | sci-form-windows-x86_64.exe |
Or install via cargo:
# Single molecule
# Batch processing
# Parse only (no 3D)
# Show version / features
Benchmark Results
Diverse Molecules (131 molecules, all chemical functional groups)
| Metric | Value |
|---|---|
| Parse success | 100% |
| Embed success | 97.7% |
| Geometry quality | 97.7% |
| Throughput | 60 mol/s |
RDKit Comparison (heavy-atom pairwise-distance RMSD)
| Metric | Value |
|---|---|
| Average RMSD | 0.064 Å |
| Median RMSD | 0.011 Å |
| < 0.5 Å | 98.4% |
| < 0.3 Å | 94.4% |
GDB-20 Ensemble (2000 molecules × 10 seeds vs 21 RDKit seeds)
| Metric | All-atom | Heavy-atom |
|---|---|---|
| Avg RMSD | 0.035 Å | 0.018 Å |
| > 0.5 Å | 0.95% | 0.00% |
Algorithm
sci-form implements ETKDGv2 (Experimental Torsion Knowledge Distance Geometry):
- SMILES Parsing → Molecular graph with atoms, bonds, hybridization
- Bounds Matrix → 1-2, 1-3, 1-4, and VdW distance bounds from topology
- Triangle Smoothing → Floyd-Warshall triangle inequality enforcement
- Distance Picking → Random distances from smoothed bounds (MinstdRand)
- Metric Matrix Embedding → Eigendecomposition → 4D coordinates
- Bounds Force Field → BFGS minimization in 4D to satisfy distance constraints
- Projection to 3D → Drop lowest-variance dimension
- ETKDG 3D Refinement — Force field with CSD torsion preferences (837 patterns)
- Validation — Tetrahedral centers, planarity, double-bond geometry
See the algorithm documentation for mathematical derivations and step-by-step diagrams.
Building from Source
# Library + CLI
# Python bindings
&& &&
# WASM bindings
&&
Testing
# Unit tests
# Integration — diverse molecules
# Integration — geometry quality (requires gdb20_reference.json, see scripts/)
# Integration — gradient correctness
# Lint & format
Releasing a New Version
Use the provided bump script. It updates all version strings, commits, tags, and pushes:
# Auto-increment patch (0.1.7 → 0.1.8)
# Set a specific version
This updates versions in:
Cargo.toml(root lib)crates/cli/Cargo.tomlcrates/python/Cargo.tomlcrates/wasm/Cargo.tomlcrates/python/pyproject.tomlcrates/wasm/pkg/package.jsonpkg/package.json&pkg-node/package.json
Then creates a vX.Y.Z git tag, which triggers the release workflow to publish to crates.io, PyPI, and npm automatically.
Required repository secrets:
| Secret | Used for |
|---|---|
CARGO_REGISTRY_TOKEN |
Publishing to crates.io |
PYPI_API_TOKEN |
Publishing to PyPI (sciforma) |
NPM_TOKEN |
Publishing to npm (sci-form-wasm) — must be a Granular Automation token |
License
MIT