GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - asad/SMSD: SMSD Pro: exact substructure, SMARTS, maximum common substructure (MCS) and fingerprint similarity search for molecules in Python, C++ and Java. Wheels for Linux, macOS (Apple silicon) and Windows, with optional GPU screening on NVIDIA CUDA and Apple silicon. Install with pip, conda or Docker.

BranchesTags
Open more actions menu

Latest commit

 

History

80 Commits
80 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
benchmarks
benchmarks
 
 
cpp
cpp
 
 
docs
docs
 
 
examples/huggingface
examples/huggingface
 
 
icons
icons
 
 
java
java
 
 
licenses
licenses
 
 
packaging
packaging
 
 
python
python
 
 
scripts
scripts
 
 
.dockerignore
.dockerignore
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CITATION.cff
CITATION.cff
 
 
Dockerfile
Dockerfile
 
 
Dockerfile.cuda
Dockerfile.cuda
 
 
LICENSE
LICENSE
 
 
NOTICE
NOTICE
 
 
README.md
README.md
 
 
llms.txt
llms.txt
 
 
pom.xml
pom.xml
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

SMSD Pro

SMSD Pro™

Substructure, MCS and similarity search for molecules

Maven Central PyPI PyPI downloads (all time) Conda Documentation DOI Licence Release

SMSD Pro provides substructure search and maximum common substructure (MCS) search for C++, Java and Python, with the same search model in each language. Every result reports completion, proved optimality and the reason it stopped, and maps atoms by their zero-based indices in the input molecules.

  • C++: a header-only C++17 library.
  • Java: a library and command-line tool for CDK 2.14.1 molecules, running on Java 8 or later.
  • Python: a binding to the native library that accepts RDKit molecules when RDKit is installed and converts Open Babel molecules.

What's new

8.2.1 is a maintenance release:

  • C++ headers compile when Windows defines STRICT and IGNORE.
  • 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-metal package.
  • 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, such as the MCS notebook.

Search results are the same as in 8.1.0, and existing APIs are unchanged. The release notes and changelog have the details, and known issues lists current limitations with workarounds.

Also included

  • Python adapters for data-frame and machine-learning libraries, loaded only when you use them.
  • An MCP server with local molecular tools for AI assistants, plus a container recipe.
  • Packed fingerprint corpora with clustering.
  • SMARTS export.
  • Conda recipes for smsd, smsd-cuda and smsd-metal that work with conda, mamba and Pixi.
  • A Hugging Face demonstration.

Installation

Language Package Requirements
Python smsd on PyPI CPython 3.12–3.15; RDKit optional
Python, NVIDIA GPU (optional) smsd-cuda on PyPI Linux x86_64 with an NVIDIA GPU and a driver for CUDA 12; the same version as smsd
Python, Apple GPU (optional) smsd-metal on PyPI macOS 14 or later on Apple silicon; the same version as smsd
Java com.bioinceptionlabs:smsd (library) and com.bioinceptionlabs:smsd-cli (command-line tool) on Maven Central, at 8.2.1 Java 8 or later; CDK 2.14.1
C++ Header-only library in cpp/include A C++17 compiler

Release files are on the GitHub releases page. The supported-platforms table covers the CPU wheels, the optional CUDA and Metal packages and the Java JARs. The installation guide explains downloads and source builds.

Quick start

Each example finds benzene in phenol, then computes the MCS of N-methylacetamide and propanamide. Neither contains the other; they share the four atoms of C–C(=O)–N. Run the commands from the repository root.

C++

Save this as example.cpp:

#include <smsd/smsd.hpp>
#include <iostream>

int main() {
    const auto benzene = smsd::parseSMILES("c1ccccc1");
    const auto phenol = smsd::parseSMILES("c1ccc(O)cc1");
    const bool embedded = !smsd::Substructure::find(benzene).match(phenol).matches.empty();
    const auto query = smsd::parseSMILES("CC(=O)NC");   // N-methylacetamide
    const auto target = smsd::parseSMILES("CCC(=O)N");  // propanamide
    const auto result = smsd::MCS::find(query).match(target);
    if (!embedded || !result.optimal || result.matches.empty()
            || result.matches.front().atomMapping.size() != 4) {
        return 1;
    }
    std::cout << "MCS atoms: " << result.matches.front().atomMapping.size() << '\n';
    return 0;
}
c++ -std=c++17 -O2 -pthread -I cpp/include example.cpp -o example
./example

See the C++ module and the C++ guide.

Java

Build and install the library and the command-line tool into the local Maven repository:

mvn -f java/pom.xml install

Maven projects can use the 8.2.1 library from Maven Central. It brings only the CDK modules it needs:

<dependency>
  <groupId>com.bioinceptionlabs</groupId>
  <artifactId>smsd</artifactId>
  <version>8.2.1</version>
</dependency>

In Gradle, write implementation("com.bioinceptionlabs:smsd:8.2.1"). The example below also parses SMILES, which needs org.openscience.cdk:cdk-smiles:2.14.1; the Java module lists the optional additions and the smsd-cli artefact. Save this as QuickStart.java:

import com.bioinception.smsd.core.MCS;
import com.bioinception.smsd.core.SearchResult;
import com.bioinception.smsd.core.Substructure;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.silent.SilentChemObjectBuilder;
import org.openscience.cdk.smiles.SmilesParser;

public class QuickStart {
    public static void main(String[] args) throws Exception {
        SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());
        IAtomContainer benzene = parser.parseSmiles("c1ccccc1");
        IAtomContainer phenol = parser.parseSmiles("c1ccc(O)cc1");
        boolean embedded = Substructure.find(benzene).match(phenol).found();
        IAtomContainer query = parser.parseSmiles("CC(=O)NC");   // N-methylacetamide
        IAtomContainer target = parser.parseSmiles("CCC(=O)N");  // propanamide
        SearchResult result = MCS.find(query).withTimeout(1000).match(target);
        if (!embedded || !result.optimal() || !result.found()
                || result.matches().get(0).atomCount() != 4) {
            throw new IllegalStateException("Expected a proved four-atom MCS");
        }
        System.out.println("MCS atoms: " + result.matches().get(0).atomCount());
    }
}

Compile with Java 25 and run on Java 8 or later, here against the self-contained JAR of the build, which includes CDK and cdk-smiles:

javac --release 8 -cp java/cli/target/smsd-cli-8.2.1-jar-with-dependencies.jar QuickStart.java
java -cp "java/cli/target/smsd-cli-8.2.1-jar-with-dependencies.jar:." QuickStart

With a Java 8 compiler, omit --release 8. On Windows, separate the classpath entries with ; instead of :. The Java module shows atom mappings for CDK containers, and the Java guide covers the full API.

Python

Build and install the package from the checkout:

python -m pip install -e .
import smsd

assert smsd.Substructure.find("c1ccccc1").match("c1ccc(O)cc1").found  # benzene in phenol
query = "CC(=O)NC"    # N-methylacetamide
target = "CCC(=O)N"   # propanamide
result = smsd.MCS.find(query).match(target)
assert result.optimal and result.best.atom_count == 4
print("MCS atoms:", result.best.atom_count)

See the Python package, the Python guide and the Python examples.

Screening

Rank a library by ECFP4 similarity, then search it by substructure as a prepared corpus; the search can use all cores:

import smsd

library = ["CC(=O)Oc1ccccc1", "OC(=O)c1ccccc1O", "CC(=O)Nc1ccc(O)cc1", "c1ccccc1"]
ranked = smsd.batch_similarity("CC(=O)Oc1ccccc1C(=O)O", library)  # aspirin
corpus = smsd.TargetCorpus.from_smiles(library)
corpus.prewarm()
acids = smsd.Substructure.smarts("C(=O)[OX2H1]").match_many(corpus, num_threads=0)
print([library[i] for i, _ in ranked][:2], sum(r.found for r in acids))

The Python examples screen a library of 2,744 molecules and filter by MCS similarity before computing the MCS.

GPU screening (optional)

On Linux x86_64 with an NVIDIA GPU, install smsd-cuda next to smsd of the same version:

python -m pip install "smsd==8.2.1" "smsd-cuda==8.2.1"

ECFP4 screens of a prepared TargetCorpus use the GPU automatically on a Tesla T4 when the corpus has at least 100,000 targets, with no change to your code, and the prepared fingerprints stay on the device between screens. Exact graph matching always uses the CPU. Smaller corpora and other devices screen on the CPU unless SMSD_CUDA_MIN_TARGETS is set to a positive integer, which replaces the T4 default (see CUDA screening). On any NVIDIA GPU with compute capability 7.5 or later, request the device explicitly with the packed-corpus backend "cuda" or with match_corpus(..., gpu_prefilter=True); the GPU screening example shows both. The native screen preserves CPU scores and hit order, with CPU fallback on a GPU error. See CUDA screening for that contract. The explicit packed-corpus backends have a separate error and fallback contract.

The smsd-cuda package also provides kernel preloading, bounded retained workspaces, opt-in CUDA Graph replay and on-device top-k filtering.

On an Apple silicon Mac, install smsd-metal instead:

python -m pip install "smsd==8.2.1" "smsd-metal==8.2.1"

The same prepared ECFP4 screens then use the Apple GPU automatically on an Apple M5 for corpora of at least 100,000 targets. SMSD_METAL_MIN_TARGETS extends this to other Apple GPUs and smaller corpora, and match_corpus(..., gpu_prefilter=True) requests the Apple GPU for a pre-screen. Packed fingerprint indexes do not use Metal. CPU and GPU screening describes both packages side by side.

The 8.2.1 release has a GPU Docker image, smsd-8.2.1-cuda-linux-amd64.tar.xz, with Python, smsd, smsd-cuda and the CUDA runtime. The image needs the NVIDIA Container Toolkit:

docker load -i smsd-8.2.1-cuda-linux-amd64.tar.xz
docker run --rm --gpus all smsd:8.2.1-cuda12.8 -c "import smsd; print(smsd.gpu_device_info())"

Native Windows CUDA is not provided. On Windows, use the Linux CUDA package or this image under WSL2, as described in GPU screening on Windows.

The installation guide covers the CPU images for amd64 and arm64.

Command line

The Java build also produces the command-line tool, as a self-contained JAR:

java -jar java/cli/target/smsd-cli-8.2.1-jar-with-dependencies.jar \
  --Q SMI --q "c1ccccc1" --T SMI --t "c1ccc(O)cc1" --json -

This runs a substructure search; add --mode mcs for MCS search, and use --help to list the options. The tool also reads MOL, MOL2, CML and PDB files, and SDF files as batch targets.

Features

  • Substructure search with molecule or SMARTS queries, as non-induced (default) or induced embeddings.
  • MCS search for the maximum common induced subgraph (MCIS) or the maximum common edge subgraph (MCES), connected or as disconnected fragments, with optional atom weights.
  • Chemistry options for bond order, aromaticity, formal charge, isotopes, ring membership, stereo and tautomers.
  • Prepared queries that can be searched against many targets, in turn or on several threads.
  • Fingerprints for screening: circular (ECFP and FCFP), path, topological-torsion and structural-key fingerprints, including the 166 MACCS keys, configured once with FingerprintOptions (rings, ring sizes, R/S and E/Z, fragments, Murcko framework) and giving the same bits in C++, Java and Python of the same version. Batch searches can use all processor cores. Optional GPU screening is provided separately by smsd-cuda for NVIDIA GPUs and smsd-metal for Apple silicon Macs; matching runs on the CPU. See CPU and GPU screening for its scope. Native C++ source builds on macOS also include optional Metal support, used only by programs that link it.
  • Utilities, including R-group decomposition, MOL and SDF input, SVG depiction (C++ and Python) and molecular standardisation (Java).

Search calls

MCS and Substructure prepare a reusable query and offer the same calls:

Call C++ and Java Python
Best match for one target match(target) match(target)
All optimal MCS mappings, or all substructure embeddings, up to a limit (default 1,000) matchAll(target, limit) match_all(target, limit)
Independent searches over a collection of targets matchMany(targets) match_many(targets)

MCS defaults to a connected MCIS. Without atom weights, MCIS maximises mapped atoms, then bonds; MCES maximises common bonds, then their atoms. A search that reaches its timeout can still return a valid mapping, so check the completion and optimality flags before treating it as a proved optimum.

Documentation

The documentation site, asad.github.io/SMSD, hosts the user guide, notebooks and reference. The same pages are in this repository:

Guide Contents
User guide Task-based chapters: getting started, substructure and SMARTS, MCS, fingerprints, screening, the packed index, CPU and GPU, command line, C++ and Java
Installation Platform requirements, downloads and source builds
C++ guide Header-only library, chemistry options and file input
Java guide CDK molecules, search, fingerprints, R-groups and the command-line tool
Python guide Search, results, chemistry options and RDKit integration
Python examples and notebooks Fingerprints, screening, depiction, layout, stereo, files and R-groups
Python adapters NumPy, SciPy, pandas, Polars, Arrow, PyTorch, scikit-learn and PyTorch Geometric
Molecular tools and MCP Bounded local tools, proof/status fields, function definitions and framework adapters
Connecting AI assistants Local MCP set-up for assistant clients and tool definitions for your own Python loop
API reference Interfaces, options, proof and stopping status, I/O, fingerprints, adapters and GPU scope
Packed corpora Memory-mapped rows, CPU/CUDA scans, exact top-k, Butina and MaxMin
Conda recipes CPU and CUDA recipes, with conda, mamba and Pixi routes
SMARTS export Selected common bonds, match-option constraints and library search
Search algorithms Search guarantees, result semantics and differences between the languages
Benchmarks How to run the benchmarks and report results
Release notes Highlights, downloads and upgrade notes for each release
Changelog Changes in each release

The Java guide explains how to generate the Javadoc reference.

Licence

SMSD Pro is released under the Apache License 2.0. The same terms apply to academic and commercial use, with no fee or registration. Redistributions must include the LICENSE and NOTICE files and retain the copyright notices; the NOTICE file also sets out the trademark terms. Bundled dependencies carry their own licence notices. The Java CLI JAR with dependencies and the CPU Docker images bundle CDK under the LGPL-2.1, Beam under the BSD 2-Clause License and vecmath under the GPL-2.0 with the Classpath exception; for the runtimes that Python wheels can bundle, see the LLVM OpenMP, GCC OpenMP and Microsoft C++ and OpenMP notices.

Citation

If you use SMSD Pro in research, please cite:

Rahman SA. SMSD Pro: Coverage-Driven, Tautomer-Aware Maximum Common Substructure Search. ChemRxiv, 2026. DOI: 10.26434/chemrxiv.15001534/v1

Rahman SA, Bashton M, Holliday GL, Schrader R, Thornton JM. Small Molecule Subgraph Detector (SMSD) toolkit. Journal of Cheminformatics, 1:12, 2009. DOI: 10.1186/1758-2946-1-12

To cite the software itself, use the DOI for all versions, 10.5281/zenodo.23639199, which resolves to the latest archived version. Citation metadata is available in CITATION.cff.

Copyright (c) 2018-2026 BioInception PVT LTD. Algorithm Copyright (c) 2009-2026 Syed Asad Rahman.

About

SMSD Pro: exact substructure, SMARTS, maximum common substructure (MCS) and fingerprint similarity search for molecules in Python, C++ and Java. Wheels for Linux, macOS (Apple silicon) and Windows, with optional GPU screening on NVIDIA CUDA and Apple silicon. Install with pip, conda or Docker.

asad.github.io/SMSD/

Topics

apple-siliconcdkcheminformaticschemistrycondacppcudadrug-discoveryfingerprintsgraph-matchingjavamaximum-common-substructuremcpmcsmolecular-similaritypythonrdkitsmartssubstructure-searchvirtual-screening

Resources

Readme
Apache-2.0 license
Activity

Stars

50 stars

Watchers

3 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.