Skip to main content

Ultrafast Fingerprint Similarity (UFFPSim)

UFFPSim is a high-performance library for exact chemical fingerprint similarity search over large molecular databases. It extends the BitBound algorithm with a second pruning stage based on clustered fingerprints within each popcount bin, reducing the number of exact Tanimoto comparisons required. The library supports both in-memory search for high-throughput screening and disk-based search for databases that exceed available RAM, enabling exact queries on databases with up to a billion compounds.

Installation

The simplest way to install is:

UFFPSIM_NATIVE=1 pip install -v .

If the installation fails due to missing dependencies or shared libraries, you can alternatively use a conda environment. The following will create a new conda environment in the current working directory and install all requirements from the dev-environment.yaml file.

# Create development conda environment
conda env create --prefix ./venv --file dev-environment.yaml

# activate the environment
conda activate ./venv

# install uffpsim
UFFPSIM_NATIVE=1 pip install -v .

Install with -march=native support

This will compile and build uffpsim that will be highly optimized for the current CPU.

UFFPSIM_NATIVE=1 pip install -v .

Install with AVX512-VPOPCNTDQ support

The AVX512-VPOPCNTDQ instruction set could speed-up similarity calculation by more than 50% on newest Intel CPUs.

To check whether CPU support AVX512-VPOPCNTDQ, following command in linux should show avx512_vpopcntdq in the list.

lscpu | grep Flags | grep avx

If avx512_vpopcntdq is not in the above list, it means CPU does not have the capability to use this method.

This will compile and build uffpsim with AVX512-VPOPCNTDQ support.

UFFPSIM_AVX512=1 pip install -v .

How to use?

The package can be used as a Python library or as the command.

Command line interface (CLI)

Command Description
create-database Create a new uffpsim HDF5 database from a molecular input file.
redo-clustering Redo inner clustering for an existing database with a new similarity threshold.
build-mol-id-index-table Build serialized MolIdIndexTable for an existing database.
search Search one or more SMILES against the database and write hits to a CSV file.
launch-web-app Launch the uffpsim interactive web application for visual similarity searching.

For more details about the CLIs, visit the documentation site.

Creating database

# Download ChEMBL 33 to use as an example
curl https://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/releases/chembl_33/chembl_33.sdf.gz -o ./chembl_33.sdf.gz
ls -artl chembl_33.sdf.gz
# -rw-rw-r-- 1 user user 770312723 Jun 11 12:28 chembl_33.sdf.gz

Serial ID creation

IDs are created automatically as string serial numbers starting from '1'. mol_id_max_chars sets the maximum number of characters in a molecule ID and must be a multiple of 8 minus one (e.g. 7, 15, 23, 31). This value is fixed at database creation time and cannot be changed afterwards.

Molecule IDs are stored inline in the same fixed-size array as the fingerprint bits, so every entry in the database reserves exactly mol_id_max_chars + 1 bytes for the ID regardless of actual ID length. Set it to comfortably fit your longest molecule ID — for example, ChEMBL IDs (CHEMBL1234567, 13 chars) fit within mol_id_max_chars=15.

Warning: IDs longer than mol_id_max_chars are silently truncated, which can cause incorrect lookups. Choose a value large enough for your dataset upfront.

Memory trade-off: each additional 8 characters of headroom costs 8 bytes per molecule. As a ballpark example, for a 2M-molecule database, increasing from mol_id_max_chars=15 to mol_id_max_chars=31 adds ~16 MB to the database size.

Creating database (serial fingerprints, serial clustering)

Fingerprints are calculated one molecule at a time and clustering runs in a single thread. This is the simplest option and uses the least memory.

from uffpsim import create_database

create_database(
    input_file='chembl_33.sdf.gz',
    db_file='chembl_2048b.h5',
    fp_type='Morgan',
    fp_params={'fpSize': 2048, 'radius': 2},
    gen_ids=True,
    mol_id_prop=None,
    mol_id_max_chars=15,
    inner_clustering_threshold=0.15,
)

Creating database (serial fingerprints, parallel clustering)

Fingerprint calculation is still serial, but the inner-clustering step uses multiple OpenMP threads within the same process. Set OMP_NUM_THREADS to control the thread count, e.g. export OMP_NUM_THREADS=4.

from uffpsim import create_database

create_database(
    input_file='chembl_33.sdf.gz',
    db_file='chembl_2048b.h5',
    fp_type='Morgan',
    fp_params={'fpSize': 2048, 'radius': 2},
    gen_ids=True,
    mol_id_prop=None,
    mol_id_max_chars=15,
    inner_clustering_threshold=0.15,
    cluster_parallel=True,
)

Creating database (parallel fingerprints, parallel clustering)

Fingerprint calculation is distributed across workers independent Python processes using ProcessPoolExecutor, which bypasses the GIL and speeds up the RDKit computation step. Writing to the HDF5 file and inner-clustering remain serial and parallel (via OpenMP) respectively. Note that spawning multiple processes requires more memory than the serial approach.

Set OMP_NUM_THREADS to control clustering threads independently of workers.

from uffpsim import create_database_parallel

create_database_parallel(
    input_file='chembl_33.sdf.gz',
    db_file='chembl_2048b.h5',
    workers=4,
    fp_type='Morgan',
    fp_params={'fpSize': 2048, 'radius': 2},
    gen_ids=True,
    mol_id_prop=None,
    mol_id_max_chars=15,
    inner_clustering_threshold=0.15,
    cluster_parallel=True,
)

Redoing inner-clustering

Inner-clustering can be re-performed with a different threshold. It is useful to benchmark different threshold values for a new database. The clustering data is written back to the same file.

from uffpsim import redo_inner_clustering

redo_inner_clustering("chembl_2048b.h5", 0.1, cluster_parallel=True)

Searching database

Searching database sequentially

Each time only one SMILES string can be used as input.

from uffpsim import UFFPSimSearchEngine

search_engine = UFFPSimSearchEngine("chembl_2048b.h5")

# print few parameters from database
print(search_engine.fp_store.fp_params_json)
print(search_engine.fp_store.mol_id_max_chars)
print(search_engine.fp_store.fp_bits_size)
print(search_engine.fp_store.inner_clustering_threshold)

# similarity threshold of 0.8 and return only up to one hit
result_1 = search_engine.search("Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccc(C#N)cc1", 0.8, limit_by=1)
print(result_1)

# similarity threshold of 0.6 and return only up to 10 hits
result_2 = search_engine.search("Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccc(C#N)cc1", 0.6, limit_by=10)
print(result_2)
# Example of result from search
>>> search_engine.search("Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccc(C#N)cc1", 0.8, limit_by=1)
[('2', 1.0)]  # '2' matches the second SMILES string in `uffpsim/tests/data/10mols.smi`

Searching database in batch mode

Searching in batch mode could potentially speed-up the search by up to two times depending on the nature of queries.

from uffpsim import UFFPSimSearchEngine

search_engine = UFFPSimSearchEngine("chembl_2048b.h5")

# list of smiles to be searched
smiles_list = [
    "Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccccc1Cl",
    "Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccc(C#N)cc1",
    "Cc1cc(-n2ncc(=O)[nH]c2=O)cc(C)c1C(O)c1ccc(Cl)cc1",
    "Cc1ccc(C(=O)c2ccc(-n3ncc(=O)[nH]c3=O)cc2)cc1",
    "Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccc(Cl)cc1",
    "Cc1cc(-n2ncc(=O)[nH]c2=O)ccc1C(=O)c1ccccc1",
    "Cc1cc(Br)ccc1C(=O)c1ccc(-n2ncc(=O)[nH]c2=O)cc1Cl",
    "O=C(c1ccc(Cl)cc1Cl)c1ccc(-n2ncc(=O)[nH]c2=O)cc1Cl",
    "CS(=O)(=O)c1ccc(C(=O)c2ccc(-n3ncc(=O)[nH]c3=O)cc2Cl)cc1",
    "c1cc2cc(c1)-c1cccc(c1)C[n+]1ccc(c3ccccc31)NCCCCCCCCCCNc1cc[n+](c3ccccc13)C2",
]

# similarity threshold of 0.8 and return only upto one hit
result_1 = search_engine.batch_search(smiles_list, 0.8, limit_by=1)
print(result_1)

# similarity threshold of 0.6 and return only upto 10 hits
result_2 = search_engine.batch_search(smiles_list, 0.6, limit_by=10)
print(result_2)

Development Setup

conda env create --prefix ./venv --file dev-environment.yaml # Create development conda environment
conda activate ./venv
pip install -ve .

Metadata

Release files for uffpsim 0.1.3

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

Built distributions (wheels)

Table of built distributions (wheels) for uffpsim 0.1.3
File
uffpsim-0.1.3-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
uffpsim-0.1.3-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details
uffpsim-0.1.3-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
uffpsim-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
uffpsim-0.1.3-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details
uffpsim-0.1.3-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
uffpsim-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
uffpsim-0.1.3-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details
uffpsim-0.1.3-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
uffpsim-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
uffpsim-0.1.3-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details
uffpsim-0.1.3-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 40.6 MB

Release files / uffpsim-0.1.3-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL uffpsim-0.1.3-cp313-cp313-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a2f5b93f2ceb0ad9f0b8a2c5f7f625acbced5328d6a5545b7f55e1f4d01685f8
BLAKE2b-256 checksum
How to use checksums
6a1dfc12712da066da5a3900fb08849b4d91af0a9466eedca4770014d04dcbab
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp313-cp313-macosx_15_0_arm64.whl

Download URL uffpsim-0.1.3-cp313-cp313-macosx_15_0_arm64.whl
Size 2.2 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
39d346e115cd8884504d6f0b92f2bd99a3d034b0022279e3c5e52a9d3b572951
BLAKE2b-256 checksum
How to use checksums
691714b8d124e6c1c37761243b97c79df950d708615a2efc52cbe1bc80dadaa0
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp313-cp313-macosx_14_0_arm64.whl

Download URL uffpsim-0.1.3-cp313-cp313-macosx_14_0_arm64.whl
Size 2.0 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
1d83cb59e23928cbb3d3b4998fae394390ff77e59babf2df34badf6ea6bacaf3
BLAKE2b-256 checksum
How to use checksums
d810f34a39c0c5fab1611a20a8802db9608604547f615eaac5b0a36cd2e60d08
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL uffpsim-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl
Size 5.9 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
974e02aaa34a8ad67ea4aff8c9f3479c05e83107c97d7a11c94bd633cf8399ae
BLAKE2b-256 checksum
How to use checksums
63b9c4082e92d7e7499a7a7a11e4ca33e13145e4526aa8470ba3faec2ded1f62
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp312-cp312-macosx_15_0_arm64.whl

Download URL uffpsim-0.1.3-cp312-cp312-macosx_15_0_arm64.whl
Size 2.2 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
f6b352056f61bcf2eceeafbdf0ba7373148da17d4a724e0a2ca5c569da241666
BLAKE2b-256 checksum
How to use checksums
e35f07adc106729e5bd6eb8dc73b0dc6637918eacf9155402367e76d6c2f9ef9
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp312-cp312-macosx_14_0_arm64.whl

Download URL uffpsim-0.1.3-cp312-cp312-macosx_14_0_arm64.whl
Size 2.0 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
522332ac2e0fe652f3d9cbfb81a6d5e28c28695d6043a66526d88be4669bceb1
BLAKE2b-256 checksum
How to use checksums
edcbb69a81944f41c52305e226ec62ad2ec49e797398f61f8aa7f2a343496d39
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL uffpsim-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl
Size 6.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
696c41731bea7c5e537f468f651e7850f1739677bc63313bae1b489428cb1686
BLAKE2b-256 checksum
How to use checksums
b4743a5fd03bef46084f8e7d7ca9837955a45aae516f8815e82c052888ec9620
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp311-cp311-macosx_15_0_arm64.whl

Download URL uffpsim-0.1.3-cp311-cp311-macosx_15_0_arm64.whl
Size 2.2 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
21e5648d25427b9e4da67ce409194657f2c31ad90372900272ad3712360ccb64
BLAKE2b-256 checksum
How to use checksums
b366b7d16cdf50c3273cd87a0a4950d1d57835c537e5118c6748d4eaeae92d7a
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp311-cp311-macosx_14_0_arm64.whl

Download URL uffpsim-0.1.3-cp311-cp311-macosx_14_0_arm64.whl
Size 2.0 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
ca4b83f1f17ca19e6bd668004161e09b62f184f31c21a3476790a62f35b90119
BLAKE2b-256 checksum
How to use checksums
fc69d7d2eed4357f75ec14b8d75f0811f47ae74d78081e73220ef25db836a643
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL uffpsim-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl
Size 5.9 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b4875c26739b42086ed2214e60395be14eb030977ba3d9e52320012a1593bf64
BLAKE2b-256 checksum
How to use checksums
fcf033689adb86783cd5d6ff793ccc3fae2a3a9bff5ea4fca4141e772faa9dc0
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp310-cp310-macosx_15_0_arm64.whl

Download URL uffpsim-0.1.3-cp310-cp310-macosx_15_0_arm64.whl
Size 2.2 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
7d6e21ca6ce797bde146f878b46e4db25d9575eae7b4b5f6209a18071c780c3f
BLAKE2b-256 checksum
How to use checksums
8f4f381da2b048459aff532f7a6c474adc82c27032a6858016acf7253eca3740
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 30, 2026.

Transparency log

Release files / uffpsim-0.1.3-cp310-cp310-macosx_14_0_arm64.whl

Download URL uffpsim-0.1.3-cp310-cp310-macosx_14_0_arm64.whl
Size 2.0 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
3082439f5000ae219c4144dde30b659a140e905a98e096064fa911f94ce7bc22
BLAKE2b-256 checksum
How to use checksums
fd837d49b6ad86f5d8efa3dc8fbcc47b6d45c5b25ffc092953e7ffccd277536b
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 30, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.0

12 release files

This release

0.1.3 This release

12 release files

0.1.2

4 release files

0.1.1

4 release files

0.1.0

2 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