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)>
161template <
typename T1,
typename T2>
163 bool recursionPossible =
true,
bool useChirality =
false,
164 bool useQueryQueryMatches =
false) {
170 std::vector<MatchVectType> matchVects =
SubstructMatch(mol, query, params);
171 if (matchVects.size()) {
172 matchVect = matchVects.front();
176 return matchVect.size() != 0;
201template <
typename T1,
typename T2>
203 std::vector<MatchVectType> &matchVect,
204 bool uniquify =
true,
bool recursionPossible =
true,
205 bool useChirality =
false,
206 bool useQueryQueryMatches =
false,
207 unsigned int maxMatches = 1000,
208 int numThreads = 1) {
217 return static_cast<unsigned int>(matchVect.size());
227 bool recursionPossible,
bool useChirality,
228 bool useQueryQueryMatches) {
234 std::vector<MatchVectType> matchVects =
236 if (matchVects.size()) {
237 matchVect = matchVects.front();
241 return matchVect.size() != 0;
247 std::vector<MatchVectType> &matchVect,
248 bool uniquify,
bool recursionPossible,
249 bool useChirality,
bool useQueryQueryMatches,
250 unsigned int maxMatches,
int numThreads) {
259 return static_cast<unsigned int>(matchVect.size());
269 bool operator()(
const std::uint32_t q_c[],
const std::uint32_t m_c[]);
272 const ROMol &d_query;
275 std::unordered_map<unsigned int, StereoGroup const *> d_molStereoGroups;
276#ifdef RDK_INTERNAL_BITSET_HAS_HASH
278 using HashedStorageType = boost::dynamic_bitset<>;
281 using HashedStorageType = std::string;
283 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
RDKIT_SUBSTRUCTMATCH_EXPORT unsigned int SubstructMatchCount(const ROMol &mol, const ROMol &query, const SubstructMatchParameters ¶ms=SubstructMatchParameters())
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()