MorganFingerprintGenerator#

class nvmolkit.fingerprints.MorganFingerprintGenerator(radius: int, fpSize: int)#

Morgan fingerprint generator.

__init__(radius: int, fpSize: int)#

Initialize the Morgan fingerprint generator.

Parameters:
  • radius – The radius of the Morgan fingerprint.

  • fpSize – The size of the fingerprint. Must be one of {128, 256, 512, 1024, 2048}.

GetFingerprints(
mols: list,
num_threads: int = 0,
)#

Compute Morgan fingerprints for a list of molecules.

Preprocessing of fingerprinting features is done on the CPU, and is parallelized with the num_threads argument. The resulting tensor has dtype torch.int32 and contains a packed fingerprint for each molecule, one row per molecule.

Packed fingerprints can be passed directly to nvMolKit similarity calculations, or unpacked via unpack_fingerprint.

Parameters:
  • mols – List of RDKit molecules to generate fingerprints for

  • num_threads – Number of CPU threads to use for fingerprint generation. If 0, uses all available threads.

Returns:

AsyncGpuResult wrapping a torch.Tensor of shape (len(mols), fpSize / 32) containing the fingerprints. Each row is a fingerprint for the corresponding molecule.