Loading...
Searching...
No Matches
ROMol.h
Go to the documentation of this file.
//
// Copyright (C) 2003-2022 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 ROMol.h
\brief Defines the primary molecule class \c ROMol as well as associated
typedefs
*/
#include <RDGeneral/export.h>
#ifndef RD_ROMOL_H
#define RD_ROMOL_H
/// Std stuff
#include <cstddef>
#include <iterator>
#include <utility>
#include <map>
#include <ranges>
#include <limits>
// boost stuff
#include <RDGeneral/BoostStartInclude.h>
#include <boost/graph/adjacency_list.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/dynamic_bitset.hpp>
#ifdef RDK_USE_BOOST_SERIALIZATION
#include <boost/serialization/split_member.hpp>
#endif
#include <RDGeneral/BoostEndInclude.h>
// our stuff
#include <RDGeneral/types.h>
#include <RDGeneral/RDProps.h>
#include "Atom.h"
#include "Bond.h"
#include "Conformer.h"
#include "SubstanceGroup.h"
#include "StereoGroup.h"
#include "RingInfo.h"
namespace RDKit {
class SubstanceGroup;
class Atom;
class Bond;
//! This is the BGL type used to store the topology:
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
Atom *, Bond *>
MolGraph;
class MolPickler;
class RWMol;
class QueryAtom;
class QueryBond;
class RingInfo;
template <class T1, class T2>
class AtomIterator_;
class BondIterator_;
class ConstBondIterator_;
template <class T1, class T2>
class AromaticAtomIterator_;
template <class T1, class T2>
class HeteroatomIterator_;
template <class T1, class T2>
class QueryAtomIterator_;
template <class T1, class T2>
class MatchingAtomIterator_;
RDKIT_GRAPHMOL_EXPORT extern const int ci_RIGHTMOST_ATOM;
RDKIT_GRAPHMOL_EXPORT extern const int ci_LEADING_BOND;
RDKIT_GRAPHMOL_EXPORT extern const int ci_ATOM_HOLDER;
//! ROMol is a molecule class that is intended to have a fixed topology
/*!
This is the primary class for most molecule operations.
If you need to be manipulating the molecule (e.g. adding or deleting
atoms or bonds, use an RWMol instead.
<b>Notes:</b>
- each ROMol maintains a Dict of \c properties:
- Each \c property is keyed by name and can store an
arbitrary type.
- \c Properties can be marked as \c calculated, in which case
they will be cleared when the \c clearComputedProps() method
is called.
- Because they have no impact upon chemistry, all \c property
operations are \c const, this allows extra flexibility for
clients who need to store extra data on ROMol objects.
- each ROMol has collections of \c bookmarks for Atoms and Bonds:
- the Atom bookmarks and Bond bookmarks are stored separately
from each other
- each \c bookmark, an integer, can map to more than one
Atom or Bond
- these are currently used in molecule construction, but
could also be useful for reaction mapping and the like
- information about rings (SSSR and the like) is stored in the
molecule's RingInfo pointer.
*/
//! \name C++11 Iterators
template <class Graph, class Vertex,
class Iterator = typename Graph::vertex_iterator>
struct CXXAtomIterator {
Graph *graph;
Iterator vstart, vend;
struct CXXAtomIter {
using iterator_category = std::random_access_iterator_tag;
using difference_type = std::ptrdiff_t;
using value_type = Vertex;
using pointer = Vertex *;
using reference = Vertex &;
using const_reference = Vertex const &;
Graph *graph = nullptr;
Iterator pos;
CXXAtomIter() {};
CXXAtomIter(Graph *graph, Iterator pos) : graph(graph), pos(pos) {}
// we only return const references since we don't want clients modifying the
// graph itself through these iterators
const_reference operator*() const { return (*graph)[*pos]; }
// we only return const references since we don't want clients modifying the
// graph itself through these iterators
const_reference operator[](difference_type n) const {
return (*graph)[*(pos + n)];
}
CXXAtomIter &operator++() {
++pos;
return *this;
}
CXXAtomIter operator++(int) {
CXXAtomIter tmp = *this;
++(*this);
return tmp;
}
CXXAtomIter &operator--() {
--pos;
return *this;
}
CXXAtomIter operator+(difference_type n) const {
return CXXAtomIter(graph, pos + n);
}
CXXAtomIter operator-(difference_type n) const {
return CXXAtomIter(graph, pos - n);
}
CXXAtomIter operator--(int) {
CXXAtomIter tmp = *this;
--(*this);
return tmp;
}
CXXAtomIter &operator+=(difference_type n) {
pos += n;
return *this;
}
CXXAtomIter &operator-=(difference_type n) {
pos -= n;
return *this;
}
difference_type operator-(const CXXAtomIter &other) const {
return pos - other.pos;
}
friend CXXAtomIter operator+(difference_type n, const CXXAtomIter &it) {
return CXXAtomIter(it.graph, it.pos + n);
}
bool operator==(const CXXAtomIter &other) const {
return graph == other.graph && pos == other.pos;
}
bool operator!=(const CXXAtomIter &other) const {
return !(*this == other);
}
bool operator<(const CXXAtomIter &other) const { return pos < other.pos; }
bool operator<=(const CXXAtomIter &other) const { return pos <= other.pos; }
bool operator>(const CXXAtomIter &other) const { return pos > other.pos; }
bool operator>=(const CXXAtomIter &other) const { return pos >= other.pos; }
};
CXXAtomIterator(Graph *graph) : graph(graph) {
std::tie(vstart, vend) = boost::vertices(*graph);
}
CXXAtomIterator(Graph *graph, Iterator start, Iterator end)
: graph(graph), vstart(start), vend(end) {};
CXXAtomIter begin() { return {graph, vstart}; }
CXXAtomIter end() { return {graph, vend}; }
size_t size() const { return vend - vstart; }
};
// clang-format off
static_assert(
std::ranges::random_access_range<CXXAtomIterator<MolGraph, Atom *>>
and std::ranges::sized_range<CXXAtomIterator<MolGraph, Atom *>>
);
// clang-format on
template <class Graph, class Edge,
class Iterator = typename Graph::edge_iterator>
struct CXXBondIterator {
Graph *graph;
Iterator vstart, vend;
struct CXXBondIter {
using iterator_category = std::bidirectional_iterator_tag;
using difference_type = std::ptrdiff_t;
using value_type = Edge;
using pointer = Edge *;
using reference = Edge &;
using const_reference = Edge const &;
Graph *graph = nullptr;
Iterator pos;
CXXBondIter() {};
CXXBondIter(Graph *graph, Iterator pos) : graph(graph), pos(pos) {}
// we only return const references since we don't want clients modifying the
// graph itself through these iterators
const_reference operator*() const { return (*graph)[*pos]; }
CXXBondIter &operator++() {
++pos;
return *this;
}
CXXBondIter operator++(int) {
CXXBondIter tmp = *this;
++(*this);
return tmp;
}
CXXBondIter &operator--() {
--pos;
return *this;
}
CXXBondIter operator--(int) {
CXXBondIter tmp = *this;
--(*this);
return tmp;
}
bool operator==(const CXXBondIter &other) const {
return graph == other.graph && pos == other.pos;
}
bool operator!=(const CXXBondIter &other) const {
return !(*this == other);
}
};
CXXBondIterator(Graph *graph) : graph(graph) {
auto vs = boost::edges(*graph);
vstart = vs.first;
vend = vs.second;
}
CXXBondIterator(Graph *graph, Iterator start, Iterator end)
: graph(graph), vstart(start), vend(end) {};
CXXBondIter begin() { return {graph, vstart}; }
CXXBondIter end() { return {graph, vend}; }
size_t size() const {
// bond iterators aren't random access, so we can't just do vend - vstart
// here. Instead we have to iterate through;
size_t count = 0;
for (auto it = vstart; it != vend; ++it) {
++count;
}
return count;
}
};
// we don't model sized_range because size() is O(N)
static_assert(
std::ranges::bidirectional_range<CXXBondIterator<MolGraph, Bond *>>);
class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps {
public:
friend class MolPickler;
friend class RWMol;
//! \cond TYPEDEFS
//! \name typedefs
//! @{
typedef MolGraph::vertex_descriptor vertex_descriptor;
typedef MolGraph::edge_descriptor edge_descriptor;
typedef MolGraph::edge_iterator EDGE_ITER;
typedef MolGraph::out_edge_iterator OEDGE_ITER;
typedef MolGraph::vertex_iterator VERTEX_ITER;
typedef MolGraph::adjacency_iterator ADJ_ITER;
typedef std::pair<EDGE_ITER, EDGE_ITER> BOND_ITER_PAIR;
typedef std::pair<OEDGE_ITER, OEDGE_ITER> OBOND_ITER_PAIR;
typedef std::pair<VERTEX_ITER, VERTEX_ITER> ATOM_ITER_PAIR;
typedef std::pair<ADJ_ITER, ADJ_ITER> ADJ_ITER_PAIR;
typedef std::vector<Atom *> ATOM_PTR_VECT;
typedef ATOM_PTR_VECT::iterator ATOM_PTR_VECT_I;
typedef ATOM_PTR_VECT::const_iterator ATOM_PTR_VECT_CI;
typedef std::vector<Bond *> BOND_PTR_VECT;
typedef BOND_PTR_VECT::iterator BOND_PTR_VECT_I;
typedef BOND_PTR_VECT::const_iterator BOND_PTR_VECT_CI;
typedef std::list<Atom *> ATOM_PTR_LIST;
typedef ATOM_PTR_LIST::iterator ATOM_PTR_LIST_I;
typedef ATOM_PTR_LIST::const_iterator ATOM_PTR_LIST_CI;
typedef std::list<Bond *> BOND_PTR_LIST;
typedef BOND_PTR_LIST::iterator BOND_PTR_LIST_I;
typedef BOND_PTR_LIST::const_iterator BOND_PTR_LIST_CI;
// list of conformations
typedef std::list<CONFORMER_SPTR> CONF_SPTR_LIST;
typedef CONF_SPTR_LIST::iterator CONF_SPTR_LIST_I;
typedef CONF_SPTR_LIST::const_iterator CONF_SPTR_LIST_CI;
typedef std::pair<CONF_SPTR_LIST_I, CONF_SPTR_LIST_I> CONFS_I_PAIR;
// ROFIX: these will need to be readonly somehow?
typedef std::map<int, ATOM_PTR_LIST> ATOM_BOOKMARK_MAP;
typedef std::map<int, BOND_PTR_LIST> BOND_BOOKMARK_MAP;
typedef class AtomIterator_<Atom, ROMol> AtomIterator;
typedef class AtomIterator_<const Atom, const ROMol> ConstAtomIterator;
typedef class BondIterator_ BondIterator;
typedef class ConstBondIterator_ ConstBondIterator;
typedef class AromaticAtomIterator_<Atom, ROMol> AromaticAtomIterator;
typedef class AromaticAtomIterator_<const Atom, const ROMol>
ConstAromaticAtomIterator;
typedef class HeteroatomIterator_<Atom, ROMol> HeteroatomIterator;
typedef class HeteroatomIterator_<const Atom, const ROMol>
ConstHeteroatomIterator;
typedef class QueryAtomIterator_<Atom, ROMol> QueryAtomIterator;
typedef class QueryAtomIterator_<const Atom, const ROMol>
ConstQueryAtomIterator;
typedef class MatchingAtomIterator_<Atom, ROMol> MatchingAtomIterator;
typedef class MatchingAtomIterator_<const Atom, const ROMol>
ConstMatchingAtomIterator;
typedef CONF_SPTR_LIST_I ConformerIterator;
typedef CONF_SPTR_LIST_CI ConstConformerIterator;
//! @}
//! \endcond
//! C++11 Range iterator
/*!
<b>Usage</b>
\code
for(auto atom : mol.atoms()) {
atom->getIdx();
};
\endcode
*/
CXXAtomIterator<MolGraph, Atom *> atoms() { return {&d_graph}; }
CXXAtomIterator<const MolGraph, Atom *const> atoms() const {
return {&d_graph};
}
CXXAtomIterator<const MolGraph, Atom *const, MolGraph::adjacency_iterator>
atomNeighbors(Atom const *at) const {
auto pr = getAtomNeighbors(at);
return {&d_graph, pr.first, pr.second};
}
CXXAtomIterator<MolGraph, Atom *, MolGraph::adjacency_iterator> atomNeighbors(
Atom const *at) {
auto pr = getAtomNeighbors(at);
return {&d_graph, pr.first, pr.second};
}
CXXBondIterator<const MolGraph, Bond *const, MolGraph::out_edge_iterator>
atomBonds(Atom const *at) const {
auto pr = getAtomBonds(at);
return {&d_graph, pr.first, pr.second};
}
CXXBondIterator<MolGraph, Bond *, MolGraph::out_edge_iterator> atomBonds(
Atom const *at) {
auto pr = getAtomBonds(at);
return {&d_graph, pr.first, pr.second};
}
/*!
<b>Usage</b>
\code
for(auto bond : mol.bonds()) {
bond->getIdx();
};
\endcode
*/
CXXBondIterator<MolGraph, Bond *> bonds() { return {&d_graph}; }
CXXBondIterator<const MolGraph, Bond *const> bonds() const {
return {&d_graph};
}
ROMol() : RDProps() { initMol(); }
//! copy constructor with a twist
/*!
\param other the molecule to be copied
\param quickCopy (optional) if this is true, the resulting ROMol will not
copy any of the properties or bookmarks and conformers from \c other.
This can
make the copy substantially faster (thus the name).
\param confId (optional) if this is >=0, the resulting ROMol will contain
only
the specified conformer from \c other.
*/
ROMol(const ROMol &other, bool quickCopy = false, int confId = -1)
: RDProps() {
dp_ringInfo = nullptr;
initFromOther(other, quickCopy, confId);
numBonds = rdcast<unsigned int>(boost::num_edges(d_graph));
}
//! construct a molecule from a pickle string
ROMol(const std::string &binStr);
//! construct a molecule from a pickle string
ROMol(const std::string &binStr, unsigned int propertyFlags);
ROMol(ROMol &&o) noexcept
: RDProps(std::move(o)),
d_graph(std::move(o.d_graph)),
d_atomBookmarks(std::move(o.d_atomBookmarks)),
d_bondBookmarks(std::move(o.d_bondBookmarks)),
d_confs(std::move(o.d_confs)),
d_sgroups(std::move(o.d_sgroups)),
d_stereo_groups(std::move(o.d_stereo_groups)),
numBonds(o.numBonds) {
for (auto atom : atoms()) {
atom->setOwningMol(this);
}
for (auto bond : bonds()) {
bond->setOwningMol(this);
}
for (auto conf : d_confs) {
conf->setOwningMol(this);
}
for (auto &sg : d_sgroups) {
sg.setOwningMol(this);
}
o.d_graph.clear();
o.numBonds = 0;
dp_ringInfo = std::exchange(o.dp_ringInfo, nullptr);
dp_delAtoms = std::exchange(o.dp_delAtoms, nullptr);
dp_delBonds = std::exchange(o.dp_delBonds, nullptr);
}
ROMol &operator=(ROMol &&o) noexcept {
if (this == &o) {
return *this;
}
RDProps::operator=(std::move(o));
d_graph = std::move(o.d_graph);
d_atomBookmarks = std::move(o.d_atomBookmarks);
d_bondBookmarks = std::move(o.d_bondBookmarks);
if (dp_ringInfo) {
delete dp_ringInfo;
}
dp_ringInfo = std::exchange(o.dp_ringInfo, nullptr);
d_confs = std::move(o.d_confs);
d_sgroups = std::move(o.d_sgroups);
d_stereo_groups = std::move(o.d_stereo_groups);
dp_delAtoms = std::exchange(o.dp_delAtoms, nullptr);
dp_delBonds = std::exchange(o.dp_delBonds, nullptr);
numBonds = o.numBonds;
o.numBonds = 0;
for (auto atom : atoms()) {
atom->setOwningMol(this);
}
for (auto bond : bonds()) {
bond->setOwningMol(this);
}
for (auto conf : d_confs) {
conf->setOwningMol(this);
}
for (auto &sg : d_sgroups) {
sg.setOwningMol(this);
}
o.d_graph.clear();
return *this;
}
ROMol &operator=(const ROMol &) =
delete; // disable assignment, RWMol's support assignment
virtual ~ROMol() { destroy(); }
//! @}
//! \name Atoms
//! @{
//! returns our number of atoms
inline unsigned int getNumAtoms() const {
return rdcast<unsigned int>(boost::num_vertices(d_graph));
}
unsigned int getNumAtoms(bool onlyExplicit) const;
//! returns our number of heavy atoms (atomic number > 1)
unsigned int getNumHeavyAtoms() const;
//! returns a pointer to a particular Atom
Atom *getAtomWithIdx(unsigned int idx);
//! \overload
const Atom *getAtomWithIdx(unsigned int idx) const;
//! \overload
template <class U>
Atom *getAtomWithIdx(const U idx) {
return getAtomWithIdx(rdcast<unsigned int>(idx));
}
//! \overload
template <class U>
const Atom *getAtomWithIdx(const U idx) const {
return getAtomWithIdx(rdcast<unsigned int>(idx));
}
//! returns the degree (number of neighbors) of an Atom in the graph
unsigned int getAtomDegree(const Atom *at) const;
//! @}
//! \name Bonds
//! @{
//! returns our number of Bonds
unsigned int getNumBonds(bool onlyHeavy = 1) const;
//! returns a pointer to a particular Bond
Bond *getBondWithIdx(unsigned int idx);
//! \overload
const Bond *getBondWithIdx(unsigned int idx) const;
//! \overload
template <class U>
Bond *getBondWithIdx(const U idx) {
return getBondWithIdx(rdcast<unsigned int>(idx));
}
//! \overload
template <class U>
const Bond *getBondWithIdx(const U idx) const {
return getBondWithIdx(rdcast<unsigned int>(idx));
}
//! returns a pointer to the bond between two atoms, Null on failure
Bond *getBondBetweenAtoms(unsigned int idx1, unsigned int idx2);
//! \overload
const Bond *getBondBetweenAtoms(unsigned int idx1, unsigned int idx2) const;
//! \overload
template <class U, class V>
Bond *getBondBetweenAtoms(const U idx1, const V idx2) {
return getBondBetweenAtoms(rdcast<unsigned int>(idx1),
rdcast<unsigned int>(idx2));
}
//! \overload
template <class U, class V>
const Bond *getBondBetweenAtoms(const U idx1, const V idx2) const {
return getBondBetweenAtoms(rdcast<unsigned int>(idx1),
rdcast<unsigned int>(idx2));
}
//! @}
//! \name Bookmarks
//! @{
//! associates an Atom pointer with a bookmark
void setAtomBookmark(Atom *at, int mark) {
d_atomBookmarks[mark].push_back(at);
}
//! associates an Atom pointer with a bookmark
void replaceAtomBookmark(Atom *at, int mark) {
d_atomBookmarks[mark].clear();
d_atomBookmarks[mark].push_back(at);
}
//! returns the first Atom associated with the \c bookmark provided
Atom *getAtomWithBookmark(int mark);
//! returns the Atom associated with the \c bookmark provided
//! a check is made to ensure it is the only atom with that bookmark
Atom *getUniqueAtomWithBookmark(int mark);
//! returns all Atoms associated with the \c bookmark provided
ATOM_PTR_LIST &getAllAtomsWithBookmark(int mark);
//! removes a \c bookmark from our collection
void clearAtomBookmark(int mark);
//! removes a particular Atom from the list associated with the \c bookmark
void clearAtomBookmark(int mark, const Atom *atom);
//! blows out all atomic \c bookmarks
void clearAllAtomBookmarks() { d_atomBookmarks.clear(); }
//! queries whether or not any atoms are associated with a \c bookmark
bool hasAtomBookmark(int mark) const { return d_atomBookmarks.count(mark); }
//! returns a pointer to all of our atom \c bookmarks
ATOM_BOOKMARK_MAP *getAtomBookmarks() { return &d_atomBookmarks; }
//! associates a Bond pointer with a bookmark
void setBondBookmark(Bond *bond, int mark) {
d_bondBookmarks[mark].push_back(bond);
}
//! returns the first Bond associated with the \c bookmark provided
Bond *getBondWithBookmark(int mark);
//! returns the Bond associated with the \c bookmark provided
//! a check is made to ensure it is the only bond with that bookmark
Bond *getUniqueBondWithBookmark(int mark);
//! returns all bonds associated with the \c bookmark provided
BOND_PTR_LIST &getAllBondsWithBookmark(int mark);
//! removes a \c bookmark from our collection
void clearBondBookmark(int mark);
//! removes a particular Bond from the list associated with the \c bookmark
void clearBondBookmark(int mark, const Bond *bond);
//! blows out all bond \c bookmarks
void clearAllBondBookmarks() { d_bondBookmarks.clear(); }
//! queries whether or not any bonds are associated with a \c bookmark
bool hasBondBookmark(int mark) const { return d_bondBookmarks.count(mark); }
//! returns a pointer to all of our bond \c bookmarks
BOND_BOOKMARK_MAP *getBondBookmarks() { return &d_bondBookmarks; }
//! @}
//! \name Conformers
//! @{
//! return the conformer with a specified ID
//! if the ID is negative the first conformation will be returned
const Conformer &getConformer(int id = -1) const;
//! return the conformer with a specified ID
//! if the ID is negative the first conformation will be returned
Conformer &getConformer(int id = -1);
//! Delete the conformation with the specified ID
void removeConformer(unsigned int id);
//! Clear all the conformations on the molecule
void clearConformers() { d_confs.clear(); }
//! Add a new conformation to the molecule
/*!
\param conf - conformation to be added to the molecule, this molecule takes
ownership
of the conformer
\param assignId - a unique ID will be assigned to the conformation if
true
otherwise it is assumed that the conformation already has
an (unique) ID set
*/
unsigned int addConformer(Conformer *conf, bool assignId = false);
inline unsigned int getNumConformers() const {
return rdcast<unsigned int>(d_confs.size());
}
//! \name Topology
//! @{
//! returns a pointer to our RingInfo structure
//! <b>Note:</b> the client should not delete this.
RingInfo *getRingInfo() const { return dp_ringInfo; }
//! provides access to all neighbors around an Atom
/*!
\param at the atom whose neighbors we are looking for
<b>Usage</b>
\code
... mol is a const ROMol & ...
... atomPtr is a const Atom * ...
... requires #include <boost/range/iterator_range.hpp>
for (const auto &nbri :
boost::make_iterator_range(m.getAtomNeighbors(atomPtr))) {
const auto &nbr = (*m)[nbri];
// nbr is an atom pointer
}
\endcode
*/
ADJ_ITER_PAIR getAtomNeighbors(Atom const *at) const;
//! provides access to all Bond objects connected to an Atom
/*!
\param at the atom whose neighbors we are looking for
<b>Usage</b>
\code
... mol is a const ROMol & ...
... atomPtr is a const Atom * ...
... requires #include <boost/range/iterator_range.hpp>
for (const auto &nbri :
boost::make_iterator_range(m.getAtomBonds(atomPtr))) {
const auto &nbr = (*m)[nbri];
// nbr is a bond pointer
}
\endcode
or, if you need a non-const Bond *:
\code
... mol is a const ROMol & ...
... atomPtr is a const Atom * ...
... requires #include <boost/range/iterator_range.hpp>
for (const auto &nbri :
boost::make_iterator_range(m.getAtomBonds(atomPtr))) {
auto nbr = (*m)[nbri];
// nbr is a bond pointer
}
\endcode
*/
OBOND_ITER_PAIR getAtomBonds(Atom const *at) const;
//! returns an iterator pair for looping over all Atoms
/*!
<b>Usage</b>
\code
ROMol::VERTEX_ITER atBegin,atEnd;
boost::tie(atBegin,atEnd) = mol.getVertices();
while(atBegin!=atEnd){
ATOM_SPTR at2=mol[*atBegin];
... do something with the Atom ...
++atBegin;
}
\endcode
*/
ATOM_ITER_PAIR getVertices();
//! returns an iterator pair for looping over all Bonds
/*!
<b>Usage</b>
\code
ROMol::EDGE_ITER firstB,lastB;
boost::tie(firstB,lastB) = mol.getEdges();
while(firstB!=lastB){
BOND_SPTR bond = mol[*firstB];
... do something with the Bond ...
++firstB;
}
\endcode
*/
BOND_ITER_PAIR getEdges();
//! \overload
ATOM_ITER_PAIR getVertices() const;
//! \overload
BOND_ITER_PAIR getEdges() const;
//! brief returns a pointer to our underlying BGL object
/*!
This can be useful if you need to call other BGL algorithms:
Here's an example:
\code
... mol is a const ROMol ...
... mapping is an INT_VECT ...
mapping.resize(mol.getNumAtoms());
const MolGraph &G_p = mol.getTopology();
int res = boost::connected_components(G_p,&mapping[0]);
\endcode
*/
MolGraph const &getTopology() const { return d_graph; }
//! @}
//! \name Iterators
//! @{
//! get an AtomIterator pointing at our first Atom
AtomIterator beginAtoms();
//! \overload
ConstAtomIterator beginAtoms() const;
//! get an AtomIterator pointing at the end of our Atoms
AtomIterator endAtoms();
//! \overload
ConstAtomIterator endAtoms() const;
//! get a BondIterator pointing at our first Bond
BondIterator beginBonds();
//! \overload
ConstBondIterator beginBonds() const;
//! get a BondIterator pointing at the end of our Bonds
BondIterator endBonds();
//! \overload
ConstBondIterator endBonds() const;
//! get an AtomIterator pointing at our first aromatic Atom
AromaticAtomIterator beginAromaticAtoms();
//! \overload
ConstAromaticAtomIterator beginAromaticAtoms() const;
//! get an AtomIterator pointing at the end of our Atoms
AromaticAtomIterator endAromaticAtoms();
//! \overload
ConstAromaticAtomIterator endAromaticAtoms() const;
//! get an AtomIterator pointing at our first hetero Atom
HeteroatomIterator beginHeteros();
//! \overload
ConstHeteroatomIterator beginHeteros() const;
//! get an AtomIterator pointing at the end of our Atoms
HeteroatomIterator endHeteros();
//! \overload
ConstHeteroatomIterator endHeteros() const;
//! if the Mol has any Query atoms or bonds
bool hasQuery() const;
//! get an AtomIterator pointing at our first Atom that matches \c query
QueryAtomIterator beginQueryAtoms(QueryAtom const *query);
//! \overload
ConstQueryAtomIterator beginQueryAtoms(QueryAtom const *) const;
//! get an AtomIterator pointing at the end of our Atoms
QueryAtomIterator endQueryAtoms();
//! \overload
ConstQueryAtomIterator endQueryAtoms() const;
//! get an AtomIterator pointing at our first Atom that matches \c query
MatchingAtomIterator beginMatchingAtoms(bool (*query)(Atom *));
//! \overload
ConstMatchingAtomIterator beginMatchingAtoms(
bool (*query)(const Atom *)) const;
//! get an AtomIterator pointing at the end of our Atoms
MatchingAtomIterator endMatchingAtoms();
//! \overload
ConstMatchingAtomIterator endMatchingAtoms() const;
inline ConformerIterator beginConformers() { return d_confs.begin(); }
inline ConformerIterator endConformers() { return d_confs.end(); }
inline ConstConformerIterator beginConformers() const {
return d_confs.begin();
}
inline ConstConformerIterator endConformers() const { return d_confs.end(); }
//! @}
//! \name Properties
//! @{
//! clears all of our \c computed \c properties
void clearComputedProps(bool includeRings = true) const;
//! calculates any of our lazy \c properties
/*!
<b>Notes:</b>
- this calls \c updatePropertyCache() on each of our Atoms and Bonds
*/
void updatePropertyCache(bool strict = true);
bool needsUpdatePropertyCache() const;
void clearPropertyCache();
//! @}
//! \name Misc
//! @{
//! sends some debugging info to a stream
void debugMol(std::ostream &str) const;
//! @}
Atom *operator[](const vertex_descriptor &v) { return d_graph[v]; }
const Atom *operator[](const vertex_descriptor &v) const {
return d_graph[v];
}
Bond *operator[](const edge_descriptor &e) { return d_graph[e]; }
const Bond *operator[](const edge_descriptor &e) const { return d_graph[e]; }
//! Gets a reference to the groups of atoms with relative stereochemistry
/*!
Stereo groups are also called enhanced stereochemistry in the SDF/Mol3000
file format.
*/
const std::vector<StereoGroup> &getStereoGroups() const {
return d_stereo_groups;
}
//! Sets groups of atoms with relative stereochemistry
/*!
\param stereo_groups the new set of stereo groups. All will be replaced.
Stereo groups are also called enhanced stereochemistry in the SDF/Mol3000
file format. stereo_groups should be std::move()ed into this function.
*/
void setStereoGroups(std::vector<StereoGroup> stereo_groups);
#ifdef RDK_USE_BOOST_SERIALIZATION
//! \name boost::serialization support
//! @{
template <class Archive>
void save(Archive &ar, const unsigned int version) const;
template <class Archive>
void load(Archive &ar, const unsigned int version);
BOOST_SERIALIZATION_SPLIT_MEMBER()
//! @}
#endif
private:
MolGraph d_graph;
ATOM_BOOKMARK_MAP d_atomBookmarks;
BOND_BOOKMARK_MAP d_bondBookmarks;
RingInfo *dp_ringInfo = nullptr;
CONF_SPTR_LIST d_confs;
std::vector<SubstanceGroup> d_sgroups;
std::vector<StereoGroup> d_stereo_groups;
std::unique_ptr<boost::dynamic_bitset<>> dp_delAtoms = nullptr;
std::unique_ptr<boost::dynamic_bitset<>> dp_delBonds = nullptr;
friend RDKIT_GRAPHMOL_EXPORT std::vector<SubstanceGroup> &getSubstanceGroups(
ROMol &);
friend RDKIT_GRAPHMOL_EXPORT const std::vector<SubstanceGroup> &
getSubstanceGroups(const ROMol &);
void clearSubstanceGroups() { d_sgroups.clear(); }
protected:
unsigned int numBonds{0};
#ifndef WIN32
private:
#endif
void initMol();
virtual void destroy();
//! adds an Atom to our collection
/*!
\param atom pointer to the Atom to add
\param updateLabel (optional) if this is true, the new Atom will be
our \c activeAtom
\param takeOwnership (optional) if this is true, we take ownership of \c
atom
instead of copying it.
\return the index of the new atom
*/
unsigned int addAtom(Atom *atom, bool updateLabel = true,
bool takeOwnership = false);
//! adds a Bond to our collection
/*!
\param bond pointer to the Bond to add
\param takeOwnership (optional) if this is true, we take ownership of \c
bond
instead of copying it.
\return the new number of bonds
*/
unsigned int addBond(Bond *bond, bool takeOwnership = false);
//! adds a Bond to our collection
/*!
\param bond pointer to the Bond to add
\return the new number of bonds
<b>Note:</b> since this is using a smart pointer, we don't need to worry
about
issues of ownership.
*/
void initFromOther(const ROMol &other, bool quickCopy, int confId);
};
typedef std::vector<ROMol> MOL_VECT;
typedef boost::shared_ptr<ROMol> ROMOL_SPTR;
typedef std::vector<ROMol *> MOL_PTR_VECT;
typedef std::vector<ROMOL_SPTR> MOL_SPTR_VECT;
typedef MOL_PTR_VECT::const_iterator MOL_PTR_VECT_CI;
typedef MOL_PTR_VECT::iterator MOL_PTR_VECT_I;
}; // namespace RDKit
#endif
Atom.h
Defines the Atom class and associated typedefs.
Bond.h
BoostEndInclude.h
BoostStartInclude.h
Conformer.h
rdcast
#define rdcast
Definition Invariant.h:191
RDProps.h
RingInfo.h
StereoGroup.h
Defines the class StereoGroup which stores relationships between the absolute configurations of atoms...
SubstanceGroup.h
Defines the SubstanceGroup class.
RDKit::AromaticAtomIterator_
Iterate over aromatic atoms, this is bidirectional.
Definition AtomIterators.h:111
RDKit::AtomIterator_
A general random access iterator.
Definition AtomIterators.h:31
RDKit::Atom
The class for representing atoms.
Definition Atom.h:74
RDKit::BondIterator_
iterator for a molecule's bonds, currently BiDirectional, but it theoretically ought to be RandomAcce...
Definition BondIterators.h:27
RDKit::Bond
class for representing a bond
Definition Bond.h:46
RDKit::Conformer
The class for representing 2D or 3D conformation of a molecule.
Definition Conformer.h:46
RDKit::ConstBondIterator_
const iterator for a molecule's bonds, currently BiDirectional, but it theoretically ought to be Rand...
Definition BondIterators.h:52
RDKit::HeteroatomIterator_
Iterate over heteroatoms, this is bidirectional.
Definition AtomIterators.h:74
RDKit::MatchingAtomIterator_
Iterate over atoms matching a query function. This is bidirectional.
Definition AtomIterators.h:178
RDKit::MolPickler
handles pickling (serializing) molecules
Definition MolPickler.h:67
RDKit::QueryAtomIterator_
Iterate over atoms matching a query. This is bidirectional.
Definition AtomIterators.h:144
RDKit::QueryAtom
Class for storing atomic queries.
Definition QueryAtom.h:28
RDKit::QueryBond
Class for storing Bond queries.
Definition QueryBond.h:28
RDKit::RDProps::operator=
RDProps & operator=(const RDProps &rhs)
Definition RDProps.h:27
RDKit::RDProps::RDProps
RDProps()
Definition RDProps.h:25
RDKit::ROMol
Definition ROMol.h:285
RDKit::ROMol::endAromaticAtoms
ConstAromaticAtomIterator endAromaticAtoms() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::getAtomNeighbors
ADJ_ITER_PAIR getAtomNeighbors(Atom const *at) const
provides access to all neighbors around an Atom
RDKit::ROMol::endQueryAtoms
ConstQueryAtomIterator endQueryAtoms() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::needsUpdatePropertyCache
bool needsUpdatePropertyCache() const
RDKit::ROMol::getAtomBonds
OBOND_ITER_PAIR getAtomBonds(Atom const *at) const
provides access to all Bond objects connected to an Atom
RDKit::ROMol::getNumBonds
unsigned int getNumBonds(bool onlyHeavy=1) const
returns our number of Bonds
RDKit::ROMol::atoms
CXXAtomIterator< const MolGraph, Atom *const > atoms() const
Definition ROMol.h:365
RDKit::ROMol::clearAtomBookmark
void clearAtomBookmark(int mark)
removes a bookmark from our collection
RDKit::ROMol::getNumHeavyAtoms
unsigned int getNumHeavyAtoms() const
returns our number of heavy atoms (atomic number > 1)
RDKit::ROMol::clearAtomBookmark
void clearAtomBookmark(int mark, const Atom *atom)
removes a particular Atom from the list associated with the bookmark
RDKit::ROMol::getAtomWithIdx
Atom * getAtomWithIdx(unsigned int idx)
returns a pointer to a particular Atom
RDKit::ROMol::getNumConformers
unsigned int getNumConformers() const
Definition ROMol.h:654
RDKit::ROMol::endAtoms
AtomIterator endAtoms()
get an AtomIterator pointing at the end of our Atoms
RDKit::ROMol::getAllBondsWithBookmark
BOND_PTR_LIST & getAllBondsWithBookmark(int mark)
returns all bonds associated with the bookmark provided
RDKit::ROMol::getStereoGroups
const std::vector< StereoGroup > & getStereoGroups() const
Gets a reference to the groups of atoms with relative stereochemistry.
Definition ROMol.h:877
RDKit::ROMol::endAtoms
ConstAtomIterator endAtoms() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::beginBonds
BondIterator beginBonds()
get a BondIterator pointing at our first Bond
RDKit::ROMol::hasAtomBookmark
bool hasAtomBookmark(int mark) const
queries whether or not any atoms are associated with a bookmark
Definition ROMol.h:596
RDKit::ROMol::numBonds
unsigned int numBonds
Definition ROMol.h:919
RDKit::ROMol::getAtomWithIdx
Atom * getAtomWithIdx(const U idx)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ROMol.h:519
RDKit::ROMol::beginQueryAtoms
ConstQueryAtomIterator beginQueryAtoms(QueryAtom const *) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::RWMol
friend class RWMol
Definition ROMol.h:288
RDKit::ROMol::getNumAtoms
unsigned int getNumAtoms() const
returns our number of atoms
Definition ROMol.h:507
RDKit::ROMol::endConformers
ConstConformerIterator endConformers() const
Definition ROMol.h:837
RDKit::ROMol::beginMatchingAtoms
ConstMatchingAtomIterator beginMatchingAtoms(bool(*query)(const Atom *)) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::operator=
ROMol & operator=(ROMol &&o) noexcept
Definition ROMol.h:459
RDKit::ROMol::ROMol
ROMol(const ROMol &other, bool quickCopy=false, int confId=-1)
copy constructor with a twist
Definition ROMol.h:421
RDKit::ROMol::operator=
ROMol & operator=(const ROMol &)=delete
RDKit::ROMol::getUniqueBondWithBookmark
Bond * getUniqueBondWithBookmark(int mark)
RDKit::ROMol::endMatchingAtoms
ConstMatchingAtomIterator endMatchingAtoms() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::getEdges
BOND_ITER_PAIR getEdges()
returns an iterator pair for looping over all Bonds
RDKit::ROMol::clearConformers
void clearConformers()
Clear all the conformations on the molecule.
Definition ROMol.h:640
RDKit::ROMol::setBondBookmark
void setBondBookmark(Bond *bond, int mark)
associates a Bond pointer with a bookmark
Definition ROMol.h:601
RDKit::ROMol::updatePropertyCache
void updatePropertyCache(bool strict=true)
calculates any of our lazy properties
RDKit::ROMol::atoms
CXXAtomIterator< MolGraph, Atom * > atoms()
C++11 Range iterator.
Definition ROMol.h:363
RDKit::ROMol::getAtomWithBookmark
Atom * getAtomWithBookmark(int mark)
returns the first Atom associated with the bookmark provided
RDKit::ROMol::atomNeighbors
CXXAtomIterator< const MolGraph, Atom *const, MolGraph::adjacency_iterator > atomNeighbors(Atom const *at) const
Definition ROMol.h:370
RDKit::ROMol::getBondBookmarks
BOND_BOOKMARK_MAP * getBondBookmarks()
returns a pointer to all of our bond bookmarks
Definition ROMol.h:621
RDKit::ROMol::getConformer
Conformer & getConformer(int id=-1)
RDKit::ROMol::endQueryAtoms
QueryAtomIterator endQueryAtoms()
get an AtomIterator pointing at the end of our Atoms
RDKit::ROMol::getConformer
const Conformer & getConformer(int id=-1) const
RDKit::ROMol::addConformer
unsigned int addConformer(Conformer *conf, bool assignId=false)
Add a new conformation to the molecule.
RDKit::ROMol::operator[]
const Atom * operator[](const vertex_descriptor &v) const
Definition ROMol.h:865
RDKit::ROMol::hasQuery
bool hasQuery() const
if the Mol has any Query atoms or bonds
RDKit::ROMol::clearAllBondBookmarks
void clearAllBondBookmarks()
blows out all bond bookmarks
Definition ROMol.h:617
RDKit::ROMol::getAtomWithIdx
const Atom * getAtomWithIdx(const U idx) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ROMol.h:524
RDKit::ROMol::bonds
CXXBondIterator< MolGraph, Bond * > bonds()
Definition ROMol.h:402
RDKit::ROMol::getVertices
ATOM_ITER_PAIR getVertices()
returns an iterator pair for looping over all Atoms
RDKit::ROMol::getSubstanceGroups
friend RDKIT_GRAPHMOL_EXPORT std::vector< SubstanceGroup > & getSubstanceGroups(ROMol &)
RDKit::ROMol::getEdges
BOND_ITER_PAIR getEdges() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::clearComputedProps
void clearComputedProps(bool includeRings=true) const
clears all of our computed properties
RDKit::ROMol::MolPickler
friend class MolPickler
Definition ROMol.h:287
RDKit::ROMol::getBondWithIdx
const Bond * getBondWithIdx(const U idx) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ROMol.h:547
RDKit::ROMol::getAllAtomsWithBookmark
ATOM_PTR_LIST & getAllAtomsWithBookmark(int mark)
returns all Atoms associated with the bookmark provided
RDKit::ROMol::getBondBetweenAtoms
const Bond * getBondBetweenAtoms(unsigned int idx1, unsigned int idx2) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::ROMol
ROMol(const std::string &binStr, unsigned int propertyFlags)
construct a molecule from a pickle string
RDKit::ROMol::getBondWithIdx
Bond * getBondWithIdx(const U idx)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ROMol.h:542
RDKit::ROMol::getAtomBookmarks
ATOM_BOOKMARK_MAP * getAtomBookmarks()
returns a pointer to all of our atom bookmarks
Definition ROMol.h:598
RDKit::ROMol::beginAtoms
ConstAtomIterator beginAtoms() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::beginAromaticAtoms
ConstAromaticAtomIterator beginAromaticAtoms() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::atomNeighbors
CXXAtomIterator< MolGraph, Atom *, MolGraph::adjacency_iterator > atomNeighbors(Atom const *at)
Definition ROMol.h:375
RDKit::ROMol::debugMol
void debugMol(std::ostream &str) const
RDKit::ROMol::getBondBetweenAtoms
const Bond * getBondBetweenAtoms(const U idx1, const V idx2) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ROMol.h:562
RDKit::ROMol::setAtomBookmark
void setAtomBookmark(Atom *at, int mark)
associates an Atom pointer with a bookmark
Definition ROMol.h:573
RDKit::ROMol::endMatchingAtoms
MatchingAtomIterator endMatchingAtoms()
get an AtomIterator pointing at the end of our Atoms
RDKit::ROMol::beginBonds
ConstBondIterator beginBonds() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::endBonds
BondIterator endBonds()
get a BondIterator pointing at the end of our Bonds
RDKit::ROMol::ROMol
ROMol(const std::string &binStr)
construct a molecule from a pickle string
RDKit::ROMol::getUniqueAtomWithBookmark
Atom * getUniqueAtomWithBookmark(int mark)
RDKit::ROMol::beginQueryAtoms
QueryAtomIterator beginQueryAtoms(QueryAtom const *query)
get an AtomIterator pointing at our first Atom that matches query
RDKit::ROMol::endHeteros
ConstHeteroatomIterator endHeteros() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::clearPropertyCache
void clearPropertyCache()
RDKit::ROMol::replaceAtomBookmark
void replaceAtomBookmark(Atom *at, int mark)
associates an Atom pointer with a bookmark
Definition ROMol.h:577
RDKit::ROMol::getBondWithBookmark
Bond * getBondWithBookmark(int mark)
returns the first Bond associated with the bookmark provided
RDKit::ROMol::atomBonds
CXXBondIterator< const MolGraph, Bond *const, MolGraph::out_edge_iterator > atomBonds(Atom const *at) const
Definition ROMol.h:382
RDKit::ROMol::getAtomDegree
unsigned int getAtomDegree(const Atom *at) const
returns the degree (number of neighbors) of an Atom in the graph
RDKit::ROMol::setStereoGroups
void setStereoGroups(std::vector< StereoGroup > stereo_groups)
Sets groups of atoms with relative stereochemistry.
RDKit::ROMol::atomBonds
CXXBondIterator< MolGraph, Bond *, MolGraph::out_edge_iterator > atomBonds(Atom const *at)
Definition ROMol.h:387
RDKit::ROMol::endAromaticAtoms
AromaticAtomIterator endAromaticAtoms()
get an AtomIterator pointing at the end of our Atoms
RDKit::ROMol::getRingInfo
RingInfo * getRingInfo() const
Definition ROMol.h:663
RDKit::ROMol::clearAllAtomBookmarks
void clearAllAtomBookmarks()
blows out all atomic bookmarks
Definition ROMol.h:594
RDKit::ROMol::operator[]
const Bond * operator[](const edge_descriptor &e) const
Definition ROMol.h:870
RDKit::ROMol::operator[]
Bond * operator[](const edge_descriptor &e)
Definition ROMol.h:869
RDKit::ROMol::getBondWithIdx
Bond * getBondWithIdx(unsigned int idx)
returns a pointer to a particular Bond
RDKit::ROMol::~ROMol
virtual ~ROMol()
Definition ROMol.h:500
RDKit::ROMol::beginConformers
ConformerIterator beginConformers()
Definition ROMol.h:829
RDKit::ROMol::endBonds
ConstBondIterator endBonds() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::getNumAtoms
unsigned int getNumAtoms(bool onlyExplicit) const
RDKit::ROMol::ROMol
ROMol()
Definition ROMol.h:408
RDKit::ROMol::endHeteros
HeteroatomIterator endHeteros()
get an AtomIterator pointing at the end of our Atoms
RDKit::ROMol::ROMol
ROMol(ROMol &&o) noexcept
Definition ROMol.h:432
RDKit::ROMol::getBondBetweenAtoms
Bond * getBondBetweenAtoms(const U idx1, const V idx2)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ROMol.h:556
RDKit::ROMol::beginConformers
ConstConformerIterator beginConformers() const
Definition ROMol.h:833
RDKit::ROMol::clearBondBookmark
void clearBondBookmark(int mark, const Bond *bond)
removes a particular Bond from the list associated with the bookmark
RDKit::ROMol::beginMatchingAtoms
MatchingAtomIterator beginMatchingAtoms(bool(*query)(Atom *))
get an AtomIterator pointing at our first Atom that matches query
RDKit::ROMol::getTopology
MolGraph const & getTopology() const
brief returns a pointer to our underlying BGL object
Definition ROMol.h:766
RDKit::ROMol::hasBondBookmark
bool hasBondBookmark(int mark) const
queries whether or not any bonds are associated with a bookmark
Definition ROMol.h:619
RDKit::ROMol::getBondWithIdx
const Bond * getBondWithIdx(unsigned int idx) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::beginAtoms
AtomIterator beginAtoms()
get an AtomIterator pointing at our first Atom
RDKit::ROMol::getAtomWithIdx
const Atom * getAtomWithIdx(unsigned int idx) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::removeConformer
void removeConformer(unsigned int id)
Delete the conformation with the specified ID.
RDKit::ROMol::beginAromaticAtoms
AromaticAtomIterator beginAromaticAtoms()
get an AtomIterator pointing at our first aromatic Atom
RDKit::ROMol::operator[]
Atom * operator[](const vertex_descriptor &v)
Definition ROMol.h:864
RDKit::ROMol::beginHeteros
ConstHeteroatomIterator beginHeteros() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::endConformers
ConformerIterator endConformers()
Definition ROMol.h:831
RDKit::ROMol::getVertices
ATOM_ITER_PAIR getVertices() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
RDKit::ROMol::getSubstanceGroups
friend RDKIT_GRAPHMOL_EXPORT const std::vector< SubstanceGroup > & getSubstanceGroups(const ROMol &)
RDKit::ROMol::clearBondBookmark
void clearBondBookmark(int mark)
removes a bookmark from our collection
RDKit::ROMol::beginHeteros
HeteroatomIterator beginHeteros()
get an AtomIterator pointing at our first hetero Atom
RDKit::ROMol::getBondBetweenAtoms
Bond * getBondBetweenAtoms(unsigned int idx1, unsigned int idx2)
returns a pointer to the bond between two atoms, Null on failure
RDKit::ROMol::bonds
CXXBondIterator< const MolGraph, Bond *const > bonds() const
Definition ROMol.h:404
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
RDKit::RingInfo
Definition RingInfo.h:38
RDKit::SubstanceGroup
The class for representing SubstanceGroups.
Definition SubstanceGroup.h:54
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:257
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::MOL_VECT
std::vector< ROMol > MOL_VECT
Definition ROMol.h:963
RDKit::MOL_PTR_VECT_CI
MOL_PTR_VECT::const_iterator MOL_PTR_VECT_CI
Definition ROMol.h:968
RDKit::ci_RIGHTMOST_ATOM
RDKIT_GRAPHMOL_EXPORT const int ci_RIGHTMOST_ATOM
RDKit::ci_ATOM_HOLDER
RDKIT_GRAPHMOL_EXPORT const int ci_ATOM_HOLDER
RDKit::MOL_PTR_VECT
std::vector< ROMol * > MOL_PTR_VECT
Definition ROMol.h:965
RDKit::ROMOL_SPTR
boost::shared_ptr< ROMol > ROMOL_SPTR
Definition ChemTransforms.h:23
RDKit::MOL_PTR_VECT_I
MOL_PTR_VECT::iterator MOL_PTR_VECT_I
Definition ROMol.h:969
RDKit::MolGraph
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, Atom *, Bond * > MolGraph
This is the BGL type used to store the topology:
Definition ROMol.h:57
RDKit::MOL_SPTR_VECT
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
Definition FragCatParams.h:21
RDKit::ci_LEADING_BOND
RDKIT_GRAPHMOL_EXPORT const int ci_LEADING_BOND
RDKit::CXXAtomIterator::CXXAtomIter
Definition ROMol.h:121
RDKit::CXXAtomIterator::CXXAtomIter::const_reference
Vertex const & const_reference
Definition ROMol.h:127
RDKit::CXXAtomIterator::CXXAtomIter::difference_type
std::ptrdiff_t difference_type
Definition ROMol.h:123
RDKit::CXXAtomIterator::CXXAtomIter::pointer
Vertex * pointer
Definition ROMol.h:125
RDKit::CXXAtomIterator::CXXAtomIter::CXXAtomIter
CXXAtomIter()
Definition ROMol.h:132
RDKit::CXXAtomIterator::CXXAtomIter::operator!=
bool operator!=(const CXXAtomIter &other) const
Definition ROMol.h:188
RDKit::CXXAtomIterator::CXXAtomIter::operator<
bool operator<(const CXXAtomIter &other) const
Definition ROMol.h:191
RDKit::CXXAtomIterator::CXXAtomIter::graph
Graph * graph
Definition ROMol.h:129
RDKit::CXXAtomIterator::CXXAtomIter::operator+=
CXXAtomIter & operator+=(difference_type n)
Definition ROMol.h:170
RDKit::CXXAtomIterator::CXXAtomIter::operator++
CXXAtomIter & operator++()
Definition ROMol.h:145
RDKit::CXXAtomIterator::CXXAtomIter::operator--
CXXAtomIter operator--(int)
Definition ROMol.h:165
RDKit::CXXAtomIterator::CXXAtomIter::operator-
CXXAtomIter operator-(difference_type n) const
Definition ROMol.h:161
RDKit::CXXAtomIterator::CXXAtomIter::operator+
CXXAtomIter operator+(difference_type n) const
Definition ROMol.h:158
RDKit::CXXAtomIterator::CXXAtomIter::iterator_category
std::random_access_iterator_tag iterator_category
Definition ROMol.h:122
RDKit::CXXAtomIterator::CXXAtomIter::operator>=
bool operator>=(const CXXAtomIter &other) const
Definition ROMol.h:194
RDKit::CXXAtomIterator::CXXAtomIter::operator+
friend CXXAtomIter operator+(difference_type n, const CXXAtomIter &it)
Definition ROMol.h:181
RDKit::CXXAtomIterator::CXXAtomIter::value_type
Vertex value_type
Definition ROMol.h:124
RDKit::CXXAtomIterator::CXXAtomIter::reference
Vertex & reference
Definition ROMol.h:126
RDKit::CXXAtomIterator::CXXAtomIter::operator-=
CXXAtomIter & operator-=(difference_type n)
Definition ROMol.h:174
RDKit::CXXAtomIterator::CXXAtomIter::operator*
const_reference operator*() const
Definition ROMol.h:138
RDKit::CXXAtomIterator::CXXAtomIter::operator--
CXXAtomIter & operator--()
Definition ROMol.h:154
RDKit::CXXAtomIterator::CXXAtomIter::operator++
CXXAtomIter operator++(int)
Definition ROMol.h:149
RDKit::CXXAtomIterator::CXXAtomIter::operator-
difference_type operator-(const CXXAtomIter &other) const
Definition ROMol.h:178
RDKit::CXXAtomIterator::CXXAtomIter::operator==
bool operator==(const CXXAtomIter &other) const
Definition ROMol.h:185
RDKit::CXXAtomIterator::CXXAtomIter::CXXAtomIter
CXXAtomIter(Graph *graph, Iterator pos)
Definition ROMol.h:134
RDKit::CXXAtomIterator::CXXAtomIter::operator<=
bool operator<=(const CXXAtomIter &other) const
Definition ROMol.h:192
RDKit::CXXAtomIterator::CXXAtomIter::operator>
bool operator>(const CXXAtomIter &other) const
Definition ROMol.h:193
RDKit::CXXAtomIterator::CXXAtomIter::pos
Iterator pos
Definition ROMol.h:130
RDKit::CXXAtomIterator::CXXAtomIter::operator[]
const_reference operator[](difference_type n) const
Definition ROMol.h:141
RDKit::CXXAtomIterator
Definition ROMol.h:117
RDKit::CXXAtomIterator::graph
Graph * graph
Definition ROMol.h:118
RDKit::CXXAtomIterator::vstart
Iterator vstart
Definition ROMol.h:119
RDKit::CXXAtomIterator::vend
Iterator vend
Definition ROMol.h:119
RDKit::CXXAtomIterator::end
CXXAtomIter end()
Definition ROMol.h:203
RDKit::CXXAtomIterator::CXXAtomIterator
CXXAtomIterator(Graph *graph, Iterator start, Iterator end)
Definition ROMol.h:200
RDKit::CXXAtomIterator::CXXAtomIterator
CXXAtomIterator(Graph *graph)
Definition ROMol.h:197
RDKit::CXXAtomIterator::size
size_t size() const
Definition ROMol.h:204
RDKit::CXXAtomIterator::begin
CXXAtomIter begin()
Definition ROMol.h:202
RDKit::CXXBondIterator::CXXBondIter
Definition ROMol.h:219
RDKit::CXXBondIterator::CXXBondIter::operator*
const_reference operator*() const
Definition ROMol.h:235
RDKit::CXXBondIterator::CXXBondIter::iterator_category
std::bidirectional_iterator_tag iterator_category
Definition ROMol.h:220
RDKit::CXXBondIterator::CXXBondIter::CXXBondIter
CXXBondIter(Graph *graph, Iterator pos)
Definition ROMol.h:232
RDKit::CXXBondIterator::CXXBondIter::operator==
bool operator==(const CXXBondIter &other) const
Definition ROMol.h:254
RDKit::CXXBondIterator::CXXBondIter::graph
Graph * graph
Definition ROMol.h:227
RDKit::CXXBondIterator::CXXBondIter::const_reference
Edge const & const_reference
Definition ROMol.h:225
RDKit::CXXBondIterator::CXXBondIter::operator--
CXXBondIter & operator--()
Definition ROMol.h:245
RDKit::CXXBondIterator::CXXBondIter::operator!=
bool operator!=(const CXXBondIter &other) const
Definition ROMol.h:257
RDKit::CXXBondIterator::CXXBondIter::difference_type
std::ptrdiff_t difference_type
Definition ROMol.h:221
RDKit::CXXBondIterator::CXXBondIter::pointer
Edge * pointer
Definition ROMol.h:223
RDKit::CXXBondIterator::CXXBondIter::CXXBondIter
CXXBondIter()
Definition ROMol.h:230
RDKit::CXXBondIterator::CXXBondIter::operator++
CXXBondIter & operator++()
Definition ROMol.h:236
RDKit::CXXBondIterator::CXXBondIter::pos
Iterator pos
Definition ROMol.h:228
RDKit::CXXBondIterator::CXXBondIter::value_type
Edge value_type
Definition ROMol.h:222
RDKit::CXXBondIterator::CXXBondIter::operator--
CXXBondIter operator--(int)
Definition ROMol.h:249
RDKit::CXXBondIterator::CXXBondIter::operator++
CXXBondIter operator++(int)
Definition ROMol.h:240
RDKit::CXXBondIterator::CXXBondIter::reference
Edge & reference
Definition ROMol.h:224
RDKit::CXXBondIterator
Definition ROMol.h:215
RDKit::CXXBondIterator::graph
Graph * graph
Definition ROMol.h:216
RDKit::CXXBondIterator::begin
CXXBondIter begin()
Definition ROMol.h:269
RDKit::CXXBondIterator::vstart
Iterator vstart
Definition ROMol.h:217
RDKit::CXXBondIterator::size
size_t size() const
Definition ROMol.h:271
RDKit::CXXBondIterator::vend
Iterator vend
Definition ROMol.h:217
RDKit::CXXBondIterator::CXXBondIterator
CXXBondIterator(Graph *graph)
Definition ROMol.h:262
RDKit::CXXBondIterator::CXXBondIterator
CXXBondIterator(Graph *graph, Iterator start, Iterator end)
Definition ROMol.h:267
RDKit::CXXBondIterator::end
CXXBondIter end()
Definition ROMol.h:270
types.h