hasSubstructMatch#

nvmolkit.substructure.hasSubstructMatch(
targets: Sequence[Mol],
queries: Sequence[Mol],
config: SubstructSearchConfig | None = None,
) ndarray#

Check if targets contain query substructures (boolean results).

More efficient than getSubstructMatches() when only existence is needed.

Supports recursive SMARTS queries. Does not currently support chirality-aware matching (useChirality), enhanced stereochemistry (useEnhancedStereo), or other advanced RDKit SubstructMatchParameters options.

Parameters:
  • targets – List of target RDKit molecules.

  • queries – List of query RDKit molecules (typically from SMARTS).

  • configSubstructSearchConfig with execution settings. If None, uses default configuration.

Returns:

2-D numpy array of uint8 with shape (len(targets), len(queries)). results[target_idx, query_idx] is 1 if the query is a substructure of the target, 0 otherwise.