ShEPhERD-score
📄 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
uv pip install "shepherd-score[cpu]"
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
- Interaction profile extraction
- Molecular alignment and scoring
- Accelerated alignment
- Screen a library
- 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shepherd_score-2.0.0.tar.gz | 1.4 MB | With provenance | Details for shepherd_score-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shepherd_score-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for shepherd_score-2.0.0-py3-none-any.whl |
Total release size: 2.3 MB
Release files / shepherd_score-2.0.0.tar.gz
| Download URL | shepherd_score-2.0.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9886f15875e61491f3b25790d1631124e3eb51b82602ad9b3df0978a8c42fa91
|
|
BLAKE2b-256 checksum How to use checksums |
6576b03160856762f2b5d30e7c2f1d41fbd310f3da3bc695279ef63c790e0353
|
| 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 18, 2026.
Transparency logRelease files / shepherd_score-2.0.0-py3-none-any.whl
| Download URL | shepherd_score-2.0.0-py3-none-any.whl |
|---|---|
| Size | 911.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
918c7969062f370b70ba30b6d02661def8c6165b13d0ae5d7960eb6cb75831ba
|
|
BLAKE2b-256 checksum How to use checksums |
ef9afe586bcbf7644d447e039775e412883caa19f0295e5af35f07e7c0e5711e
|
| 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 18, 2026.
Transparency logSecurity for shepherd-score 2.0.0
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.
Attestation for shepherd_score-2.0.0.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 18, 2026.
Transparency logA 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.