Skip to main content

ShEPhERD-score

PyPI version Python versions Documentation Status

📄 Paper | 📚 Documentation | 📦 PyPI

ShEPhERD-score is a Python package for 3D molecular similarity. It extracts interaction profiles (shape, surface electrostatics and pharmacophores), aligns and scores molecules with differentiable 3D similarity functions, screens compound libraries at high throughput, and evaluates 3D molecules sampled from generative models such as ShEPhERD and ShEPhERD–2.

The interaction profile representation and scoring functions were introduced with the ShEPhERD diffusion model (ICLR 2025). The generative models live in separate repositories: ShEPhERD and ShEPhERD–2.

Documentation

Full documentation is available at shepherd-score.readthedocs.io.

Installation

To install the basic tooling for interaction profile extraction, scoring, alignment, and evaluation suites, install via PyPI.

uv pip install shepherd-score

xTB is required for ShEPhERD–2 workflows (xTB partial charges and ESP). xTB can be installed through conda (conda install conda-forge::xtb) in a conda environment or from source and adding it to PATH. We recommend the latter.

Accelerators

The Numba CPU backend is included in the base install and needs no extra. The optional cpu extra adds Intel SVML, which speeds up a few less common CPU paths; see Intel SVML for whether you need it.

uv pip install "shepherd-score[cpu]"   # optional, x86-64 Linux only

Alternatively, conda env create -f environment.yml builds a CPU environment with SVML, xTB and Vina.

For GPU-accelerated scoring and alignment backends with Triton (needs a CUDA build of PyTorch ≥2.6 which should be installed separately for your device):

uv pip install "shepherd-score[gpu]"

Extra features

JAX support: [jax]. Vina docking: [docking]. Everything, including dev and docs tooling: [all]. See the installation docs for external executables (xTB, Vina, ChemAxon).

Usage

  1. Interaction profile extraction
  2. Molecular alignment and scoring
  3. Accelerated alignment
  4. Screen a library
  5. Evaluation of generated samples

Interaction profile extraction

from shepherd_score.conformer_generation import embed_conformer_from_smiles
from shepherd_score.container import Molecule, MoleculePair, MoleculePairBatch

ref_mol = embed_conformer_from_smiles('Oc1ccc(CC=C)cc1')
# `Molecule` extracts and owns all interaction profiles
ref_molec = Molecule(
    ref_mol,
    num_surf_points=200,        # omit to skip the surface
    charge_model='xtb_water',   # partial charges for the ESP, computed lazily
    pharm_multi_vector=False,   # recommended: one HBA vector per carbonyl, not two
)

# surface point cloud + electrostatic potential
surf_pos = ref_molec.surface.positions # np.array (200,3)
esp = ref_molec.surface.esp # np.array (200,)

# unpacks as (types, positions, vectors)
# ref_molec.pharmacophore.types: np.array (P,)
# ref_molec.pharmacophore.{positions/vectors}: np.array (P,3)
pharm = ref_molec.pharmacophore

Molecular alignment and scoring

Alignment using a volumetric scoring function with default PyTorch.

ref = Molecule(embed_conformer_from_smiles("CCOc1ccccc1"))
fit = Molecule(embed_conformer_from_smiles("CCNc1ccccc1"))
pair = MoleculePair(ref, fit)

result = pair.align("vol")
result.score                 # np.ndarray, scalar: optimal vol similarity
result.transform             # np.ndarray (4, 4): fit -> ref SE(3)
result.aligned["points"]     # np.ndarray (N, 3): fit heavy atoms after transform

Swap "vol" for any scoring mode. The main ones:

Mode Compares Needs on Molecule
vol Heavy-atom shape nothing extra
surf Surface shape num_surf_points
vol_esp Shape weighted by partial charges partial charges
surf_esp Surface shape weighted by ESP num_surf_points
vol_and_surf_esp Shape plus surface ESP agreement num_surf_points
pharm Directional ShEPhERD-style pharmacophores pharmacophores
vol_color Shape plus directionless RDKit pharmacophore features pharmacophores (feature_set='rdkit_base')
vol_lipo Shape plus Crippen logP field nothing extra
vol_avoid Shape minus an excluded-volume penalty avoid_points passed to the call
vol_color_avoid vol_color minus an excluded-volume penalty pharmacophores, avoid_points passed to the call

Modes also take similarity="tversky" for asymmetric scoring. Shape blends with molar refractivity, Fukui and atom-type terms are also available. See scoring modes for the full list, parameters and backend support.

Accelerated alignment

Align many molecules to a reference with an accelerated backend: "numba" (CPU), "triton" (GPU) or "jax".

fits = [Molecule(embed_conformer_from_smiles(s)) for s in ["CCNc1ccccc1", "OCc1ccccc1"]]
batch = MoleculePairBatch([MoleculePair(ref, f) for f in fits])

scores, aligned = batch.align("vol", backend="numba")
scores   # np.ndarray (n_pairs,)
aligned  # list of aligned fit coordinates; None entries unless return_aligned=True

Screen a library

from shepherd_score.screen import ProfileStore, screen

with ProfileStore.create("library.fss", num_surf_points=0, modes=("vol",)) as store:
    for i, rdmol in enumerate(library_rdkit_mols):
        store.add(Molecule(rdmol), id=f"cmpd-{i}")

hits = screen(ref, ProfileStore.open("library.fss"), mode="vol", top_k=100)

A store saves only the arrays needed by the modes it was created for. See screening for additional examples for storing arrays for multiple scoring modes or multi-cpu/gpu workflows.

Evaluation of generated samples

We implement three evaluations of 3D molecules sampled by generative models. UnconditionalEvalPipeline evaluates molecules generated unconditionally, ConsistencyEvalPipeline compares the consistency of ShEPhERD's jointly generated interaction profiles with the true interaction profile, and ConditionalEvalPipeline additionally evaluates the 3D similarity between generated molecules and a target molecule.

Full jupyter notebook tutorials/examples for evaluations are found in the examples folder. Some minimal examples are below.

from shepherd_score.evaluations.evaluate import ConfEval
from shepherd_score.evaluations.evaluate import UnconditionalEvalPipeline

# `atom_array` np.ndarray (N,) atomic numbers of the molecule (with explicit H)
# `position_array` np.ndarray (N,3) atom coordinates for the molecule
conf_eval = ConfEval(atoms=atom_array, positions=position_array)

# Alternatively, if you have a list of molecules you want to test:
uncond_pipe = UnconditionalEvalPipeline(
    generated_mols = [(a, p) for a, p in zip(atom_arrays, position_arrays)],
    expected_charge = 1,  # optional: formal charge to try first when inferring bonds (default tries 0, +1, -1, +2, -2)
)
uncond_pipe.evaluate(num_workers=4)

# Properties are stored as attributes and can be converted into pandas DataFrames
global_series, sample_df = uncond_pipe.to_pandas()

License

This project is licensed under the MIT License -- see LICENSE file for details.

Citation

An article describing ShEPhERD-score v2.0 is forthcoming. If you use or adapt ShEPhERD-score in your work, please cite it once available:

Citation forthcoming.

The interaction profile representation and scoring functions were introduced with ShEPhERD. If you use them or the ShEPhERD models, please also cite:

@inproceedings{
adams2025shepherd,
title={Sh{EP}h{ERD}: Diffusing shape, electrostatics, and pharmacophores for bioisosteric drug design},
author={Keir Adams and Kento Abeywardane and Jenna Fromer and Connor W. Coley},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=KSLkFYHlYg}
}

Metadata

Release files for shepherd-score 2.0.1

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

Source distribution (sdist)

Source distribution for shepherd-score 2.0.1
File Size Uploaded Provenance Actions
shepherd_score-2.0.1.tar.gz 1.4 MB With provenance Details for shepherd_score-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shepherd-score 2.0.1
File Interpreter ABI Platform Actions
shepherd_score-2.0.1-py3-none-any.whl Python 3 none any Details for shepherd_score-2.0.1-py3-none-any.whl

Total release size: 2.4 MB

Release files / shepherd_score-2.0.1.tar.gz

Download URL shepherd_score-2.0.1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
a1dd64e4148c4ad4000c902a5605c329acbf5792dbd04bd2eebdf768763368b8
BLAKE2b-256 checksum
How to use checksums
1d1f5756da54ecece499287b343feca4742d951c928f27f1aa3c143565016a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Release files / shepherd_score-2.0.1-py3-none-any.whl

Download URL shepherd_score-2.0.1-py3-none-any.whl
Size 914.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ea188f3120ecc59d66dfcd0cca8b0e33d68635a979c6aa73b49715b20b6e195
BLAKE2b-256 checksum
How to use checksums
5ef378b24c8896f2841ca81817f16c55af8fd2c593ce4407b92a08202f1be9bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for shepherd-score 2.0.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shepherd_score-2.0.1.tar.gz

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 Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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