QueryOps.h
Go to the documentation of this file.
//
// Copyright (C) 2003-2021 Greg Landrum and other RDKit contributors
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
//! \file QueryOps.h
/*!
\brief Includes a bunch of functionality for handling Atom and Bond queries.
*/
#include <RDGeneral/export.h>
#ifndef RD_QUERY_OPS_H
#define RD_QUERY_OPS_H
#include <GraphMol/RDKitBase.h>
#include <Query/QueryObjects.h>
#include <Query/Query.h>
#include <DataStructs/BitVects.h>
#include <DataStructs/BitOps.h>
#ifdef RDK_THREADSAFE_SSS
#include <mutex>
#include <utility>
#endif
namespace RDKit {
typedef Queries::Query<bool, Atom const *, true> ATOM_BOOL_QUERY;
typedef Queries::Query<bool, Bond const *, true> BOND_BOOL_QUERY;
typedef Queries::AndQuery<int, Atom const *, true> ATOM_AND_QUERY;
typedef Queries::AndQuery<int, Bond const *, true> BOND_AND_QUERY;
typedef Queries::OrQuery<int, Atom const *, true> ATOM_OR_QUERY;
typedef Queries::OrQuery<int, Bond const *, true> BOND_OR_QUERY;
typedef Queries::XOrQuery<int, Atom const *, true> ATOM_XOR_QUERY;
typedef Queries::XOrQuery<int, Bond const *, true> BOND_XOR_QUERY;
typedef Queries::EqualityQuery<int, Atom const *, true> ATOM_EQUALS_QUERY;
typedef Queries::EqualityQuery<int, Bond const *, true> BOND_EQUALS_QUERY;
typedef Queries::GreaterQuery<int, Atom const *, true> ATOM_GREATER_QUERY;
typedef Queries::GreaterQuery<int, Bond const *, true> BOND_GREATER_QUERY;
typedef Queries::GreaterEqualQuery<int, Atom const *, true>
ATOM_GREATEREQUAL_QUERY;
typedef Queries::GreaterEqualQuery<int, Bond const *, true>
BOND_GREATEREQUAL_QUERY;
typedef Queries::LessQuery<int, Atom const *, true> ATOM_LESS_QUERY;
typedef Queries::LessQuery<int, Bond const *, true> BOND_LESS_QUERY;
typedef Queries::LessEqualQuery<int, Atom const *, true> ATOM_LESSEQUAL_QUERY;
typedef Queries::LessEqualQuery<int, Bond const *, true> BOND_LESSEQUAL_QUERY;
typedef Queries::RangeQuery<int, Atom const *, true> ATOM_RANGE_QUERY;
typedef Queries::RangeQuery<int, Bond const *, true> BOND_RANGE_QUERY;
typedef Queries::SetQuery<int, Atom const *, true> ATOM_SET_QUERY;
typedef Queries::SetQuery<int, Bond const *, true> BOND_SET_QUERY;
typedef Queries::Query<int, Bond const *, true> BOND_NULL_QUERY;
typedef Queries::Query<int, Atom const *, true> ATOM_NULL_QUERY;
// -------------------------------------------------
// common atom queries
static inline int queryAtomAromatic(Atom const *at) {
return at->getIsAromatic();
};
static inline int queryAtomAliphatic(Atom const *at) {
return !(at->getIsAromatic());
};
static inline int queryAtomExplicitDegree(Atom const *at) {
return at->getDegree();
};
static inline int queryAtomTotalDegree(Atom const *at) {
return at->getTotalDegree();
};
//! D and T are treated as "non-hydrogen" here
static inline int queryAtomNonHydrogenDegree(Atom const *at) {
int res = 0;
for (const auto nbri :
boost::make_iterator_range(at->getOwningMol().getAtomNeighbors(at))) {
const auto nbr = at->getOwningMol()[nbri];
if (nbr->getAtomicNum() != 1 || nbr->getIsotope() > 1) {
res++;
}
}
return res;
};
//! D and T are not treated as heavy atoms here
static inline int queryAtomHeavyAtomDegree(Atom const *at) {
int heavyDegree = 0;
for (const auto nbri :
boost::make_iterator_range(at->getOwningMol().getAtomNeighbors(at))) {
const auto nbr = at->getOwningMol()[nbri];
if (nbr->getAtomicNum() > 1) {
heavyDegree++;
}
}
return heavyDegree;
};
static inline int queryAtomHCount(Atom const *at) {
return at->getTotalNumHs(true);
};
static inline int queryAtomImplicitHCount(Atom const *at) {
return at->getTotalNumHs(false);
};
static inline int queryAtomHasImplicitH(Atom const *at) {
return int(at->getTotalNumHs(false) > 0);
};
static inline int queryAtomImplicitValence(Atom const *at) {
return at->getImplicitValence();
};
static inline int queryAtomExplicitValence(Atom const *at) {
return at->getExplicitValence() - at->getNumExplicitHs();
};
static inline int queryAtomTotalValence(Atom const *at) {
return at->getTotalValence();
};
static inline int queryAtomUnsaturated(Atom const *at) {
return at->getTotalDegree() < at->getTotalValence();
};
static inline int queryAtomNum(Atom const *at) { return at->getAtomicNum(); }
static inline int makeAtomType(int atomic_num, bool aromatic) {
return atomic_num + 1000 * static_cast<int>(aromatic);
}
static inline void parseAtomType(int val, int &atomic_num, bool &aromatic) {
if (val > 1000) {
aromatic = true;
atomic_num = val - 1000;
} else {
aromatic = false;
atomic_num = val;
}
}
static inline bool getAtomTypeIsAromatic(int val) {
if (val > 1000) return true;
return false;
}
static inline int getAtomTypeAtomicNum(int val) {
if (val > 1000) return val - 1000;
return val;
}
static inline int queryAtomType(Atom const *at) {
return makeAtomType(at->getAtomicNum(), at->getIsAromatic());
};
const int massIntegerConversionFactor = 1000;
static inline int queryAtomMass(Atom const *at) {
return static_cast<int>(
std::round(massIntegerConversionFactor * at->getMass()));
};
static inline int queryAtomIsotope(Atom const *at) {
return static_cast<int>(at->getIsotope());
};
static inline int queryAtomFormalCharge(Atom const *at) {
return static_cast<int>(at->getFormalCharge());
};
static inline int queryAtomNegativeFormalCharge(Atom const *at) {
return static_cast<int>(-1 * at->getFormalCharge());
};
static inline int queryAtomHybridization(Atom const *at) {
return at->getHybridization();
};
static inline int queryAtomNumRadicalElectrons(Atom const *at) {
return at->getNumRadicalElectrons();
};
static inline int queryAtomHasChiralTag(Atom const *at) {
return at->getChiralTag() != Atom::CHI_UNSPECIFIED;
};
static inline int queryAtomMissingChiralTag(Atom const *at) {
return at->getChiralTag() == Atom::CHI_UNSPECIFIED &&
at->hasProp(common_properties::_ChiralityPossible);
};
static inline int queryAtomHasHeteroatomNbrs(Atom const *at) {
ROMol::ADJ_ITER nbrIdx, endNbrs;
boost::tie(nbrIdx, endNbrs) = at->getOwningMol().getAtomNeighbors(at);
while (nbrIdx != endNbrs) {
const Atom *nbr = at->getOwningMol()[*nbrIdx];
if (nbr->getAtomicNum() != 6 && nbr->getAtomicNum() != 1) {
return 1;
}
++nbrIdx;
}
return 0;
};
static inline int queryAtomNumHeteroatomNbrs(Atom const *at) {
int res = 0;
ROMol::ADJ_ITER nbrIdx, endNbrs;
boost::tie(nbrIdx, endNbrs) = at->getOwningMol().getAtomNeighbors(at);
while (nbrIdx != endNbrs) {
const Atom *nbr = at->getOwningMol()[*nbrIdx];
if (nbr->getAtomicNum() != 6 && nbr->getAtomicNum() != 1) {
++res;
}
++nbrIdx;
}
return res;
};
static inline int queryAtomHasAliphaticHeteroatomNbrs(Atom const *at) {
ROMol::ADJ_ITER nbrIdx, endNbrs;
boost::tie(nbrIdx, endNbrs) = at->getOwningMol().getAtomNeighbors(at);
while (nbrIdx != endNbrs) {
const Atom *nbr = at->getOwningMol()[*nbrIdx];
if ((!nbr->getIsAromatic()) && nbr->getAtomicNum() != 6 &&
nbr->getAtomicNum() != 1) {
return 1;
}
++nbrIdx;
}
return 0;
};
static inline int queryAtomNumAliphaticHeteroatomNbrs(Atom const *at) {
int res = 0;
ROMol::ADJ_ITER nbrIdx, endNbrs;
boost::tie(nbrIdx, endNbrs) = at->getOwningMol().getAtomNeighbors(at);
while (nbrIdx != endNbrs) {
const Atom *nbr = at->getOwningMol()[*nbrIdx];
if ((!nbr->getIsAromatic()) && nbr->getAtomicNum() != 6 &&
nbr->getAtomicNum() != 1) {
++res;
}
++nbrIdx;
}
return res;
};
RDKIT_GRAPHMOL_EXPORT unsigned int queryAtomBondProduct(Atom const *at);
RDKIT_GRAPHMOL_EXPORT unsigned int queryAtomAllBondProduct(Atom const *at);
// -------------------------------------------------
// common bond queries
static inline int queryBondOrder(Bond const *bond) {
return static_cast<int>(bond->getBondType());
};
static inline int queryBondIsSingleOrAromatic(Bond const *bond) {
return static_cast<int>(bond->getBondType() == Bond::SINGLE ||
bond->getBondType() == Bond::AROMATIC);
};
static inline int queryBondIsDoubleOrAromatic(Bond const *bond) {
return static_cast<int>(bond->getBondType() == Bond::DOUBLE ||
bond->getBondType() == Bond::AROMATIC);
};
static inline int queryBondIsSingleOrDouble(Bond const *bond) {
return static_cast<int>(bond->getBondType() == Bond::SINGLE ||
bond->getBondType() == Bond::DOUBLE);
};
static inline int queryBondIsSingleOrDoubleOrAromatic(Bond const *bond) {
return static_cast<int>(bond->getBondType() == Bond::SINGLE ||
bond->getBondType() == Bond::DOUBLE ||
bond->getBondType() == Bond::AROMATIC);
};
static inline int queryBondDir(Bond const *bond) {
return static_cast<int>(bond->getBondDir());
};
static inline int queryIsBondInNRings(Bond const *at) {
return at->getOwningMol().getRingInfo()->numBondRings(at->getIdx());
};
static inline int queryBondHasStereo(Bond const *bnd) {
return bnd->getStereo() > Bond::STEREONONE;
};
// -------------------------------------------------
// ring queries
static inline int queryIsAtomInNRings(Atom const *at) {
return at->getOwningMol().getRingInfo()->numAtomRings(at->getIdx());
};
static inline int queryIsAtomInRing(Atom const *at) {
return at->getOwningMol().getRingInfo()->numAtomRings(at->getIdx()) != 0;
};
static inline int queryAtomHasRingBond(Atom const *at) {
ROMol::OBOND_ITER_PAIR atomBonds = at->getOwningMol().getAtomBonds(at);
while (atomBonds.first != atomBonds.second) {
unsigned int bondIdx =
at->getOwningMol().getTopology()[*atomBonds.first]->getIdx();
if (at->getOwningMol().getRingInfo()->numBondRings(bondIdx)) {
return 1;
}
++atomBonds.first;
}
return 0;
};
RDKIT_GRAPHMOL_EXPORT int queryIsAtomBridgehead(Atom const *at);
static inline int queryIsBondInRing(Bond const *bond) {
return bond->getOwningMol().getRingInfo()->numBondRings(bond->getIdx()) != 0;
};
static inline int queryAtomMinRingSize(Atom const *at) {
return at->getOwningMol().getRingInfo()->minAtomRingSize(at->getIdx());
};
static inline int queryBondMinRingSize(Bond const *bond) {
return bond->getOwningMol().getRingInfo()->minBondRingSize(bond->getIdx());
};
static inline int queryAtomRingBondCount(Atom const *at) {
// EFF: cache this result
int res = 0;
ROMol::OBOND_ITER_PAIR atomBonds = at->getOwningMol().getAtomBonds(at);
while (atomBonds.first != atomBonds.second) {
unsigned int bondIdx =
at->getOwningMol().getTopology()[*atomBonds.first]->getIdx();
if (at->getOwningMol().getRingInfo()->numBondRings(bondIdx)) {
res++;
}
++atomBonds.first;
}
return res;
}
template <int tgt>
int queryAtomIsInRingOfSize(Atom const *at) {
if (at->getOwningMol().getRingInfo()->isAtomInRingOfSize(at->getIdx(), tgt)) {
return tgt;
} else {
return 0;
}
};
template <int tgt>
int queryBondIsInRingOfSize(Bond const *bond) {
if (bond->getOwningMol().getRingInfo()->isBondInRingOfSize(bond->getIdx(),
tgt)) {
return tgt;
} else {
return 0;
}
};
template <class T>
T *makeAtomSimpleQuery(int what, int func(Atom const *),
const std::string &description = "Atom Simple") {
T *res = new T;
res->setVal(what);
res->setDataFunc(func);
res->setDescription(description);
return res;
}
static inline ATOM_RANGE_QUERY *makeAtomRangeQuery(
int lower, int upper, bool lowerOpen, bool upperOpen,
int func(Atom const *), const std::string &description = "Atom Range") {
ATOM_RANGE_QUERY *res = new ATOM_RANGE_QUERY(lower, upper);
res->setDataFunc(func);
res->setDescription(description);
res->setEndsOpen(lowerOpen, upperOpen);
return res;
}
//! returns a Query for matching atomic number
template <class T>
T *makeAtomNumQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomNum, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomNumQuery(int what);
//! returns a Query for matching atomic number and aromaticity
template <class T>
T *makeAtomTypeQuery(int num, int aromatic, const std::string &descr) {
return makeAtomSimpleQuery<T>(makeAtomType(num, aromatic), queryAtomType,
descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomTypeQuery(int num,
int aromatic);
//! returns a Query for matching implicit valence
template <class T>
T *makeAtomImplicitValenceQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomImplicitValence, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomImplicitValenceQuery(int what);
//! returns a Query for matching explicit valence
template <class T>
T *makeAtomExplicitValenceQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomExplicitValence, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomExplicitValenceQuery(int what);
//! returns a Query for matching total valence
template <class T>
T *makeAtomTotalValenceQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomTotalValence, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomTotalValenceQuery(int what);
//! returns a Query for matching explicit degree
template <class T>
T *makeAtomExplicitDegreeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomExplicitDegree, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomExplicitDegreeQuery(int what);
//! returns a Query for matching atomic degree
template <class T>
T *makeAtomTotalDegreeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomTotalDegree, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomTotalDegreeQuery(int what);
//! returns a Query for matching heavy atom degree
template <class T>
T *makeAtomHeavyAtomDegreeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomHeavyAtomDegree, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHeavyAtomDegreeQuery(int what);
//! returns a Query for matching hydrogen count
template <class T>
T *makeAtomHCountQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomHCount, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHCountQuery(int what);
//! returns a Query for matching ring atoms
template <class T>
T *makeAtomHasImplicitHQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryAtomHasImplicitH, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHasImplicitHQuery();
//! returns a Query for matching implicit hydrogen count
template <class T>
T *makeAtomImplicitHCountQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomImplicitHCount, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomImplicitHCountQuery(int what);
//! returns a Query for matching the \c isAromatic flag
template <class T>
T *makeAtomAromaticQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryAtomAromatic, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomAromaticQuery();
//! returns a Query for matching aliphatic atoms
template <class T>
T *makeAtomAliphaticQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryAtomAliphatic, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomAliphaticQuery();
//! returns a Query for matching atoms with a particular mass
template <class T>
T *makeAtomMassQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(massIntegerConversionFactor * what,
queryAtomMass, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomMassQuery(int what);
//! returns a Query for matching atoms with a particular isotope
template <class T>
T *makeAtomIsotopeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomIsotope, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomIsotopeQuery(int what);
//! returns a Query for matching formal charge
template <class T>
T *makeAtomFormalChargeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomFormalCharge, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomFormalChargeQuery(int what);
//! returns a Query for matching negative formal charges (i.e. a query val of 1
//! matches a formal charge of -1)
template <class T>
T *makeAtomNegativeFormalChargeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomNegativeFormalCharge, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomNegativeFormalChargeQuery(
int what);
//! returns a Query for matching hybridization
template <class T>
T *makeAtomHybridizationQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomHybridization, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHybridizationQuery(int what);
//! returns a Query for matching the number of radical electrons
template <class T>
T *makeAtomNumRadicalElectronsQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomNumRadicalElectrons, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomNumRadicalElectronsQuery(
int what);
//! returns a Query for matching whether or not chirality has been set on the
//! atom
template <class T>
T *makeAtomHasChiralTagQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryAtomHasChiralTag, descr);
}
//! \overloadquery
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHasChiralTagQuery();
//! returns a Query for matching whether or not a potentially chiral atom is
//! missing a chiral tag
template <class T>
T *makeAtomMissingChiralTagQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryAtomMissingChiralTag, descr);
}
//! \overloadquery
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomMissingChiralTagQuery();
//! returns a Query for matching atoms with unsaturation:
template <class T>
T *makeAtomUnsaturatedQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryAtomUnsaturated, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomUnsaturatedQuery();
//! returns a Query for matching ring atoms
template <class T>
T *makeAtomInRingQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryIsAtomInRing, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomInRingQuery();
//! returns a Query for matching atoms in a particular number of rings
template <class T>
T *makeAtomInNRingsQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryIsAtomInNRings, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomInNRingsQuery(int what);
//! returns a Query for matching atoms in rings of a particular size
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomInRingOfSizeQuery(int tgt);
//! returns a Query for matching an atom's minimum ring size
template <class T>
T *makeAtomMinRingSizeQuery(int tgt, const std::string &descr) {
return makeAtomSimpleQuery<T>(tgt, queryAtomMinRingSize, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomMinRingSizeQuery(int tgt);
//! returns a Query for matching atoms with a particular number of ring bonds
template <class T>
T *makeAtomRingBondCountQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomRingBondCount, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomRingBondCountQuery(int what);
//! returns a Query for matching generic A atoms (heavy atoms)
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAAtomQuery();
//! returns a Query for matching generic AH atoms (any atom)
RDKIT_GRAPHMOL_EXPORT ATOM_NULL_QUERY *makeAHAtomQuery();
//! returns a Query for matching generic Q atoms (heteroatoms)
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY *makeQAtomQuery();
//! returns a Query for matching generic QH atoms (heteroatom or H)
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeQHAtomQuery();
//! returns a Query for matching generic X atoms (halogens)
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY *makeXAtomQuery();
//! returns a Query for matching generic XH atoms (halogen or H)
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY *makeXHAtomQuery();
//! returns a Query for matching generic M atoms (metals)
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY *makeMAtomQuery();
//! returns a Query for matching generic MH atoms (metals or H)
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY *makeMHAtomQuery();
//! returns a Query for matching atoms that have ring bonds
template <class T>
T *makeAtomHasRingBondQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(1, queryAtomHasRingBond, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHasRingBondQuery();
//! returns a Query for matching the number of heteroatom neighbors
template <class T>
T *makeAtomNumHeteroatomNbrsQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomNumHeteroatomNbrs, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomNumHeteroatomNbrsQuery(
int what);
//! returns a Query for matching atoms that have heteroatom neighbors
template <class T>
T *makeAtomHasHeteroatomNbrsQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(1, queryAtomHasHeteroatomNbrs, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomHasHeteroatomNbrsQuery();
//! returns a Query for matching the number of aliphatic heteroatom neighbors
template <class T>
T *makeAtomNumAliphaticHeteroatomNbrsQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomNumAliphaticHeteroatomNbrs,
descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *
makeAtomNumAliphaticHeteroatomNbrsQuery(int what);
//! returns a Query for matching atoms that have heteroatom neighbors
template <class T>
T *makeAtomHasAliphaticHeteroatomNbrsQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(1, queryAtomHasAliphaticHeteroatomNbrs, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *
makeAtomHasAliphaticHeteroatomNbrsQuery();
//! returns a Query for matching the number of non-hydrogen neighbors
template <class T>
T *makeAtomNonHydrogenDegreeQuery(int what, const std::string &descr) {
return makeAtomSimpleQuery<T>(what, queryAtomNonHydrogenDegree, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomNonHydrogenDegreeQuery(
int what);
//! returns a Query for matching bridgehead atoms
template <class T>
T *makeAtomIsBridgeheadQuery(const std::string &descr) {
return makeAtomSimpleQuery<T>(true, queryIsAtomBridgehead, descr);
}
//! \overload
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY *makeAtomIsBridgeheadQuery();
//! returns a Query for matching bond orders
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondOrderEqualsQuery(
Bond::BondType what);
//! returns a Query for unspecified SMARTS bonds
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeSingleOrAromaticBondQuery();
//! returns a Query for double|aromatic bonds
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeDoubleOrAromaticBondQuery();
//! returns a Query for single|double bonds
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeSingleOrDoubleBondQuery();
//! returns a Query for tautomeric bonds
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *
makeSingleOrDoubleOrAromaticBondQuery();
//! returns a Query for matching bond directions
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondDirEqualsQuery(
Bond::BondDir what);
//! returns a Query for matching bonds with stereo set
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondHasStereoQuery();
//! returns a Query for matching ring bonds
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondIsInRingQuery();
//! returns a Query for matching bonds in rings of a particular size
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondInRingOfSizeQuery(int what);
//! returns a Query for matching a bond's minimum ring size
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondMinRingSizeQuery(int what);
//! returns a Query for matching bonds in a particular number of rings
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY *makeBondInNRingsQuery(int tgt);
//! returns a Query for matching any bond
RDKIT_GRAPHMOL_EXPORT BOND_NULL_QUERY *makeBondNullQuery();
//! returns a Query for matching any atom
RDKIT_GRAPHMOL_EXPORT ATOM_NULL_QUERY *makeAtomNullQuery();
static inline int queryAtomRingMembership(Atom const *at) {
return static_cast<int>(
at->getOwningMol().getRingInfo()->numAtomRings(at->getIdx()));
}
// I'm pretty sure that this typedef shouldn't be necessary,
// but VC++ generates a warning about const Atom const * in
// the definition of Match, then complains about an override
// that differs only by const/volatile (c4301), then generates
// incorrect code if we don't do this... so let's do it.
typedef Atom const *ConstAtomPtr;
class RDKIT_GRAPHMOL_EXPORT AtomRingQuery
: public Queries::EqualityQuery<int, ConstAtomPtr, true> {
public:
AtomRingQuery() : Queries::EqualityQuery<int, ConstAtomPtr, true>(-1) {
// default is to just do a number of rings query:
this->setDescription("AtomInNRings");
this->setDataFunc(queryAtomRingMembership);
}
explicit AtomRingQuery(int v)
: Queries::EqualityQuery<int, ConstAtomPtr, true>(v) {
// default is to just do a number of rings query:
this->setDescription("AtomInNRings");
this->setDataFunc(queryAtomRingMembership);
}
bool Match(const ConstAtomPtr what) const override {
int v = this->TypeConvert(what, Queries::Int2Type<true>());
bool res;
if (this->d_val < 0) {
res = v != 0;
} else {
res = !Queries::queryCmp(v, this->d_val, this->d_tol);
}
if (this->getNegation()) {
res = !res;
}
return res;
}
//! returns a copy of this query
Queries::Query<int, ConstAtomPtr, true> *copy() const override {
AtomRingQuery *res = new AtomRingQuery(this->d_val);
res->setNegation(getNegation());
res->setTol(this->getTol());
res->d_description = this->d_description;
res->d_dataFunc = this->d_dataFunc;
return res;
}
};
//! allows use of recursive structure queries (e.g. recursive SMARTS)
class RDKIT_GRAPHMOL_EXPORT RecursiveStructureQuery
: public Queries::SetQuery<int, Atom const *, true> {
public:
RecursiveStructureQuery() : Queries::SetQuery<int, Atom const *, true>() {
setDataFunc(getAtIdx);
setDescription("RecursiveStructure");
}
//! initialize from an ROMol pointer
/*!
<b>Notes</b>
- this takes over ownership of the pointer
*/
RecursiveStructureQuery(ROMol const *query, unsigned int serialNumber = 0)
: Queries::SetQuery<int, Atom const *, true>(),
d_serialNumber(serialNumber) {
setQueryMol(query);
setDataFunc(getAtIdx);
setDescription("RecursiveStructure");
}
//! returns the index of an atom
static inline int getAtIdx(Atom const *at) {
PRECONDITION(at, "bad atom argument");
return at->getIdx();
}
//! sets the molecule we'll use recursively
/*!
<b>Notes</b>
- this takes over ownership of the pointer
*/
void setQueryMol(ROMol const *query) { dp_queryMol.reset(query); }
//! returns a pointer to our query molecule
ROMol const *getQueryMol() const { return dp_queryMol.get(); }
//! returns a copy of this query
Queries::Query<int, Atom const *, true> *copy() const override {
RecursiveStructureQuery *res = new RecursiveStructureQuery();
res->dp_queryMol.reset(new ROMol(*dp_queryMol, true));
std::set<int>::const_iterator i;
for (i = d_set.begin(); i != d_set.end(); i++) {
res->insert(*i);
}
res->setNegation(getNegation());
res->d_description = d_description;
res->d_serialNumber = d_serialNumber;
return res;
}
unsigned int getSerialNumber() const { return d_serialNumber; }
#ifdef RDK_THREADSAFE_SSS
std::mutex d_mutex;
#endif
private:
boost::shared_ptr<const ROMol> dp_queryMol;
unsigned int d_serialNumber{0};
};
template <typename T>
int nullDataFun(T) {
return 1;
}
template <typename T>
bool nullQueryFun(T) {
return true;
}
typedef Bond const *ConstBondPtr;
// ! Query whether an atom has a property
template <class TargetPtr>
class HasPropQuery : public Queries::EqualityQuery<int, TargetPtr, true> {
std::string propname;
public:
HasPropQuery() : Queries::EqualityQuery<int, TargetPtr, true>(), propname() {
// default is to just do a number of rings query:
this->setDescription("AtomHasProp");
this->setDataFunc(0);
}
explicit HasPropQuery(std::string v)
: Queries::EqualityQuery<int, TargetPtr, true>(), propname(std::move(v)) {
// default is to just do a number of rings query:
this->setDescription("AtomHasProp");
this->setDataFunc(nullptr);
}
bool Match(const TargetPtr what) const override {
bool res = what->hasProp(propname);
if (this->getNegation()) {
res = !res;
}
return res;
}
//! returns a copy of this query
Queries::Query<int, TargetPtr, true> *copy() const override {
HasPropQuery *res = new HasPropQuery(this->propname);
res->setNegation(this->getNegation());
res->d_description = this->d_description;
return res;
}
};
typedef Queries::EqualityQuery<int, Atom const *, true> ATOM_PROP_QUERY;
typedef Queries::EqualityQuery<int, Bond const *, true> BOND_PROP_QUERY;
//! returns a Query for matching atoms that have a particular property
template <class Target>
Queries::EqualityQuery<int, const Target *, true> *makeHasPropQuery(
const std::string &property) {
return new HasPropQuery<const Target *>(property);
}
// ! Query whether an atom has a property with a value
template <class TargetPtr, class T>
class HasPropWithValueQuery
: public Queries::EqualityQuery<int, TargetPtr, true> {
std::string propname;
T val;
T tolerance;
public:
HasPropWithValueQuery()
: Queries::EqualityQuery<int, TargetPtr, true>(), propname(), val() {
// default is to just do a number of rings query:
this->setDescription("HasPropWithValue");
this->setDataFunc(0);
}
explicit HasPropWithValueQuery(std::string prop, const T &v,
const T &tol = 0.0)
: Queries::EqualityQuery<int, TargetPtr, true>(),
propname(std::move(prop)),
val(v),
tolerance(tol) {
// default is to just do a number of rings query:
this->setDescription("HasPropWithValue");
this->setDataFunc(nullptr);
}
bool Match(const TargetPtr what) const override {
bool res = what->hasProp(propname);
if (res) {
try {
T atom_val = what->template getProp<T>(propname);
res = Queries::queryCmp(atom_val, this->val, this->tolerance) == 0;
} catch (KeyErrorException &) {
res = false;
} catch (boost::bad_any_cast &) {
res = false;
}
#ifdef __GNUC__
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
catch (...) {
// catch all -- this is currently necessary to
// trap some bugs in boost+gcc configurations
// Normally, this is not the correct thing to
// do, but the only exception above is due
// to the boost any_cast which is trapped
// by the Boost python wrapper when it shouldn't
// be.
res = false;
}
#endif
#endif
}
if (this->getNegation()) {
res = !res;
}
return res;
}
//! returns a copy of this query
Queries::Query<int, TargetPtr, true> *copy() const override {
HasPropWithValueQuery *res =
new HasPropWithValueQuery(this->propname, this->val, this->tolerance);
res->setNegation(this->getNegation());
res->d_description = this->d_description;
return res;
}
};
template <class TargetPtr>
class HasPropWithValueQuery<TargetPtr, std::string>
: public Queries::EqualityQuery<int, TargetPtr, true> {
std::string propname;
std::string val;
public:
HasPropWithValueQuery()
: Queries::EqualityQuery<int, TargetPtr, true>(), propname(), val() {
// default is to just do a number of rings query:
this->setDescription("HasPropWithValue");
this->setDataFunc(0);
}
explicit HasPropWithValueQuery(std::string prop, std::string v,
const std::string &tol = "")
: Queries::EqualityQuery<int, TargetPtr, true>(),
propname(std::move(prop)),
val(std::move(v)) {
RDUNUSED_PARAM(tol);
// default is to just do a number of rings query:
this->setDescription("HasPropWithValue");
this->setDataFunc(nullptr);
}
bool Match(const TargetPtr what) const override {
bool res = what->hasProp(propname);
if (res) {
try {
std::string atom_val = what->template getProp<std::string>(propname);
res = atom_val == this->val;
} catch (KeyErrorException &) {
res = false;
} catch (boost::bad_any_cast &) {
res = false;
}
#ifdef __GNUC__
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
catch (...) {
// catch all -- this is currently necessary to
// trap some bugs in boost+gcc configurations
// Normally, this is not the correct thing to
// do, but the only exception above is due
// to the boost any_cast which is trapped
// by the Boost python wrapper when it shouldn't
// be.
res = false;
}
#endif
#endif
}
if (this->getNegation()) {
res = !res;
}
return res;
}
//! returns a copy of this query
Queries::Query<int, TargetPtr, true> *copy() const override {
HasPropWithValueQuery<TargetPtr, std::string> *res =
new HasPropWithValueQuery<TargetPtr, std::string>(this->propname,
this->val);
res->setNegation(this->getNegation());
res->d_description = this->d_description;
return res;
}
};
template <class TargetPtr>
class HasPropWithValueQuery<TargetPtr, ExplicitBitVect>
: public Queries::EqualityQuery<int, TargetPtr, true> {
std::string propname;
ExplicitBitVect val;
float tol{0.0};
public:
HasPropWithValueQuery()
: Queries::EqualityQuery<int, TargetPtr, true>(), propname(), val() {
this->setDescription("HasPropWithValue");
this->setDataFunc(0);
}
explicit HasPropWithValueQuery(std::string prop, const ExplicitBitVect &v,
float tol = 0.0)
: Queries::EqualityQuery<int, TargetPtr, true>(),
propname(std::move(prop)),
val(v),
tol(tol) {
this->setDescription("HasPropWithValue");
this->setDataFunc(nullptr);
}
bool Match(const TargetPtr what) const override {
bool res = what->hasProp(propname);
if (res) {
try {
const ExplicitBitVect &bv =
what->template getProp<const ExplicitBitVect &>(propname);
const double tani = TanimotoSimilarity(val, bv);
res = (1.0 - tani) <= tol;
} catch (KeyErrorException &) {
res = false;
} catch (boost::bad_any_cast &) {
res = false;
}
#ifdef __GNUC__
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
catch (...) {
// catch all -- this is currently necessary to
// trap some bugs in boost+gcc configurations
// Normally, this is not the correct thing to
// do, but the only exception above is due
// to the boost any_cast which is trapped
// by the Boost python wrapper when it shouldn't
// be.
res = false;
}
#endif
#endif
}
if (this->getNegation()) {
res = !res;
}
return res;
}
//! returns a copy of this query
Queries::Query<int, TargetPtr, true> *copy() const override {
HasPropWithValueQuery<TargetPtr, ExplicitBitVect> *res =
new HasPropWithValueQuery<TargetPtr, ExplicitBitVect>(
this->propname, this->val, this->tol);
res->setNegation(this->getNegation());
res->d_description = this->d_description;
return res;
}
};
template <class Target, class T>
Queries::EqualityQuery<int, const Target *, true> *makePropQuery(
const std::string &propname, const T &val, const T &tolerance = T()) {
return new HasPropWithValueQuery<const Target *, T>(propname, val, tolerance);
}
template <class Target>
Queries::EqualityQuery<int, const Target *, true> *makePropQuery(
const std::string &propname, const ExplicitBitVect &val,
float tolerance = 0.0) {
return new HasPropWithValueQuery<const Target *, ExplicitBitVect>(
propname, val, tolerance);
}
RDKIT_GRAPHMOL_EXPORT bool isComplexQuery(const Bond *b);
RDKIT_GRAPHMOL_EXPORT bool isComplexQuery(const Atom *a);
RDKIT_GRAPHMOL_EXPORT bool isAtomAromatic(const Atom *a);
RDKIT_GRAPHMOL_EXPORT bool isAtomListQuery(const Atom *a);
RDKIT_GRAPHMOL_EXPORT void getAtomListQueryVals(const Atom::QUERYATOM_QUERY *q,
std::vector<int> &vals);
namespace QueryOps {
RDKIT_GRAPHMOL_EXPORT void completeMolQueries(
RWMol *mol, unsigned int magicVal = 0xDEADBEEF);
RDKIT_GRAPHMOL_EXPORT Atom *replaceAtomWithQueryAtom(RWMol *mol, Atom *atom);
RDKIT_GRAPHMOL_EXPORT void finalizeQueryFromDescription(
Queries::Query<int, Atom const *, true> *query, Atom const *owner);
RDKIT_GRAPHMOL_EXPORT void finalizeQueryFromDescription(
Queries::Query<int, Bond const *, true> *query, Bond const *owner);
RDKIT_GRAPHMOL_EXPORT bool hasBondTypeQuery(
const Queries::Query<int, Bond const *, true> &qry);
inline bool hasBondTypeQuery(const Bond &bond) {
if (!bond.hasQuery()) {
return false;
}
return hasBondTypeQuery(*bond.getQuery());
}
RDKIT_GRAPHMOL_EXPORT bool hasComplexBondTypeQuery(
const Queries::Query<int, Bond const *, true> &qry);
inline bool hasComplexBondTypeQuery(const Bond &bond) {
if (!bond.hasQuery()) {
return false;
}
return hasComplexBondTypeQuery(*bond.getQuery());
}
} // namespace QueryOps
} // namespace RDKit
#endif
BitOps.h
Contains general bit-comparison and similarity operations.
BitVects.h
Pulls in all the BitVect classes.
RDUNUSED_PARAM
#define RDUNUSED_PARAM(x)
Definition: Invariant.h:196
PRECONDITION
#define PRECONDITION(expr, mess)
Definition: Invariant.h:109
QueryObjects.h
Pulls in all the query types.
Query.h
RDKitBase.h
pulls in the core RDKit functionality
ExplicitBitVect
a class for bit vectors that are densely occupied
Definition: ExplicitBitVect.h:29
KeyErrorException
Class to allow us to throw a KeyError from C++ and have it make it back to Python.
Definition: Exceptions.h:56
Queries::AndQuery
a Query implementing AND: requires all children to be true
Definition: AndQuery.h:22
Queries::EqualityQuery
a Query implementing ==: arguments must match a particular value (within an optional tolerance)
Definition: EqualityQuery.h:24
Queries::EqualityQuery::setTol
void setTol(MatchFuncArgType what)
sets our tolerance
Definition: EqualityQuery.h:47
Queries::EqualityQuery< int, TargetPtr, true >::EqualityQuery
EqualityQuery()
Definition: EqualityQuery.h:26
Queries::GreaterEqualQuery
a Query implementing >= using a particular value (and an optional tolerance)
Definition: GreaterEqualQuery.h:22
Queries::GreaterQuery
a Query implementing > using a particular value (and an optional tolerance)
Definition: GreaterQuery.h:22
Queries::Int2Type
class to allow integer values to pick templates
Definition: Query.h:26
Queries::LessEqualQuery
a Query implementing <= using a particular value (and an optional tolerance)
Definition: LessEqualQuery.h:22
Queries::LessQuery
a Query implementing < using a particular value (and an optional tolerance)
Definition: LessQuery.h:22
Queries::OrQuery
a Query implementing AND: requires any child to be true
Definition: OrQuery.h:21
Queries::Query
Base class for all queries.
Definition: Query.h:45
Queries::Query::d_dataFunc
MatchFuncArgType(* d_dataFunc)(DataFuncArgType)
Definition: Query.h:161
Queries::Query::setDataFunc
void setDataFunc(MatchFuncArgType(*what)(DataFuncArgType))
sets our data function
Definition: Query.h:93
Queries::Query::getNegation
bool getNegation() const
returns whether or not we are negated
Definition: Query.h:61
Queries::Query::setNegation
void setNegation(bool what)
sets whether or not we are negated
Definition: Query.h:59
Queries::Query::setDescription
void setDescription(const std::string &descr)
sets our text description
Definition: Query.h:64
Queries::Query::d_description
std::string d_description
Definition: Query.h:149
Queries::RangeQuery
a Query implementing a range: arguments must fall in a particular range of values.
Definition: RangeQuery.h:28
Queries::RangeQuery::setEndsOpen
void setEndsOpen(bool lower, bool upper)
sets whether or not the ends of the range are open
Definition: RangeQuery.h:47
Queries::SetQuery< int, Atom const *, true >
Queries::SetQuery::insert
void insert(const MatchFuncArgType what)
insert an entry into our set
Definition: SetQuery.h:33
Queries::XOrQuery
a Query implementing XOR: requires exactly one child to be true
Definition: XOrQuery.h:22
RDKit::AtomRingQuery
Definition: QueryOps.h:703
RDKit::AtomRingQuery::copy
Queries::Query< int, ConstAtomPtr, true > * copy() const override
returns a copy of this query
Definition: QueryOps.h:732
RDKit::AtomRingQuery::Match
bool Match(const ConstAtomPtr what) const override
Definition: QueryOps.h:717
RDKit::AtomRingQuery::AtomRingQuery
AtomRingQuery(int v)
Definition: QueryOps.h:710
RDKit::AtomRingQuery::AtomRingQuery
AtomRingQuery()
Definition: QueryOps.h:705
RDKit::Atom
The class for representing atoms.
Definition: Atom.h:68
RDKit::Atom::getChiralTag
ChiralType getChiralTag() const
returns our chiralTag
Definition: Atom.h:236
RDKit::Atom::getOwningMol
ROMol & getOwningMol() const
returns a reference to the ROMol that owns this instance
Definition: Atom.h:126
RDKit::Atom::getIdx
unsigned int getIdx() const
returns our index within the ROMol
Definition: Atom.h:132
RDKit::Atom::getNumExplicitHs
unsigned int getNumExplicitHs() const
returns our number of explicit Hs
Definition: Atom.h:216
RDKit::Atom::getNumRadicalElectrons
unsigned int getNumRadicalElectrons() const
returns the number of radical electrons for this Atom
Definition: Atom.h:199
RDKit::Atom::getExplicitValence
int getExplicitValence() const
returns the explicit valence (including Hs) of this atom
RDKit::Atom::getImplicitValence
int getImplicitValence() const
returns the implicit valence for this Atom
RDKit::Atom::getTotalNumHs
unsigned int getTotalNumHs(bool includeNeighbors=false) const
returns the total number of Hs (implicit and explicit) that this Atom is bound to
RDKit::Atom::getAtomicNum
int getAtomicNum() const
returns our atomic number
Definition: Atom.h:115
RDKit::Atom::CHI_UNSPECIFIED
@ CHI_UNSPECIFIED
chirality that hasn't been specified
Definition: Atom.h:91
RDKit::Atom::getHybridization
HybridizationType getHybridization() const
returns our hybridization
Definition: Atom.h:243
RDKit::Atom::getIsAromatic
bool getIsAromatic() const
returns our isAromatic flag
Definition: Atom.h:221
RDKit::Atom::getTotalValence
unsigned int getTotalValence() const
returns the total valence (implicit and explicit) for an atom
RDKit::Atom::getFormalCharge
int getFormalCharge() const
returns the formal charge of this atom
Definition: Atom.h:203
RDKit::Atom::getMass
double getMass() const
returns our mass
RDKit::Atom::getIsotope
unsigned int getIsotope() const
returns our isotope number
Definition: Atom.h:229
RDKit::Atom::getTotalDegree
unsigned int getTotalDegree() const
RDKit::Atom::getDegree
unsigned int getDegree() const
RDKit::Bond
class for representing a bond
Definition: Bond.h:46
RDKit::Bond::BondType
BondType
the type of Bond
Definition: Bond.h:55
RDKit::Bond::AROMATIC
@ AROMATIC
Definition: Bond.h:68
RDKit::Bond::DOUBLE
@ DOUBLE
Definition: Bond.h:58
RDKit::Bond::SINGLE
@ SINGLE
Definition: Bond.h:57
RDKit::Bond::getOwningMol
ROMol & getOwningMol() const
returns a reference to the ROMol that owns this instance
Definition: Bond.h:148
RDKit::Bond::getIdx
unsigned int getIdx() const
returns our index within the ROMol
Definition: Bond.h:163
RDKit::Bond::hasQuery
virtual bool hasQuery() const
Definition: Bond.h:244
RDKit::Bond::getBondType
BondType getBondType() const
returns our bondType
Definition: Bond.h:120
RDKit::Bond::BondDir
BondDir
the bond's direction (for chirality)
Definition: Bond.h:82
RDKit::Bond::getStereo
BondStereo getStereo() const
returns our stereo code
Definition: Bond.h:291
RDKit::Bond::getQuery
virtual QUERYBOND_QUERY * getQuery() const
NOT CALLABLE.
RDKit::Bond::STEREONONE
@ STEREONONE
Definition: Bond.h:95
RDKit::Bond::getBondDir
BondDir getBondDir() const
returns our direction
Definition: Bond.h:270
RDKit::HasPropQuery
Definition: QueryOps.h:814
RDKit::HasPropQuery::HasPropQuery
HasPropQuery()
Definition: QueryOps.h:818
RDKit::HasPropQuery::HasPropQuery
HasPropQuery(std::string v)
Definition: QueryOps.h:823
RDKit::HasPropQuery::Match
bool Match(const TargetPtr what) const override
Definition: QueryOps.h:830
RDKit::HasPropQuery::copy
Queries::Query< int, TargetPtr, true > * copy() const override
returns a copy of this query
Definition: QueryOps.h:839
RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >
Definition: QueryOps.h:994
RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::copy
Queries::Query< int, TargetPtr, true > * copy() const override
returns a copy of this query
Definition: QueryOps.h:1051
RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::Match
bool Match(const TargetPtr what) const override
Definition: QueryOps.h:1016
RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::HasPropWithValueQuery
HasPropWithValueQuery()
Definition: QueryOps.h:1000
RDKit::HasPropWithValueQuery< TargetPtr, ExplicitBitVect >::HasPropWithValueQuery
HasPropWithValueQuery(std::string prop, const ExplicitBitVect &v, float tol=0.0)
Definition: QueryOps.h:1006
RDKit::HasPropWithValueQuery< TargetPtr, std::string >
Definition: QueryOps.h:927
RDKit::HasPropWithValueQuery< TargetPtr, std::string >::copy
Queries::Query< int, TargetPtr, true > * copy() const override
returns a copy of this query
Definition: QueryOps.h:982
RDKit::HasPropWithValueQuery< TargetPtr, std::string >::HasPropWithValueQuery
HasPropWithValueQuery(std::string prop, std::string v, const std::string &tol="")
Definition: QueryOps.h:938
RDKit::HasPropWithValueQuery< TargetPtr, std::string >::HasPropWithValueQuery
HasPropWithValueQuery()
Definition: QueryOps.h:932
RDKit::HasPropWithValueQuery< TargetPtr, std::string >::Match
bool Match(const TargetPtr what) const override
Definition: QueryOps.h:949
RDKit::HasPropWithValueQuery
Definition: QueryOps.h:860
RDKit::HasPropWithValueQuery::HasPropWithValueQuery
HasPropWithValueQuery(std::string prop, const T &v, const T &tol=0.0)
Definition: QueryOps.h:872
RDKit::HasPropWithValueQuery::Match
bool Match(const TargetPtr what) const override
Definition: QueryOps.h:883
RDKit::HasPropWithValueQuery::copy
Queries::Query< int, TargetPtr, true > * copy() const override
returns a copy of this query
Definition: QueryOps.h:916
RDKit::HasPropWithValueQuery::HasPropWithValueQuery
HasPropWithValueQuery()
Definition: QueryOps.h:866
RDKit::RDProps::hasProp
bool hasProp(const std::string &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: RDProps.h:121
RDKit::ROMol
Definition: ROMol.h:178
RDKit::ROMol::getAtomNeighbors
ADJ_ITER_PAIR getAtomNeighbors(Atom const *at) const
provides access to all neighbors around an Atom
RDKit::ROMol::getAtomBonds
OBOND_ITER_PAIR getAtomBonds(Atom const *at) const
provides access to all Bond objects connected to an Atom
RDKit::ROMol::getRingInfo
RingInfo * getRingInfo() const
Definition: ROMol.h:488
RDKit::ROMol::getTopology
MolGraph const & getTopology() const
brief returns a pointer to our underlying BGL object
Definition: ROMol.h:591
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:32
RDKit::RecursiveStructureQuery
allows use of recursive structure queries (e.g. recursive SMARTS)
Definition: QueryOps.h:744
RDKit::RecursiveStructureQuery::getQueryMol
ROMol const * getQueryMol() const
returns a pointer to our query molecule
Definition: QueryOps.h:775
RDKit::RecursiveStructureQuery::RecursiveStructureQuery
RecursiveStructureQuery(ROMol const *query, unsigned int serialNumber=0)
initialize from an ROMol pointer
Definition: QueryOps.h:755
RDKit::RecursiveStructureQuery::RecursiveStructureQuery
RecursiveStructureQuery()
Definition: QueryOps.h:746
RDKit::RecursiveStructureQuery::getSerialNumber
unsigned int getSerialNumber() const
Definition: QueryOps.h:791
RDKit::RecursiveStructureQuery::copy
Queries::Query< int, Atom const *, true > * copy() const override
returns a copy of this query
Definition: QueryOps.h:778
RDKit::RecursiveStructureQuery::getAtIdx
static int getAtIdx(Atom const *at)
returns the index of an atom
Definition: QueryOps.h:763
RDKit::RecursiveStructureQuery::setQueryMol
void setQueryMol(ROMol const *query)
sets the molecule we'll use recursively
Definition: QueryOps.h:773
RDKit::RingInfo::numBondRings
unsigned int numBondRings(unsigned int idx) const
returns the number of rings bond idx is involved in
RDKit::RingInfo::minBondRingSize
unsigned int minBondRingSize(unsigned int idx) const
returns the size of the smallest ring bond idx is involved in
RDKit::RingInfo::isAtomInRingOfSize
bool isAtomInRingOfSize(unsigned int idx, unsigned int size) const
returns whether or not the atom with index idx is in a size - ring.
RDKit::RingInfo::numAtomRings
unsigned int numAtomRings(unsigned int idx) const
returns the number of rings atom idx is involved in
RDKit::RingInfo::isBondInRingOfSize
bool isBondInRingOfSize(unsigned int idx, unsigned int size) const
returns whether or not the bond with index idx is in a size - ring.
RDKit::RingInfo::minAtomRingSize
unsigned int minAtomRingSize(unsigned int idx) const
returns the size of the smallest ring atom idx is involved in
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition: export.h:209
Queries
Definition: AndQuery.h:16
Queries::queryCmp
int queryCmp(const T1 v1, const T2 v2, const T1 tol)
Definition: Query.h:194
RDKit::QueryOps::completeMolQueries
RDKIT_GRAPHMOL_EXPORT void completeMolQueries(RWMol *mol, unsigned int magicVal=0xDEADBEEF)
RDKit::QueryOps::replaceAtomWithQueryAtom
RDKIT_GRAPHMOL_EXPORT Atom * replaceAtomWithQueryAtom(RWMol *mol, Atom *atom)
RDKit::QueryOps::hasComplexBondTypeQuery
RDKIT_GRAPHMOL_EXPORT bool hasComplexBondTypeQuery(const Queries::Query< int, Bond const *, true > &qry)
RDKit::QueryOps::finalizeQueryFromDescription
RDKIT_GRAPHMOL_EXPORT void finalizeQueryFromDescription(Queries::Query< int, Atom const *, true > *query, Atom const *owner)
RDKit::QueryOps::hasBondTypeQuery
RDKIT_GRAPHMOL_EXPORT bool hasBondTypeQuery(const Queries::Query< int, Bond const *, true > &qry)
RDKit::common_properties::_ChiralityPossible
RDKIT_RDGENERAL_EXPORT const std::string _ChiralityPossible
RDKit
Std stuff.
Definition: Abbreviations.h:18
RDKit::BOND_LESS_QUERY
Queries::LessQuery< int, Bond const *, true > BOND_LESS_QUERY
Definition: QueryOps.h:55
RDKit::makeAtomUnsaturatedQuery
T * makeAtomUnsaturatedQuery(const std::string &descr)
returns a Query for matching atoms with unsaturation:
Definition: QueryOps.h:540
RDKit::queryAtomNumRadicalElectrons
static int queryAtomNumRadicalElectrons(Atom const *at)
Definition: QueryOps.h:173
RDKit::ATOM_LESS_QUERY
Queries::LessQuery< int, Atom const *, true > ATOM_LESS_QUERY
Definition: QueryOps.h:54
RDKit::queryAtomHybridization
static int queryAtomHybridization(Atom const *at)
Definition: QueryOps.h:170
RDKit::queryAtomMinRingSize
static int queryAtomMinRingSize(Atom const *at)
Definition: QueryOps.h:302
RDKit::BOND_LESSEQUAL_QUERY
Queries::LessEqualQuery< int, Bond const *, true > BOND_LESSEQUAL_QUERY
Definition: QueryOps.h:58
RDKit::queryAtomExplicitDegree
static int queryAtomExplicitDegree(Atom const *at)
Definition: QueryOps.h:78
RDKit::queryAtomHasRingBond
static int queryAtomHasRingBond(Atom const *at)
Definition: QueryOps.h:285
RDKit::ConstBondPtr
Bond const * ConstBondPtr
Definition: QueryOps.h:810
RDKit::makeAtomImplicitValenceQuery
T * makeAtomImplicitValenceQuery(int what, const std::string &descr)
returns a Query for matching implicit valence
Definition: QueryOps.h:382
RDKit::makeAtomExplicitValenceQuery
T * makeAtomExplicitValenceQuery(int what, const std::string &descr)
returns a Query for matching explicit valence
Definition: QueryOps.h:390
RDKit::makeAtomMassQuery
T * makeAtomMassQuery(int what, const std::string &descr)
returns a Query for matching atoms with a particular mass
Definition: QueryOps.h:470
RDKit::queryBondHasStereo
static int queryBondHasStereo(Bond const *bnd)
Definition: QueryOps.h:272
RDKit::makeAtomHybridizationQuery
T * makeAtomHybridizationQuery(int what, const std::string &descr)
returns a Query for matching hybridization
Definition: QueryOps.h:505
RDKit::queryAtomUnsaturated
static int queryAtomUnsaturated(Atom const *at)
Definition: QueryOps.h:128
RDKit::makeQAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY * makeQAtomQuery()
returns a Query for matching generic Q atoms (heteroatoms)
RDKit::makeAHAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_NULL_QUERY * makeAHAtomQuery()
returns a Query for matching generic AH atoms (any atom)
RDKit::queryAtomAromatic
static int queryAtomAromatic(Atom const *at)
Definition: QueryOps.h:72
RDKit::ATOM_RANGE_QUERY
Queries::RangeQuery< int, Atom const *, true > ATOM_RANGE_QUERY
Definition: QueryOps.h:60
RDKit::makeBondIsInRingQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondIsInRingQuery()
returns a Query for matching ring bonds
RDKit::makeAtomHasHeteroatomNbrsQuery
T * makeAtomHasHeteroatomNbrsQuery(const std::string &descr)
returns a Query for matching atoms that have heteroatom neighbors
Definition: QueryOps.h:617
RDKit::BOND_BOOL_QUERY
Queries::Query< bool, Bond const *, true > BOND_BOOL_QUERY
Definition: QueryOps.h:32
RDKit::queryAtomType
static int queryAtomType(Atom const *at)
Definition: QueryOps.h:153
RDKit::makeSingleOrDoubleOrAromaticBondQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeSingleOrDoubleOrAromaticBondQuery()
returns a Query for tautomeric bonds
RDKit::ATOM_AND_QUERY
Queries::AndQuery< int, Atom const *, true > ATOM_AND_QUERY
Definition: QueryOps.h:34
RDKit::makeAtomAliphaticQuery
T * makeAtomAliphaticQuery(const std::string &descr)
returns a Query for matching aliphatic atoms
Definition: QueryOps.h:462
RDKit::queryAtomBondProduct
RDKIT_GRAPHMOL_EXPORT unsigned int queryAtomBondProduct(Atom const *at)
RDKit::queryBondIsDoubleOrAromatic
static int queryBondIsDoubleOrAromatic(Bond const *bond)
Definition: QueryOps.h:253
RDKit::makeMHAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY * makeMHAtomQuery()
returns a Query for matching generic MH atoms (metals or H)
RDKit::queryAtomHasImplicitH
static int queryAtomHasImplicitH(Atom const *at)
Definition: QueryOps.h:116
RDKit::makeBondDirEqualsQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondDirEqualsQuery(Bond::BondDir what)
returns a Query for matching bond directions
RDKit::ATOM_LESSEQUAL_QUERY
Queries::LessEqualQuery< int, Atom const *, true > ATOM_LESSEQUAL_QUERY
Definition: QueryOps.h:57
RDKit::makeAtomTypeQuery
T * makeAtomTypeQuery(int num, int aromatic, const std::string &descr)
returns a Query for matching atomic number and aromaticity
Definition: QueryOps.h:372
RDKit::makeAtomMinRingSizeQuery
T * makeAtomMinRingSizeQuery(int tgt, const std::string &descr)
returns a Query for matching an atom's minimum ring size
Definition: QueryOps.h:567
RDKit::makeAtomNumHeteroatomNbrsQuery
T * makeAtomNumHeteroatomNbrsQuery(int what, const std::string &descr)
returns a Query for matching the number of heteroatom neighbors
Definition: QueryOps.h:608
RDKit::queryAtomAllBondProduct
RDKIT_GRAPHMOL_EXPORT unsigned int queryAtomAllBondProduct(Atom const *at)
RDKit::TanimotoSimilarity
double TanimotoSimilarity(const SparseIntVect< IndexType > &v1, const SparseIntVect< IndexType > &v2, bool returnDistance=false, double bounds=0.0)
Definition: SparseIntVect.h:559
RDKit::nullQueryFun
bool nullQueryFun(T)
Definition: QueryOps.h:806
RDKit::queryAtomNegativeFormalCharge
static int queryAtomNegativeFormalCharge(Atom const *at)
Definition: QueryOps.h:167
RDKit::ATOM_SET_QUERY
Queries::SetQuery< int, Atom const *, true > ATOM_SET_QUERY
Definition: QueryOps.h:63
RDKit::queryAtomHasHeteroatomNbrs
static int queryAtomHasHeteroatomNbrs(Atom const *at)
Definition: QueryOps.h:184
RDKit::makeBondInRingOfSizeQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondInRingOfSizeQuery(int what)
returns a Query for matching bonds in rings of a particular size
RDKit::makeAtomFormalChargeQuery
T * makeAtomFormalChargeQuery(int what, const std::string &descr)
returns a Query for matching formal charge
Definition: QueryOps.h:487
RDKit::makeAtomNullQuery
RDKIT_GRAPHMOL_EXPORT ATOM_NULL_QUERY * makeAtomNullQuery()
returns a Query for matching any atom
RDKit::makeAtomNumAliphaticHeteroatomNbrsQuery
T * makeAtomNumAliphaticHeteroatomNbrsQuery(int what, const std::string &descr)
returns a Query for matching the number of aliphatic heteroatom neighbors
Definition: QueryOps.h:625
RDKit::makeAtomHasChiralTagQuery
T * makeAtomHasChiralTagQuery(const std::string &descr)
Definition: QueryOps.h:523
RDKit::isAtomAromatic
RDKIT_GRAPHMOL_EXPORT bool isAtomAromatic(const Atom *a)
RDKit::ATOM_XOR_QUERY
Queries::XOrQuery< int, Atom const *, true > ATOM_XOR_QUERY
Definition: QueryOps.h:40
RDKit::makeMAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY * makeMAtomQuery()
returns a Query for matching generic M atoms (metals)
RDKit::BOND_SET_QUERY
Queries::SetQuery< int, Bond const *, true > BOND_SET_QUERY
Definition: QueryOps.h:64
RDKit::queryBondIsSingleOrAromatic
static int queryBondIsSingleOrAromatic(Bond const *bond)
Definition: QueryOps.h:249
RDKit::makeAtomHasAliphaticHeteroatomNbrsQuery
T * makeAtomHasAliphaticHeteroatomNbrsQuery(const std::string &descr)
returns a Query for matching atoms that have heteroatom neighbors
Definition: QueryOps.h:635
RDKit::BOND_OR_QUERY
Queries::OrQuery< int, Bond const *, true > BOND_OR_QUERY
Definition: QueryOps.h:38
RDKit::makeAtomNonHydrogenDegreeQuery
T * makeAtomNonHydrogenDegreeQuery(int what, const std::string &descr)
returns a Query for matching the number of non-hydrogen neighbors
Definition: QueryOps.h:644
RDKit::makeAtomHCountQuery
T * makeAtomHCountQuery(int what, const std::string &descr)
returns a Query for matching hydrogen count
Definition: QueryOps.h:430
RDKit::queryBondMinRingSize
static int queryBondMinRingSize(Bond const *bond)
Definition: QueryOps.h:305
RDKit::makeAtomNegativeFormalChargeQuery
T * makeAtomNegativeFormalChargeQuery(int what, const std::string &descr)
Definition: QueryOps.h:496
RDKit::massIntegerConversionFactor
const int massIntegerConversionFactor
Definition: QueryOps.h:156
RDKit::makeXHAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY * makeXHAtomQuery()
returns a Query for matching generic XH atoms (halogen or H)
RDKit::queryAtomTotalValence
static int queryAtomTotalValence(Atom const *at)
Definition: QueryOps.h:125
RDKit::queryAtomNonHydrogenDegree
static int queryAtomNonHydrogenDegree(Atom const *at)
D and T are treated as "non-hydrogen" here.
Definition: QueryOps.h:85
RDKit::makeAtomType
static int makeAtomType(int atomic_num, bool aromatic)
Definition: QueryOps.h:132
RDKit::makePropQuery
Queries::EqualityQuery< int, const Target *, true > * makePropQuery(const std::string &propname, const T &val, const T &tolerance=T())
Definition: QueryOps.h:1062
RDKit::makeAtomSimpleQuery
T * makeAtomSimpleQuery(int what, int func(Atom const *), const std::string &description="Atom Simple")
Definition: QueryOps.h:343
RDKit::makeAtomInNRingsQuery
T * makeAtomInNRingsQuery(int what, const std::string &descr)
returns a Query for matching atoms in a particular number of rings
Definition: QueryOps.h:556
RDKit::queryAtomHeavyAtomDegree
static int queryAtomHeavyAtomDegree(Atom const *at)
D and T are not treated as heavy atoms here.
Definition: QueryOps.h:98
RDKit::queryAtomRingBondCount
static int queryAtomRingBondCount(Atom const *at)
Definition: QueryOps.h:309
RDKit::makeAtomRangeQuery
static ATOM_RANGE_QUERY * makeAtomRangeQuery(int lower, int upper, bool lowerOpen, bool upperOpen, int func(Atom const *), const std::string &description="Atom Range")
Definition: QueryOps.h:352
RDKit::BOND_XOR_QUERY
Queries::XOrQuery< int, Bond const *, true > BOND_XOR_QUERY
Definition: QueryOps.h:41
RDKit::makeAtomHeavyAtomDegreeQuery
T * makeAtomHeavyAtomDegreeQuery(int what, const std::string &descr)
returns a Query for matching heavy atom degree
Definition: QueryOps.h:422
RDKit::makeXAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_OR_QUERY * makeXAtomQuery()
returns a Query for matching generic X atoms (halogens)
RDKit::ATOM_NULL_QUERY
Queries::Query< int, Atom const *, true > ATOM_NULL_QUERY
Definition: QueryOps.h:67
RDKit::queryAtomAliphatic
static int queryAtomAliphatic(Atom const *at)
Definition: QueryOps.h:75
RDKit::queryAtomNumHeteroatomNbrs
static int queryAtomNumHeteroatomNbrs(Atom const *at)
Definition: QueryOps.h:197
RDKit::getAtomTypeIsAromatic
static bool getAtomTypeIsAromatic(int val)
Definition: QueryOps.h:144
RDKit::queryIsAtomInNRings
static int queryIsAtomInNRings(Atom const *at)
Definition: QueryOps.h:279
RDKit::makeBondNullQuery
RDKIT_GRAPHMOL_EXPORT BOND_NULL_QUERY * makeBondNullQuery()
returns a Query for matching any bond
RDKit::queryAtomHasChiralTag
static int queryAtomHasChiralTag(Atom const *at)
Definition: QueryOps.h:176
RDKit::BOND_PROP_QUERY
Queries::EqualityQuery< int, Bond const *, true > BOND_PROP_QUERY
Definition: QueryOps.h:848
RDKit::ATOM_OR_QUERY
Queries::OrQuery< int, Atom const *, true > ATOM_OR_QUERY
Definition: QueryOps.h:37
RDKit::queryAtomImplicitHCount
static int queryAtomImplicitHCount(Atom const *at)
Definition: QueryOps.h:113
RDKit::queryAtomFormalCharge
static int queryAtomFormalCharge(Atom const *at)
Definition: QueryOps.h:164
RDKit::queryIsAtomBridgehead
RDKIT_GRAPHMOL_EXPORT int queryIsAtomBridgehead(Atom const *at)
RDKit::queryAtomNum
static int queryAtomNum(Atom const *at)
Definition: QueryOps.h:131
RDKit::BOND_GREATEREQUAL_QUERY
Queries::GreaterEqualQuery< int, Bond const *, true > BOND_GREATEREQUAL_QUERY
Definition: QueryOps.h:52
RDKit::makeAtomInRingOfSizeQuery
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY * makeAtomInRingOfSizeQuery(int tgt)
returns a Query for matching atoms in rings of a particular size
RDKit::makeAtomInRingQuery
T * makeAtomInRingQuery(const std::string &descr)
returns a Query for matching ring atoms
Definition: QueryOps.h:548
RDKit::queryIsAtomInRing
static int queryIsAtomInRing(Atom const *at)
Definition: QueryOps.h:282
RDKit::queryAtomHCount
static int queryAtomHCount(Atom const *at)
Definition: QueryOps.h:110
RDKit::queryAtomExplicitValence
static int queryAtomExplicitValence(Atom const *at)
Definition: QueryOps.h:122
RDKit::isAtomListQuery
RDKIT_GRAPHMOL_EXPORT bool isAtomListQuery(const Atom *a)
RDKit::makeQHAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY * makeQHAtomQuery()
returns a Query for matching generic QH atoms (heteroatom or H)
RDKit::queryAtomMass
static int queryAtomMass(Atom const *at)
Definition: QueryOps.h:157
RDKit::queryAtomHasAliphaticHeteroatomNbrs
static int queryAtomHasAliphaticHeteroatomNbrs(Atom const *at)
Definition: QueryOps.h:211
RDKit::queryAtomNumAliphaticHeteroatomNbrs
static int queryAtomNumAliphaticHeteroatomNbrs(Atom const *at)
Definition: QueryOps.h:225
RDKit::makeBondHasStereoQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondHasStereoQuery()
returns a Query for matching bonds with stereo set
RDKit::makeAtomIsBridgeheadQuery
T * makeAtomIsBridgeheadQuery(const std::string &descr)
returns a Query for matching bridgehead atoms
Definition: QueryOps.h:653
RDKit::BOND_EQUALS_QUERY
Queries::EqualityQuery< int, Bond const *, true > BOND_EQUALS_QUERY
Definition: QueryOps.h:44
RDKit::queryAtomIsInRingOfSize
int queryAtomIsInRingOfSize(Atom const *at)
Definition: QueryOps.h:325
RDKit::ATOM_GREATER_QUERY
Queries::GreaterQuery< int, Atom const *, true > ATOM_GREATER_QUERY
Definition: QueryOps.h:46
RDKit::queryBondIsInRingOfSize
int queryBondIsInRingOfSize(Bond const *bond)
Definition: QueryOps.h:333
RDKit::BOND_AND_QUERY
Queries::AndQuery< int, Bond const *, true > BOND_AND_QUERY
Definition: QueryOps.h:35
RDKit::queryBondIsSingleOrDoubleOrAromatic
static int queryBondIsSingleOrDoubleOrAromatic(Bond const *bond)
Definition: QueryOps.h:261
RDKit::getAtomListQueryVals
RDKIT_GRAPHMOL_EXPORT void getAtomListQueryVals(const Atom::QUERYATOM_QUERY *q, std::vector< int > &vals)
RDKit::makeHasPropQuery
Queries::EqualityQuery< int, const Target *, true > * makeHasPropQuery(const std::string &property)
returns a Query for matching atoms that have a particular property
Definition: QueryOps.h:852
RDKit::makeDoubleOrAromaticBondQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeDoubleOrAromaticBondQuery()
returns a Query for double|aromatic bonds
RDKit::makeAtomIsotopeQuery
T * makeAtomIsotopeQuery(int what, const std::string &descr)
returns a Query for matching atoms with a particular isotope
Definition: QueryOps.h:479
RDKit::ATOM_EQUALS_QUERY
Queries::EqualityQuery< int, Atom const *, true > ATOM_EQUALS_QUERY
Definition: QueryOps.h:43
RDKit::queryIsBondInNRings
static int queryIsBondInNRings(Bond const *at)
Definition: QueryOps.h:269
RDKit::makeAtomHasImplicitHQuery
T * makeAtomHasImplicitHQuery(const std::string &descr)
returns a Query for matching ring atoms
Definition: QueryOps.h:438
RDKit::queryAtomTotalDegree
static int queryAtomTotalDegree(Atom const *at)
Definition: QueryOps.h:81
RDKit::BOND_NULL_QUERY
Queries::Query< int, Bond const *, true > BOND_NULL_QUERY
Definition: QueryOps.h:66
RDKit::isComplexQuery
RDKIT_GRAPHMOL_EXPORT bool isComplexQuery(const Bond *b)
RDKit::ATOM_PROP_QUERY
Queries::EqualityQuery< int, Atom const *, true > ATOM_PROP_QUERY
Definition: QueryOps.h:847
RDKit::makeAtomTotalValenceQuery
T * makeAtomTotalValenceQuery(int what, const std::string &descr)
returns a Query for matching total valence
Definition: QueryOps.h:398
RDKit::makeAtomAromaticQuery
T * makeAtomAromaticQuery(const std::string &descr)
returns a Query for matching the isAromatic flag
Definition: QueryOps.h:454
RDKit::queryBondDir
static int queryBondDir(Bond const *bond)
Definition: QueryOps.h:266
RDKit::makeAtomTotalDegreeQuery
T * makeAtomTotalDegreeQuery(int what, const std::string &descr)
returns a Query for matching atomic degree
Definition: QueryOps.h:414
RDKit::makeSingleOrAromaticBondQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeSingleOrAromaticBondQuery()
returns a Query for unspecified SMARTS bonds
RDKit::makeAAtomQuery
RDKIT_GRAPHMOL_EXPORT ATOM_EQUALS_QUERY * makeAAtomQuery()
returns a Query for matching generic A atoms (heavy atoms)
RDKit::getAtomTypeAtomicNum
static int getAtomTypeAtomicNum(int val)
Definition: QueryOps.h:148
RDKit::nullDataFun
int nullDataFun(T)
Definition: QueryOps.h:802
RDKit::makeAtomRingBondCountQuery
T * makeAtomRingBondCountQuery(int what, const std::string &descr)
returns a Query for matching atoms with a particular number of ring bonds
Definition: QueryOps.h:575
RDKit::makeAtomNumQuery
T * makeAtomNumQuery(int what, const std::string &descr)
returns a Query for matching atomic number
Definition: QueryOps.h:364
RDKit::makeBondMinRingSizeQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondMinRingSizeQuery(int what)
returns a Query for matching a bond's minimum ring size
RDKit::queryBondIsSingleOrDouble
static int queryBondIsSingleOrDouble(Bond const *bond)
Definition: QueryOps.h:257
RDKit::ConstAtomPtr
Atom const * ConstAtomPtr
Definition: QueryOps.h:700
RDKit::makeBondOrderEqualsQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondOrderEqualsQuery(Bond::BondType what)
returns a Query for matching bond orders
RDKit::makeSingleOrDoubleBondQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeSingleOrDoubleBondQuery()
returns a Query for single|double bonds
RDKit::makeBondInNRingsQuery
RDKIT_GRAPHMOL_EXPORT BOND_EQUALS_QUERY * makeBondInNRingsQuery(int tgt)
returns a Query for matching bonds in a particular number of rings
RDKit::ATOM_GREATEREQUAL_QUERY
Queries::GreaterEqualQuery< int, Atom const *, true > ATOM_GREATEREQUAL_QUERY
Definition: QueryOps.h:50
RDKit::makeAtomNumRadicalElectronsQuery
T * makeAtomNumRadicalElectronsQuery(int what, const std::string &descr)
returns a Query for matching the number of radical electrons
Definition: QueryOps.h:513
RDKit::queryAtomIsotope
static int queryAtomIsotope(Atom const *at)
Definition: QueryOps.h:161
RDKit::BOND_RANGE_QUERY
Queries::RangeQuery< int, Bond const *, true > BOND_RANGE_QUERY
Definition: QueryOps.h:61
RDKit::queryAtomImplicitValence
static int queryAtomImplicitValence(Atom const *at)
Definition: QueryOps.h:119
RDKit::makeAtomMissingChiralTagQuery
T * makeAtomMissingChiralTagQuery(const std::string &descr)
Definition: QueryOps.h:532
RDKit::queryIsBondInRing
static int queryIsBondInRing(Bond const *bond)
Definition: QueryOps.h:299
RDKit::makeAtomExplicitDegreeQuery
T * makeAtomExplicitDegreeQuery(int what, const std::string &descr)
returns a Query for matching explicit degree
Definition: QueryOps.h:406
RDKit::queryBondOrder
static int queryBondOrder(Bond const *bond)
Definition: QueryOps.h:246
RDKit::queryAtomRingMembership
static int queryAtomRingMembership(Atom const *at)
Definition: QueryOps.h:691
RDKit::makeAtomHasRingBondQuery
T * makeAtomHasRingBondQuery(const std::string &descr)
returns a Query for matching atoms that have ring bonds
Definition: QueryOps.h:600
RDKit::parseAtomType
static void parseAtomType(int val, int &atomic_num, bool &aromatic)
Definition: QueryOps.h:135
RDKit::makeAtomImplicitHCountQuery
T * makeAtomImplicitHCountQuery(int what, const std::string &descr)
returns a Query for matching implicit hydrogen count
Definition: QueryOps.h:446
RDKit::BOND_GREATER_QUERY
Queries::GreaterQuery< int, Bond const *, true > BOND_GREATER_QUERY
Definition: QueryOps.h:47
RDKit::queryAtomMissingChiralTag
static int queryAtomMissingChiralTag(Atom const *at)
Definition: QueryOps.h:179
RDKit::ATOM_BOOL_QUERY
Queries::Query< bool, Atom const *, true > ATOM_BOOL_QUERY
Definition: QueryOps.h:31