11#ifndef RD_SUBSTRUCTMATCH_H
12#define RD_SUBSTRUCTMATCH_H
17#include <unordered_set>
19#include <unordered_map>
24#include <boost/dynamic_bitset.hpp>
25#if BOOST_VERSION >= 107100
26#define RDK_INTERNAL_BITSET_HAS_HASH
65 std::function<bool(
const ROMol &mol,
66 std::span<const unsigned int> match)>
77 std::function<bool(
const Atom &queryAtom,
const Atom &molAtom)>
83 std::function<bool(
const Bond &queryBond,
const Bond &molBond)>
147template <
typename T1,
typename T2>
149 bool recursionPossible =
true,
bool useChirality =
false,
150 bool useQueryQueryMatches =
false) {
156 std::vector<MatchVectType> matchVects =
SubstructMatch(mol, query, params);
157 if (matchVects.size()) {
158 matchVect = matchVects.front();
162 return matchVect.size() != 0;
187template <
typename T1,
typename T2>
189 std::vector<MatchVectType> &matchVect,
190 bool uniquify =
true,
bool recursionPossible =
true,
191 bool useChirality =
false,
192 bool useQueryQueryMatches =
false,
193 unsigned int maxMatches = 1000,
194 int numThreads = 1) {
203 return static_cast<unsigned int>(matchVect.size());
213 bool recursionPossible,
bool useChirality,
214 bool useQueryQueryMatches) {
220 std::vector<MatchVectType> matchVects =
222 if (matchVects.size()) {
223 matchVect = matchVects.front();
227 return matchVect.size() != 0;
233 std::vector<MatchVectType> &matchVect,
234 bool uniquify,
bool recursionPossible,
235 bool useChirality,
bool useQueryQueryMatches,
236 unsigned int maxMatches,
int numThreads) {
245 return static_cast<unsigned int>(matchVect.size());
255 bool operator()(
const std::uint32_t q_c[],
const std::uint32_t m_c[]);
258 const ROMol &d_query;
261 std::unordered_map<unsigned int, StereoGroup const *> d_molStereoGroups;
262#ifdef RDK_INTERNAL_BITSET_HAS_HASH
264 using HashedStorageType = boost::dynamic_bitset<>;
267 using HashedStorageType = std::string;
269 std::unordered_set<HashedStorageType> matchesSeen;
Defines the class StereoGroup which stores relationships between the absolute configurations of atoms...
The class for representing atoms.
class for representing a bond
MolBundle contains a collection of related ROMols.
MolMatchFinalCheckFunctor(const ROMol &query, const ROMol &mol, const SubstructMatchParameters &ps)
bool operator()(const std::uint32_t q_c[], const std::uint32_t m_c[])
#define RDKIT_SUBSTRUCTMATCH_EXPORT
std::vector< std::pair< int, int > > MatchVectType
used to return matches from substructure searching, The format is (queryAtomIdx, molAtomIdx)
RDKIT_SUBSTRUCTMATCH_EXPORT std::vector< MatchVectType > SubstructMatch(const ROMol &mol, const ROMol &query, const SubstructMatchParameters ¶ms=SubstructMatchParameters())
Find a substructure match for a query in a molecule.
RDKIT_SUBSTRUCTMATCH_EXPORT void updateSubstructMatchParamsFromJSON(SubstructMatchParameters ¶ms, const std::string &json)
RDKIT_SUBSTRUCTMATCH_EXPORT std::string substructMatchParamsToJSON(const SubstructMatchParameters ¶ms)
bool operator()(const Atom &queryAtom, const Atom &targetAtom) const
AtomCoordsMatchFunctor(int refConfId=-1, int queryConfId=-1, double tol=1e-4)
bool extraAtomCheckOverridesDefaultCheck
std::function< bool(const ROMol &mol, std::span< const unsigned int > match)> extraFinalCheck
bool extraBondCheckOverridesDefaultCheck
unsigned int maxMatches
maximum number of matches to return
bool uniquify
uniquify (by atom index) match results
std::vector< std::string > atomProperties
std::vector< std::string > bondProperties
bool recursionPossible
Allow recursive queries.
unsigned int maxRecursiveMatches
matching should return
bool useQueryQueryMatches
bool specifiedStereoQueryMatchesUnspecified
bool aromaticMatchesConjugated
bool aromaticMatchesSingleOrDouble
std::function< bool(const Atom &queryAtom, const Atom &molAtom)> extraAtomCheck
std::function< bool(const Bond &queryBond, const Bond &molBond)> extraBondCheck
SubstructMatchParameters()