Skip to main content

PyPI version Maintenance License Run Tests Build Docs Open In Colab

rdchiral_plus

Wrapper for RDKit's RunReactants to improve stereochemistry handling

This repository is a fork of RDChiral. It has been modified for improved speed and accuracy while maintaining high interface consistency with the upstream library. Depending on the operation, rdchiral_plus is 1.7×–5× faster than the original RDChiral, and is competitive with the fast C++ version (rdchiral_cpp) (benchmarks). This library has the benefits of being written in Python and achieves a higher round-trip accuracy than either the original or the C++ library. rdchiral_plus is pip installable cross platform.

Most interface functions (rdchiralRun, rdchiralRunText, rdchiralReaction, rdchiralReactants, extract_from_reaction, etc.) and returned data structures remain unchanged from the original library, so existing code should work with no modifications. While behavior is mostly consistent with the original library, this fork includes several important fixes and improvements.

Changes to template application

  • Fix cis/trans outcomes for conjugated systems: Fixes incorrect cis/trans outcomes for conjugated systems that could previously depend on atom numbering. In particular, when a template only specifies part of a conjugated system, the copied double-bond stereo directions may need to be reversed consistently
  • Broader stereochemistry handling: Stereochemistry for tetrahedral centers with lone pairs is accounted for
  • One-pot reactions: Templates defining multiple reactions on the same product are now properly handled by initializing templates with parentheses where needed
  • Recursive template application: Templates can be recursively applied with a max_depth parameter, useful for reactions that occur at multiple sites in a molecule
  • Product-side SMARTS constraint enforcement: RDKit's RunReactants ignores certain SMARTS constraints (e.g. !$(C(=O)O)) on the product side of reaction SMARTS. The opt-in enforce_reactants_smarts_constraints parameter post-filters outcomes to ensure product atoms satisfy their full template SMARTS query, including recursive expressions and non-recursive constraints such as H-count, degree, and formal charge

Changes to template extraction

  • Configurable template extraction: Extends template extraction to support a configurable fragment radius and an option to disable matching/including “special groups” (no_special_groups), which can change which atoms are included in extracted fragments.
  • Deterministic template extraction: Replaced random shuffle-based tetrahedral center correction loops with deterministic permutation parity - the old behavior could lead to inconsistent results or appear to hang in rare instances.
  • Stereochemistry tracking: Inversions of tetrahedral centers are counted as a changed atom, and included in the extracted template
  • Spectator tracking: Spectator molecules are included in extracted template dictionaries
  • extract_from_reaction_smiles convenience function: Extract templates directly from an atom mapped reaction SMILES

General changes

  • Automatic dependency installation: RDKit is automatically installed as a dependency

Consistency with the upstream library

The changes above result in minor differences in behavior compared to the original library. In cases where behavior is different, rdchiral_plus typically produces the more accurate result. As an example, the table below shows the roundtrip success rate of extracting a template from an atom mapped reaction SMILES, applying that template to the product SMILES, and then recovering the expected reactant SMILES. rdchiral_plus reduces the number of incorrect roundtrips by 98% compared to RDChiral, and 99% compared to rdchiral_cpp, achieving a 99.96% roundtrip success rate for extract template -> apply to products -> recover expected reactants.

library successful roundtrips success rate
RDChiral 49223 / 50016 98.41%
rdchiral_cpp 48694 / 50016 97.36%
rdchiral_plus 49998 / 50016 99.96%

See here for details on how consistency is measured against the original library and full details of what changes you can expect compared to the original RDChiral library.

Requirements

  • RDKit (version >= 2019)
  • Python (version >= 3.10)

Installation

Install rdchiral_plus from PyPI:

pip install rdchiral-plus

Or install rdchiral_plus with pip directly from this repo:

pip install git+https://github.com/denovochem/rdchiral_plus.git

This fork can be optionally compiled with mypyc. In our testing performance is not noticeably improved, as most of the computationally expensive work in this library is done with rdkit, which is already primarily written in C++.

For mypyc compilation:

RDCHIRAL_USE_MYPYC=1 pip install "git+https://github.com/denovochem/rdchiral_plus.git"

Basic usage

from rdchiral import rdchiralRun, rdchiralRunText, rdchiralReaction, rdchiralReactants

# Run directly from SMARTS and SMILES strings
# This is slower than pre-initializing rdchiralReaction and rdchiralReactants when
# processing a large number of reactions
reaction_smarts = "[C:1][OH:2]>>[C:1][O:2][C]"
reactant_smiles = "OCC(=O)OCCCO"
outcomes = rdchiralRunText(reaction_smarts, reactant_smiles)
print(outcomes)

# Pre-initialize then run
rxn = rdchiralReaction(reaction_smarts)
reactants = rdchiralReactants(reactant_smiles)
outcomes = rdchiralRun(rxn, reactants)
print(outcomes)

# Get list of atoms that changed
outcomes, mapped_outcomes = rdchiralRun(rxn, reactants, return_mapped=True)
print(outcomes, mapped_outcomes)

Documentation

Full documentation is available here

Contributing

  • Feature ideas and bug reports are welcome on the Issue Tracker.
  • Fork the source code on GitHub, make changes and file a pull request.

License

rdchiral_plus is licensed under the MIT license.

References

Release files for rdchiral-plus 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rdchiral-plus 0.6.0
File Size Uploaded
rdchiral_plus-0.6.0.tar.gz 59.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rdchiral-plus 0.6.0
File Interpreter ABI Platform
rdchiral_plus-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 120.0 kB

Release files / rdchiral_plus-0.6.0.tar.gz

Download URL rdchiral_plus-0.6.0.tar.gz
Size 59.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4cd14f8fb7a8fc1f0692587e4f431b6fa9374f020286e4f0ba0052db8c0592f5
BLAKE2b-256 checksum
How to use checksums
1fa479b4ae98e4aea1a59d4aa823cb2945a46424b18c34bde8d14f6a1d76278a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / rdchiral_plus-0.6.0-py3-none-any.whl

Download URL rdchiral_plus-0.6.0-py3-none-any.whl
Size 60.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b6777af18d1c856142f4320323e88fc1e6c29eefd17117b0b1c75a714a56ac9
BLAKE2b-256 checksum
How to use checksums
a46e6c46916858e319b8605770afe13474b526d7c9e7d12859327a576cdcfa9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

13 release files

0.3.1

13 release files

0.2.0

16 release files

0.1.0

16 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page