duckSMILES GitHub ↗
On this page

Structural descriptor parity

Reference: RDKit 2025.09.6, default sanitization/aromaticity model with SmilesParserParams.removeHs = False. The 21 SQL functions introduced in f428ef1 are exercised through their exported Rust C ABI functions.

Measured contract

Hydrogen atoms in the input are retained on both sides. Explicit H is the number of H vertices plus the sum of RDKit atom GetNumExplicitHs() values on non-H atoms. Implicit H sums GetNumImplicitHs() on non-H atoms. RDKit sanitization promotes pyrrolic N/P hydrogen to explicit H even when the input was written in unbracketed Kekule form. Total H is their sum.

Bond counts include explicit H bonds, so comparing against RDKit's default H-removing parser is not the same contract. Ring size uses the perceived symmetrized SSSR, not the largest possible graph cycle. Mean degree is 2 * heavy-heavy edges / heavy atoms, not the degree including hydrogen. Fractions and mean degree return zero when there are no heavy atoms.

Heavy atom mass uses the pinned RDKit average weights for unlabelled atoms and isotope masses for labelled atoms, excluding all H isotopes. Numerical periodic-table data are generated by scripts/gen_profile_weights.py; no RDKit code or library is required at runtime. Other mass APIs are unchanged.

Reproduce

uv run --python 3.12 --with rdkit==2025.9.6 python scripts/gen_profile_fixtures.py
uv run --python 3.12 --with rdkit==2025.9.6 python scripts/gen_profile_weights.py
CARGO_TARGET_DIR=/private/tmp/rusta-ducksmiles-parity-target cargo test -p ducksmiles_smiles --test profile_parity
CARGO_TARGET_DIR=/private/tmp/rusta-ducksmiles-parity-target cargo test --workspace

The generator fixes the reference version and random seeds. It does not fetch an external molecular database or discard mismatches. The full source corpus and reference formulas are available in scripts/gen_profile_fixtures.py.

Corrected discrepancies

Limits

Passing this finite corpus does not prove equivalence on every molecule. Full RDKit sanitization, exotic valences, coordination/dative bonds, arbitrary radical/charged aromatic systems, unsupported notation and arbitrary complex ring topologies remain outside the parity guarantee. Invalid-input acceptance is not claimed to match RDKit. The parser must not be used as a substitute for RDKit chemical validation. No broad PubChem/ChEMBL benchmark or experimental property-prediction accuracy is claimed.

Validation here covers the Rust implementation and C ABI. The DuckDB extension binary/community release must be rebuilt separately; pushing this branch does not update an already installed extension. Workspace tests include the older descriptor, canonicalization, ring and fingerprint regression suites. General repository formatting/Clippy checks also expose unrelated existing formatting and raw-pointer FFI lint issues; they are not represented as clean checks.

References: RDKit aromaticity, atom API, HeavyAtomMolWt.