Skip to main content
RDKit-rs
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

rdkit-rs

Crates.io License

Safe, idiomatic Rust bindings for RDKit, the industry-standard open-source cheminformatics library.

What It Provides

The project ships two crates:

  • rdkit-sys — Low-level C++ bindings via cxx. Zero-cost wrappers exposing a key subset of RDKit’s C++ API.
  • rdkit — High-level Rust library built on rdkit-sys. No manual memory management, no null pointers. Implements Debug, Clone, and idiomatic borrowing so molecules behave like native Rust types.

Capabilities

AreaWhat You Can Do
ParsingSMILES, molblocks, SDF files (including gzipped)
NormalizationFragment parent, uncharger, canonical tautomer
FingerprintsMorgan fingerprints, pattern fingerprints
DescriptorsCompute all standard RDKit descriptors (exactmw, NumAtoms, CrippenClogP, etc.)
TautomersEnumerate tautomers, canonicalize
SubstructureSMARTS-based substructure and superstructure matching
Periodic TableElement lookups and properties

Quick Start

Add to your Cargo.toml:

[dependencies]
rdkit = "0.4"

Example:

use rdkit::{Properties, ROMol};
use std::collections::HashMap;

fn main() {
    let mol = ROMol::from_smile("c1ccccc1C(=O)NC").unwrap();
    let properties = Properties::new();
    let computed: HashMap<String, f64> = properties.compute_properties(&mol);
    assert_eq!(*computed.get("NumAtoms").unwrap(), 19.0);
}

Browse more examples in the examples directory.

Prerequisites

Requires RDKit 2023.09.1 or higher.

macOS:

brew install rdkit

Linux (Ubuntu 24.04+):

Pre-compiled static library tarballs are available for AMD64 and ARM64:

You will also need a C++ compiler (we recommend clang) for building the rdkit-sys bridge code.

Rust Version

We support recent stable Rust versions. The limiting factor is cxx — check the cxx Cargo.toml for the minimum rust-version.