Molecular graph matching
Substructure, MCS and similarity search¶
SMSD Pro finds substructures, maximum common substructures and similar molecules in C++, Java and Python. Each result states whether the search completed and whether its answer is proved optimal.
Installation¶
import smsd
# Is benzoic acid inside aspirin?
hit = smsd.Substructure.find("c1ccccc1C(=O)O").match("CC(=O)Oc1ccccc1C(=O)O")
print(hit.found) # True
# What do two molecules share, and is that proved maximal?
mcs = smsd.MCS.find("CC(=O)Oc1ccccc1C(=O)O").match("OC(=O)c1ccccc1O")
print(mcs.matches[0].atom_count, mcs.optimal) # 10 True
# How similar are they?
a = smsd.fingerprint_from_smiles("CC(=O)Oc1ccccc1C(=O)O", radius=2, fp_size=2048)
b = smsd.fingerprint_from_smiles("OC(=O)c1ccccc1O", radius=2, fp_size=2048)
print(round(smsd.tanimoto_coefficient(a, b), 3)) # 0.185
Python wheels cover CPython 3.12–3.15 on Linux, Windows and Apple silicon Macs, and the Java library and command-line tool are on Maven Central. The installation guide covers the platforms, conda and source builds.
What's new¶
8.2.1 is a maintenance release:
- C++ headers compile when Windows defines
STRICTandIGNORE. - Drawings keep the stored E/Z of non-aromatic ring double bonds.
- In C++ and Python, the directional SMARTS bonds
/and\also match aromatic bonds. - In C++ and Python, elemental-hydrogen SMARTS hold with large atom-map labels.
Highlights of 8.2.0:
- GPU screening on Apple silicon with the
smsd-metalpackage. - A guide to NVIDIA GPU screening on Windows through WSL2.
- Cleaner molecule drawings.
- Clearer error messages from the MCP tools.
- Time limits that hold on very large molecules.
- Seven example notebooks that open in Colab.
Search results are the same as in 8.1.0, and existing APIs are unchanged. The release notes have the details, and known issues lists current limitations with workarounds.
See it on real molecules¶
Which tool to use¶
| You want to | Use | Read |
|---|---|---|
| Check whether a fragment occurs in a molecule | Substructure.find(query).match(target) |
Substructure search |
| Express a pattern with atom and bond rules | SMARTS queries | SMARTS queries |
| Find the largest shared part of two molecules | MCS.find(a).match(b) |
Maximum common substructure |
| Compare or rank molecules by similarity | Fingerprints and Tanimoto | Fingerprints and similarity |
| Search thousands to millions of molecules | TargetCorpus screening |
Screening a library |
| Hold a large library compactly for repeated searches | Packed fingerprint corpora | Packed fingerprint index |
| Find the k most similar molecules | Packed top-k screening | Packed fingerprint index |
| Cluster a library or pick a diverse subset, on CPU or GPU | Butina, MaxMin, top-k pairs | Clustering and diversity |
| Draw a match | from smsd.highlight import mcs_svg, substructure_svg |
Draw the result |
| Use an NVIDIA or Apple GPU | smsd-cuda, smsd-metal |
CPU and GPU screening |
| Use an NVIDIA GPU from Windows | WSL2 with smsd-cuda or the GPU image |
GPU screening on Windows |
| Work from a shell or a container | smsd command line, Docker |
Command line and containers |
| Build in C++ or Java | Header-only C++, CDK-based Java | C++ and Java |
| Feed results to pandas, PyTorch or scikit-learn | Data adapters | Machine learning and data frames |
| Give an AI assistant chemistry tools | Local MCP server | Chemistry tools for AI assistants |
Guides¶
-
Getting started
Install, parse molecules and run your first three searches.
-
Maximum common substructure
Objectives, chemistry rules, time limits and how to read a proved result.
-
Substructure and SMARTS
Exact matching, all embeddings, and patterns with atom and bond rules.
-
Fingerprints
Circular, path, torsion and MACCS keys with one set of options.
-
Screening a library
Prepare a corpus once, then search it by threshold, top-k or structure.
-
CPU and GPU
NVIDIA and Apple GPUs: when they help, how to request them, and why results match the CPU.
-
Clustering and diversity
Butina clusters, MaxMin picks and nearest pairs, on the CPU or an NVIDIA GPU.
-
Machine learning and data
Fingerprints into NumPy, pandas, Arrow, Polars, scikit-learn and PyTorch.
-
Tools for AI assistants
Local chemistry tools for open models and hosted AI assistants, through MCP or tool calling.
Notebooks¶
Each notebook runs as written in Jupyter or Colab: its setup cell installs SMSD 8.2.1 or later into the running kernel when needed. The pages below show the output of a run with SMSD 8.2.1, drawings included.
Cite SMSD Pro¶
If SMSD Pro supports your work, please cite the paper and the software release you used.
Paper. Rahman, S. A. (2026). SMSD Pro: Coverage-Driven, Tautomer-Aware Maximum Common Substructure Search. ChemRxiv. doi:10.26434/chemrxiv.15001534/v1
Software. Rahman, S. A. SMSD Pro: Small Molecule Subgraph Detector [Computer software]. Zenodo. doi:10.5281/zenodo.23639199. This DOI covers all releases; Zenodo also gives each version its own DOI.
Original toolkit. Rahman, S. A., Bashton, M., Holliday, G. L., Schrader, R. & Thornton, J. M. (2009). Small Molecule Subgraph Detector (SMSD) toolkit. Journal of Cheminformatics, 1, 12. doi:10.1186/1758-2946-1-12
@article{rahman2026smsdpro,
author = {Rahman, Syed Asad},
title = {{SMSD Pro}: Coverage-Driven, Tautomer-Aware Maximum Common Substructure Search},
journal = {ChemRxiv},
year = {2026},
doi = {10.26434/chemrxiv.15001534/v1}
}
@software{rahman_smsd_pro,
author = {Rahman, Syed Asad},
title = {{SMSD Pro}: Small Molecule Subgraph Detector},
publisher = {Zenodo},
doi = {10.5281/zenodo.23639199},
url = {https://github.com/asad/SMSD}
}
@article{rahman2009smsd,
author = {Rahman, Syed Asad and Bashton, Matthew and Holliday, Gemma L. and
Schrader, Rainer and Thornton, Janet M.},
title = {Small Molecule Subgraph Detector ({SMSD}) toolkit},
journal = {Journal of Cheminformatics},
volume = {1},
pages = {12},
year = {2009},
doi = {10.1186/1758-2946-1-12}
}
GitHub's Cite this repository button reads the same details from CITATION.cff.