RDKit: ROMol.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
ROMol.h
Go to the documentation of this file.
1//
2// Copyright (C) 2003-2022 Greg Landrum and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10/*! \file ROMol.h
11
12 \brief Defines the primary molecule class \c ROMol as well as associated
13 typedefs
14
15*/
16
17#include <RDGeneral/export.h>
18#ifndef RD_ROMOL_H
19#define RD_ROMOL_H
20
21/// Std stuff
22#include <cstddef>
23#include <iterator>
24#include <utility>
25#include <map>
26
27// boost stuff
28#include <RDGeneral/BoostStartInclude.h>
29#include <boost/graph/adjacency_list.hpp>
30#include <boost/smart_ptr.hpp>
31#include <boost/dynamic_bitset.hpp>
32
33#ifdef RDK_USE_BOOST_SERIALIZATION
34#include <boost/serialization/split_member.hpp>
35#endif
36#include <RDGeneral/BoostEndInclude.h>
37
38// our stuff
39#include <RDGeneral/types.h>
40#include <RDGeneral/RDProps.h>
41#include "Atom.h"
42#include "Bond.h"
43#include "Conformer.h"
44#include "SubstanceGroup.h"
45#include "StereoGroup.h"
46#include "RingInfo.h"
47
48namespace RDKit {
49class SubstanceGroup;
50class Atom;
51class Bond;
52//! This is the BGL type used to store the topology:
53typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
54 Atom *, Bond *>
55 MolGraph;
56class MolPickler;
57class RWMol;
58class QueryAtom;
59class QueryBond;
60class RingInfo;
61
62template <class T1, class T2>
63class AtomIterator_;
64class BondIterator_;
65class ConstBondIterator_;
66
67template <class T1, class T2>
68class AromaticAtomIterator_;
69template <class T1, class T2>
70class HeteroatomIterator_;
71template <class T1, class T2>
72class QueryAtomIterator_;
73template <class T1, class T2>
74class MatchingAtomIterator_;
75
76 RDKIT_GRAPHMOL_EXPORT extern const int ci_RIGHTMOST_ATOM;
77 RDKIT_GRAPHMOL_EXPORT extern const int ci_LEADING_BOND;
78 RDKIT_GRAPHMOL_EXPORT extern const int ci_ATOM_HOLDER;
79
80//! ROMol is a molecule class that is intended to have a fixed topology
81/*!
82 This is the primary class for most molecule operations.
83
84 If you need to be manipulating the molecule (e.g. adding or deleting
85 atoms or bonds, use an RWMol instead.
86
87 <b>Notes:</b>
88 - each ROMol maintains a Dict of \c properties:
89 - Each \c property is keyed by name and can store an
90 arbitrary type.
91 - \c Properties can be marked as \c calculated, in which case
92 they will be cleared when the \c clearComputedProps() method
93 is called.
94 - Because they have no impact upon chemistry, all \c property
95 operations are \c const, this allows extra flexibility for
96 clients who need to store extra data on ROMol objects.
97
98 - each ROMol has collections of \c bookmarks for Atoms and Bonds:
99 - the Atom bookmarks and Bond bookmarks are stored separately
100 from each other
101 - each \c bookmark, an integer, can map to more than one
102 Atom or Bond
103 - these are currently used in molecule construction, but
104 could also be useful for reaction mapping and the like
105
106 - information about rings (SSSR and the like) is stored in the
107 molecule's RingInfo pointer.
108
109 */
110
111//! \name C++11 Iterators
112
113template <class Graph, class Vertex,
114 class Iterator = typename Graph::vertex_iterator>
115 struct CXXAtomIterator {
116 Graph *graph;
117 Iterator vstart, vend;
118
119 struct CXXAtomIter {
120 using iterator_category = std::forward_iterator_tag;
121 using difference_type = std::ptrdiff_t;
122 using value_type = Vertex;
123 using pointer = Vertex *;
124 using reference = Vertex &;
125
126 Graph *graph;
127 Iterator pos;
128 Atom *current;
129
130 CXXAtomIter(Graph *graph, Iterator pos)
131 : graph(graph), pos(pos), current(nullptr) {}
132
133 reference operator*() {
134 current = (*graph)[*pos];
135 return current;
136 }
137 CXXAtomIter &operator++() {
138 ++pos;
139 return *this;
140 }
141 bool operator==(const CXXAtomIter &it) const { return pos == it.pos; }
142 bool operator!=(const CXXAtomIter &it) const { return pos != it.pos; }
143 };
144
145 CXXAtomIterator(Graph *graph) : graph(graph) {
146 auto vs = boost::vertices(*graph);
147 vstart = vs.first;
148 vend = vs.second;
149 }
150 CXXAtomIterator(Graph *graph, Iterator start, Iterator end)
151 : graph(graph), vstart(start), vend(end) {};
152 CXXAtomIter begin() { return {graph, vstart}; }
153 CXXAtomIter end() { return {graph, vend}; }
154};
155
156template <class Graph, class Edge,
157 class Iterator = typename Graph::edge_iterator>
158 struct CXXBondIterator {
159 Graph *graph;
160 Iterator vstart, vend;
161
162 struct CXXBondIter {
163 using iterator_category = std::forward_iterator_tag;
164 using difference_type = std::ptrdiff_t;
165 using value_type = Edge;
166 using pointer = Edge *;
167 using reference = Edge &;
168
169 Graph *graph;
170 Iterator pos;
171 Bond *current;
172
173 CXXBondIter(Graph *graph, Iterator pos)
174 : graph(graph), pos(pos), current(nullptr) {}
175
176 reference operator*() {
177 current = (*graph)[*pos];
178 return current;
179 }
180 CXXBondIter &operator++() {
181 ++pos;
182 return *this;
183 }
184 bool operator==(const CXXBondIter &it) const { return pos == it.pos; }
185 bool operator!=(const CXXBondIter &it) const { return pos != it.pos; }
186 };
187
188 CXXBondIterator(Graph *graph) : graph(graph) {
189 auto vs = boost::edges(*graph);
190 vstart = vs.first;
191 vend = vs.second;
192 }
193 CXXBondIterator(Graph *graph, Iterator start, Iterator end)
194 : graph(graph), vstart(start), vend(end) {};
195 CXXBondIter begin() { return {graph, vstart}; }
196 CXXBondIter end() { return {graph, vend}; }
197};
198
199 class RDKIT_GRAPHMOL_EXPORT ROMol : public RDProps {
200 public:
201 friend class MolPickler;
202 friend class RWMol;
203
204 //! \cond TYPEDEFS
205
206 //! \name typedefs
207 //! @{
208 typedef MolGraph::vertex_descriptor vertex_descriptor;
209 typedef MolGraph::edge_descriptor edge_descriptor;
210
211 typedef MolGraph::edge_iterator EDGE_ITER;
212 typedef MolGraph::out_edge_iterator OEDGE_ITER;
213 typedef MolGraph::vertex_iterator VERTEX_ITER;
214 typedef MolGraph::adjacency_iterator ADJ_ITER;
215 typedef std::pair<EDGE_ITER, EDGE_ITER> BOND_ITER_PAIR;
216 typedef std::pair<OEDGE_ITER, OEDGE_ITER> OBOND_ITER_PAIR;
217 typedef std::pair<VERTEX_ITER, VERTEX_ITER> ATOM_ITER_PAIR;
218 typedef std::pair<ADJ_ITER, ADJ_ITER> ADJ_ITER_PAIR;
219
220 typedef std::vector<Atom *> ATOM_PTR_VECT;
221 typedef ATOM_PTR_VECT::iterator ATOM_PTR_VECT_I;
222 typedef ATOM_PTR_VECT::const_iterator ATOM_PTR_VECT_CI;
223 typedef std::vector<Bond *> BOND_PTR_VECT;
224 typedef BOND_PTR_VECT::iterator BOND_PTR_VECT_I;
225 typedef BOND_PTR_VECT::const_iterator BOND_PTR_VECT_CI;
226
227 typedef std::list<Atom *> ATOM_PTR_LIST;
228 typedef ATOM_PTR_LIST::iterator ATOM_PTR_LIST_I;
229 typedef ATOM_PTR_LIST::const_iterator ATOM_PTR_LIST_CI;
230 typedef std::list<Bond *> BOND_PTR_LIST;
231 typedef BOND_PTR_LIST::iterator BOND_PTR_LIST_I;
232 typedef BOND_PTR_LIST::const_iterator BOND_PTR_LIST_CI;
233
234 // list of conformations
235 typedef std::list<CONFORMER_SPTR> CONF_SPTR_LIST;
236 typedef CONF_SPTR_LIST::iterator CONF_SPTR_LIST_I;
237 typedef CONF_SPTR_LIST::const_iterator CONF_SPTR_LIST_CI;
238 typedef std::pair<CONF_SPTR_LIST_I, CONF_SPTR_LIST_I> CONFS_I_PAIR;
239
240 // ROFIX: these will need to be readonly somehow?
241 typedef std::map<int, ATOM_PTR_LIST> ATOM_BOOKMARK_MAP;
242 typedef std::map<int, BOND_PTR_LIST> BOND_BOOKMARK_MAP;
243
244 typedef class AtomIterator_<Atom, ROMol> AtomIterator;
245 typedef class AtomIterator_<const Atom, const ROMol> ConstAtomIterator;
246 typedef class BondIterator_ BondIterator;
247 typedef class ConstBondIterator_ ConstBondIterator;
248 typedef class AromaticAtomIterator_<Atom, ROMol> AromaticAtomIterator;
249 typedef class AromaticAtomIterator_<const Atom, const ROMol>
250 ConstAromaticAtomIterator;
251 typedef class HeteroatomIterator_<Atom, ROMol> HeteroatomIterator;
252 typedef class HeteroatomIterator_<const Atom, const ROMol>
253 ConstHeteroatomIterator;
254 typedef class QueryAtomIterator_<Atom, ROMol> QueryAtomIterator;
255 typedef class QueryAtomIterator_<const Atom, const ROMol>
256 ConstQueryAtomIterator;
257 typedef class MatchingAtomIterator_<Atom, ROMol> MatchingAtomIterator;
258 typedef class MatchingAtomIterator_<const Atom, const ROMol>
259 ConstMatchingAtomIterator;
260
261 typedef CONF_SPTR_LIST_I ConformerIterator;
262 typedef CONF_SPTR_LIST_CI ConstConformerIterator;
263
264 //! @}
265 //! \endcond
266
267 //! C++11 Range iterator
268 /*!
269 <b>Usage</b>
270 \code
271 for(auto atom : mol.atoms()) {
272 atom->getIdx();
273 };
274 \endcode
275 */
276
277 CXXAtomIterator<MolGraph, Atom *> atoms() { return {&d_graph}; }
278
279 CXXAtomIterator<const MolGraph, Atom *const> atoms() const {
280 return {&d_graph};
281 }
282
283 CXXAtomIterator<const MolGraph, Atom *const, MolGraph::adjacency_iterator>
284 atomNeighbors(Atom const *at) const {
285 auto pr = getAtomNeighbors(at);
286 return {&d_graph, pr.first, pr.second};
287 }
288
289 CXXAtomIterator<MolGraph, Atom *, MolGraph::adjacency_iterator> atomNeighbors(
290 Atom const *at) {
291 auto pr = getAtomNeighbors(at);
292 return {&d_graph, pr.first, pr.second};
293 }
294
295 CXXBondIterator<const MolGraph, Bond *const, MolGraph::out_edge_iterator>
296 atomBonds(Atom const *at) const {
297 auto pr = getAtomBonds(at);
298 return {&d_graph, pr.first, pr.second};
299 }
300
301 CXXBondIterator<MolGraph, Bond *, MolGraph::out_edge_iterator> atomBonds(
302 Atom const *at) {
303 auto pr = getAtomBonds(at);
304 return {&d_graph, pr.first, pr.second};
305 }
306
307 /*!
308 <b>Usage</b>
309 \code
310 for(auto bond : mol.bonds()) {
311 bond->getIdx();
312 };
313 \endcode
314 */
315
316 CXXBondIterator<MolGraph, Bond *> bonds() { return {&d_graph}; }
317
318 CXXBondIterator<const MolGraph, Bond *const> bonds() const {
319 return {&d_graph};
320 }
321
322 ROMol() : RDProps() { initMol(); }
323
324 //! copy constructor with a twist
325 /*!
326 \param other the molecule to be copied
327 \param quickCopy (optional) if this is true, the resulting ROMol will not
328 copy any of the properties or bookmarks and conformers from \c other.
329 This can
330 make the copy substantially faster (thus the name).
331 \param confId (optional) if this is >=0, the resulting ROMol will contain
332 only
333 the specified conformer from \c other.
334 */
335 ROMol(const ROMol &other, bool quickCopy = false, int confId = -1)
336 : RDProps() {
337 dp_ringInfo = nullptr;
338 initFromOther(other, quickCopy, confId);
339 numBonds = rdcast<unsigned int>(boost::num_edges(d_graph));
340 }
341 //! construct a molecule from a pickle string
342 ROMol(const std::string &binStr);
343 //! construct a molecule from a pickle string
344 ROMol(const std::string &binStr, unsigned int propertyFlags);
345
346 ROMol(ROMol &&o) noexcept
347 : RDProps(std::move(o)),
348 d_graph(std::move(o.d_graph)),
349 d_atomBookmarks(std::move(o.d_atomBookmarks)),
350 d_bondBookmarks(std::move(o.d_bondBookmarks)),
351 d_confs(std::move(o.d_confs)),
352 d_sgroups(std::move(o.d_sgroups)),
353 d_stereo_groups(std::move(o.d_stereo_groups)),
354 numBonds(o.numBonds) {
355 for (auto atom : atoms()) {
356 atom->setOwningMol(this);
357 }
358 for (auto bond : bonds()) {
359 bond->setOwningMol(this);
360 }
361 for (auto conf : d_confs) {
362 conf->setOwningMol(this);
363 }
364 for (auto &sg : d_sgroups) {
365 sg.setOwningMol(this);
366 }
367 o.d_graph.clear();
368 o.numBonds = 0;
369 dp_ringInfo = std::exchange(o.dp_ringInfo, nullptr);
370 dp_delAtoms = std::exchange(o.dp_delAtoms, nullptr);
371 dp_delBonds = std::exchange(o.dp_delBonds, nullptr);
372 }
373 ROMol &operator=(ROMol &&o) noexcept {
374 if (this == &o) {
375 return *this;
376 }
377 RDProps::operator=(std::move(o));
378 d_graph = std::move(o.d_graph);
379 d_atomBookmarks = std::move(o.d_atomBookmarks);
380 d_bondBookmarks = std::move(o.d_bondBookmarks);
381 if (dp_ringInfo) {
382 delete dp_ringInfo;
383 }
384 dp_ringInfo = std::exchange(o.dp_ringInfo, nullptr);
385
386 d_confs = std::move(o.d_confs);
387 d_sgroups = std::move(o.d_sgroups);
388 d_stereo_groups = std::move(o.d_stereo_groups);
389 dp_delAtoms = std::exchange(o.dp_delAtoms, nullptr);
390 dp_delBonds = std::exchange(o.dp_delBonds, nullptr);
391 numBonds = o.numBonds;
392 o.numBonds = 0;
393
394 for (auto atom : atoms()) {
395 atom->setOwningMol(this);
396 }
397 for (auto bond : bonds()) {
398 bond->setOwningMol(this);
399 }
400 for (auto conf : d_confs) {
401 conf->setOwningMol(this);
402 }
403 for (auto &sg : d_sgroups) {
404 sg.setOwningMol(this);
405 }
406
407 o.d_graph.clear();
408 return *this;
409 }
410
411 ROMol &operator=(const ROMol &) =
412 delete; // disable assignment, RWMol's support assignment
413
414 virtual ~ROMol() { destroy(); }
415
416 //! @}
417 //! \name Atoms
418 //! @{
419
420 //! returns our number of atoms
421 inline unsigned int getNumAtoms() const {
422 return rdcast<unsigned int>(boost::num_vertices(d_graph));
423 }
424 unsigned int getNumAtoms(bool onlyExplicit) const;
425 //! returns our number of heavy atoms (atomic number > 1)
426 unsigned int getNumHeavyAtoms() const;
427 //! returns a pointer to a particular Atom
428 Atom *getAtomWithIdx(unsigned int idx);
429 //! \overload
430 const Atom *getAtomWithIdx(unsigned int idx) const;
431 //! \overload
432 template <class U>
433 Atom *getAtomWithIdx(const U idx) {
434 return getAtomWithIdx(rdcast<unsigned int>(idx));
435 }
436 //! \overload
437 template <class U>
438 const Atom *getAtomWithIdx(const U idx) const {
439 return getAtomWithIdx(rdcast<unsigned int>(idx));
440 }
441 //! returns the degree (number of neighbors) of an Atom in the graph
442 unsigned int getAtomDegree(const Atom *at) const;
443 //! @}
444
445 //! \name Bonds
446 //! @{
447
448 //! returns our number of Bonds
449 unsigned int getNumBonds(bool onlyHeavy = 1) const;
450 //! returns a pointer to a particular Bond
451 Bond *getBondWithIdx(unsigned int idx);
452 //! \overload
453 const Bond *getBondWithIdx(unsigned int idx) const;
454 //! \overload
455 template <class U>
456 Bond *getBondWithIdx(const U idx) {
457 return getBondWithIdx(rdcast<unsigned int>(idx));
458 }
459 //! \overload
460 template <class U>
461 const Bond *getBondWithIdx(const U idx) const {
462 return getBondWithIdx(rdcast<unsigned int>(idx));
463 }
464 //! returns a pointer to the bond between two atoms, Null on failure
465 Bond *getBondBetweenAtoms(unsigned int idx1, unsigned int idx2);
466 //! \overload
467 const Bond *getBondBetweenAtoms(unsigned int idx1, unsigned int idx2) const;
468 //! \overload
469 template <class U, class V>
470 Bond *getBondBetweenAtoms(const U idx1, const V idx2) {
471 return getBondBetweenAtoms(rdcast<unsigned int>(idx1),
472 rdcast<unsigned int>(idx2));
473 }
474 //! \overload
475 template <class U, class V>
476 const Bond *getBondBetweenAtoms(const U idx1, const V idx2) const {
477 return getBondBetweenAtoms(rdcast<unsigned int>(idx1),
478 rdcast<unsigned int>(idx2));
479 }
480
481 //! @}
482
483 //! \name Bookmarks
484 //! @{
485
486 //! associates an Atom pointer with a bookmark
487 void setAtomBookmark(Atom *at, int mark) {
488 d_atomBookmarks[mark].push_back(at);
489 }
490 //! associates an Atom pointer with a bookmark
491 void replaceAtomBookmark(Atom *at, int mark) {
492 d_atomBookmarks[mark].clear();
493 d_atomBookmarks[mark].push_back(at);
494 }
495 //! returns the first Atom associated with the \c bookmark provided
496 Atom *getAtomWithBookmark(int mark);
497 //! returns the Atom associated with the \c bookmark provided
498 //! a check is made to ensure it is the only atom with that bookmark
499 Atom *getUniqueAtomWithBookmark(int mark);
500 //! returns all Atoms associated with the \c bookmark provided
501 ATOM_PTR_LIST &getAllAtomsWithBookmark(int mark);
502 //! removes a \c bookmark from our collection
503 void clearAtomBookmark(int mark);
504 //! removes a particular Atom from the list associated with the \c bookmark
505 void clearAtomBookmark(int mark, const Atom *atom);
506
507 //! blows out all atomic \c bookmarks
508 void clearAllAtomBookmarks() { d_atomBookmarks.clear(); }
509 //! queries whether or not any atoms are associated with a \c bookmark
510 bool hasAtomBookmark(int mark) const { return d_atomBookmarks.count(mark); }
511 //! returns a pointer to all of our atom \c bookmarks
512 ATOM_BOOKMARK_MAP *getAtomBookmarks() { return &d_atomBookmarks; }
513
514 //! associates a Bond pointer with a bookmark
515 void setBondBookmark(Bond *bond, int mark) {
516 d_bondBookmarks[mark].push_back(bond);
517 }
518 //! returns the first Bond associated with the \c bookmark provided
519 Bond *getBondWithBookmark(int mark);
520 //! returns the Bond associated with the \c bookmark provided
521 //! a check is made to ensure it is the only bond with that bookmark
522 Bond *getUniqueBondWithBookmark(int mark);
523 //! returns all bonds associated with the \c bookmark provided
524 BOND_PTR_LIST &getAllBondsWithBookmark(int mark);
525 //! removes a \c bookmark from our collection
526 void clearBondBookmark(int mark);
527 //! removes a particular Bond from the list associated with the \c bookmark
528 void clearBondBookmark(int mark, const Bond *bond);
529
530 //! blows out all bond \c bookmarks
531 void clearAllBondBookmarks() { d_bondBookmarks.clear(); }
532 //! queries whether or not any bonds are associated with a \c bookmark
533 bool hasBondBookmark(int mark) const { return d_bondBookmarks.count(mark); }
534 //! returns a pointer to all of our bond \c bookmarks
535 BOND_BOOKMARK_MAP *getBondBookmarks() { return &d_bondBookmarks; }
536
537 //! @}
538
539 //! \name Conformers
540 //! @{
541
542 //! return the conformer with a specified ID
543 //! if the ID is negative the first conformation will be returned
544 const Conformer &getConformer(int id = -1) const;
545
546 //! return the conformer with a specified ID
547 //! if the ID is negative the first conformation will be returned
548 Conformer &getConformer(int id = -1);
549
550 //! Delete the conformation with the specified ID
551 void removeConformer(unsigned int id);
552
553 //! Clear all the conformations on the molecule
554 void clearConformers() { d_confs.clear(); }
555
556 //! Add a new conformation to the molecule
557 /*!
558 \param conf - conformation to be added to the molecule, this molecule takes
559 ownership
560 of the conformer
561 \param assignId - a unique ID will be assigned to the conformation if
562 true
563 otherwise it is assumed that the conformation already has
564 an (unique) ID set
565 */
566 unsigned int addConformer(Conformer *conf, bool assignId = false);
567
568 inline unsigned int getNumConformers() const {
569 return rdcast<unsigned int>(d_confs.size());
570 }
571
572 //! \name Topology
573 //! @{
574
575 //! returns a pointer to our RingInfo structure
576 //! <b>Note:</b> the client should not delete this.
577 RingInfo *getRingInfo() const { return dp_ringInfo; }
578
579 //! provides access to all neighbors around an Atom
580 /*!
581 \param at the atom whose neighbors we are looking for
582
583 <b>Usage</b>
584 \code
585 ... mol is a const ROMol & ...
586 ... atomPtr is a const Atom * ...
587 ... requires #include <boost/range/iterator_range.hpp>
588 for (const auto &nbri :
589 boost::make_iterator_range(m.getAtomNeighbors(atomPtr))) {
590 const auto &nbr = (*m)[nbri];
591 // nbr is an atom pointer
592 }
593
594 \endcode
595
596 */
597 ADJ_ITER_PAIR getAtomNeighbors(Atom const *at) const;
598
599 //! provides access to all Bond objects connected to an Atom
600 /*!
601 \param at the atom whose neighbors we are looking for
602
603 <b>Usage</b>
604 \code
605 ... mol is a const ROMol & ...
606 ... atomPtr is a const Atom * ...
607 ... requires #include <boost/range/iterator_range.hpp>
608 for (const auto &nbri :
609 boost::make_iterator_range(m.getAtomBonds(atomPtr))) {
610 const auto &nbr = (*m)[nbri];
611 // nbr is a bond pointer
612 }
613 \endcode
614 or, if you need a non-const Bond *:
615 \code
616 ... mol is a const ROMol & ...
617 ... atomPtr is a const Atom * ...
618 ... requires #include <boost/range/iterator_range.hpp>
619 for (const auto &nbri :
620 boost::make_iterator_range(m.getAtomBonds(atomPtr))) {
621 auto nbr = (*m)[nbri];
622 // nbr is a bond pointer
623 }
624 \endcode
625
626
627 */
628 OBOND_ITER_PAIR getAtomBonds(Atom const *at) const;
629
630 //! returns an iterator pair for looping over all Atoms
631 /*!
632
633 <b>Usage</b>
634 \code
635
636 ROMol::VERTEX_ITER atBegin,atEnd;
637 boost::tie(atBegin,atEnd) = mol.getVertices();
638 while(atBegin!=atEnd){
639 ATOM_SPTR at2=mol[*atBegin];
640 ... do something with the Atom ...
641 ++atBegin;
642 }
643 \endcode
644 */
645 ATOM_ITER_PAIR getVertices();
646 //! returns an iterator pair for looping over all Bonds
647 /*!
648
649 <b>Usage</b>
650 \code
651
652 ROMol::EDGE_ITER firstB,lastB;
653 boost::tie(firstB,lastB) = mol.getEdges();
654 while(firstB!=lastB){
655 BOND_SPTR bond = mol[*firstB];
656 ... do something with the Bond ...
657 ++firstB;
658 }
659 \endcode
660 */
661 BOND_ITER_PAIR getEdges();
662 //! \overload
663 ATOM_ITER_PAIR getVertices() const;
664 //! \overload
665 BOND_ITER_PAIR getEdges() const;
666
667 //! brief returns a pointer to our underlying BGL object
668 /*!
669 This can be useful if you need to call other BGL algorithms:
670
671 Here's an example:
672 \code
673 ... mol is a const ROMol ...
674 ... mapping is an INT_VECT ...
675 mapping.resize(mol.getNumAtoms());
676 const MolGraph &G_p = mol.getTopology();
677 int res = boost::connected_components(G_p,&mapping[0]);
678 \endcode
679 */
680 MolGraph const &getTopology() const { return d_graph; }
681 //! @}
682
683 //! \name Iterators
684 //! @{
685
686 //! get an AtomIterator pointing at our first Atom
687 AtomIterator beginAtoms();
688 //! \overload
689 ConstAtomIterator beginAtoms() const;
690 //! get an AtomIterator pointing at the end of our Atoms
691 AtomIterator endAtoms();
692 //! \overload
693 ConstAtomIterator endAtoms() const;
694 //! get a BondIterator pointing at our first Bond
695 BondIterator beginBonds();
696 //! \overload
697 ConstBondIterator beginBonds() const;
698 //! get a BondIterator pointing at the end of our Bonds
699 BondIterator endBonds();
700 //! \overload
701 ConstBondIterator endBonds() const;
702
703 //! get an AtomIterator pointing at our first aromatic Atom
704 AromaticAtomIterator beginAromaticAtoms();
705 //! \overload
706 ConstAromaticAtomIterator beginAromaticAtoms() const;
707 //! get an AtomIterator pointing at the end of our Atoms
708 AromaticAtomIterator endAromaticAtoms();
709 //! \overload
710 ConstAromaticAtomIterator endAromaticAtoms() const;
711
712 //! get an AtomIterator pointing at our first hetero Atom
713 HeteroatomIterator beginHeteros();
714 //! \overload
715 ConstHeteroatomIterator beginHeteros() const;
716 //! get an AtomIterator pointing at the end of our Atoms
717 HeteroatomIterator endHeteros();
718 //! \overload
719 ConstHeteroatomIterator endHeteros() const;
720
721 //! if the Mol has any Query atoms or bonds
722 bool hasQuery() const;
723
724 //! get an AtomIterator pointing at our first Atom that matches \c query
725 QueryAtomIterator beginQueryAtoms(QueryAtom const *query);
726 //! \overload
727 ConstQueryAtomIterator beginQueryAtoms(QueryAtom const *) const;
728 //! get an AtomIterator pointing at the end of our Atoms
729 QueryAtomIterator endQueryAtoms();
730 //! \overload
731 ConstQueryAtomIterator endQueryAtoms() const;
732
733 //! get an AtomIterator pointing at our first Atom that matches \c query
734 MatchingAtomIterator beginMatchingAtoms(bool (*query)(Atom *));
735 //! \overload
736 ConstMatchingAtomIterator beginMatchingAtoms(
737 bool (*query)(const Atom *)) const;
738 //! get an AtomIterator pointing at the end of our Atoms
739 MatchingAtomIterator endMatchingAtoms();
740 //! \overload
741 ConstMatchingAtomIterator endMatchingAtoms() const;
742
743 inline ConformerIterator beginConformers() { return d_confs.begin(); }
744
745 inline ConformerIterator endConformers() { return d_confs.end(); }
746
747 inline ConstConformerIterator beginConformers() const {
748 return d_confs.begin();
749 }
750
751 inline ConstConformerIterator endConformers() const { return d_confs.end(); }
752
753 //! @}
754
755 //! \name Properties
756 //! @{
757
758 //! clears all of our \c computed \c properties
759 void clearComputedProps(bool includeRings = true) const;
760 //! calculates any of our lazy \c properties
761 /*!
762 <b>Notes:</b>
763 - this calls \c updatePropertyCache() on each of our Atoms and Bonds
764 */
765 void updatePropertyCache(bool strict = true);
766
767 bool needsUpdatePropertyCache() const;
768 void clearPropertyCache();
769
770 //! @}
771
772 //! \name Misc
773 //! @{
774 //! sends some debugging info to a stream
775 void debugMol(std::ostream &str) const;
776 //! @}
777
778 Atom *operator[](const vertex_descriptor &v) { return d_graph[v]; }
779 const Atom *operator[](const vertex_descriptor &v) const {
780 return d_graph[v];
781 }
782
783 Bond *operator[](const edge_descriptor &e) { return d_graph[e]; }
784 const Bond *operator[](const edge_descriptor &e) const { return d_graph[e]; }
785
786 //! Gets a reference to the groups of atoms with relative stereochemistry
787 /*!
788 Stereo groups are also called enhanced stereochemistry in the SDF/Mol3000
789 file format.
790 */
791 const std::vector<StereoGroup> &getStereoGroups() const {
792 return d_stereo_groups;
793 }
794
795 //! Sets groups of atoms with relative stereochemistry
796 /*!
797 \param stereo_groups the new set of stereo groups. All will be replaced.
798
799 Stereo groups are also called enhanced stereochemistry in the SDF/Mol3000
800 file format. stereo_groups should be std::move()ed into this function.
801 */
802 void setStereoGroups(std::vector<StereoGroup> stereo_groups);
803
804#ifdef RDK_USE_BOOST_SERIALIZATION
805 //! \name boost::serialization support
806 //! @{
807 template <class Archive>
808 void save(Archive &ar, const unsigned int version) const;
809 template <class Archive>
810 void load(Archive &ar, const unsigned int version);
811 BOOST_SERIALIZATION_SPLIT_MEMBER()
812 //! @}
813#endif
814
815 private:
816 MolGraph d_graph;
817 ATOM_BOOKMARK_MAP d_atomBookmarks;
818 BOND_BOOKMARK_MAP d_bondBookmarks;
819 RingInfo *dp_ringInfo = nullptr;
820 CONF_SPTR_LIST d_confs;
821 std::vector<SubstanceGroup> d_sgroups;
822 std::vector<StereoGroup> d_stereo_groups;
823 std::unique_ptr<boost::dynamic_bitset<>> dp_delAtoms = nullptr;
824 std::unique_ptr<boost::dynamic_bitset<>> dp_delBonds = nullptr;
825
826 friend RDKIT_GRAPHMOL_EXPORT std::vector<SubstanceGroup> &getSubstanceGroups(
827 ROMol &);
828 friend RDKIT_GRAPHMOL_EXPORT const std::vector<SubstanceGroup> &
829 getSubstanceGroups(const ROMol &);
830 void clearSubstanceGroups() { d_sgroups.clear(); }
831
832 protected:
833 unsigned int numBonds{0};
834#ifndef WIN32
835 private:
836#endif
837 void initMol();
838 virtual void destroy();
839 //! adds an Atom to our collection
840 /*!
841 \param atom pointer to the Atom to add
842 \param updateLabel (optional) if this is true, the new Atom will be
843 our \c activeAtom
844 \param takeOwnership (optional) if this is true, we take ownership of \c
845 atom
846 instead of copying it.
847
848 \return the index of the new atom
849 */
850 unsigned int addAtom(Atom *atom, bool updateLabel = true,
851 bool takeOwnership = false);
852 //! adds a Bond to our collection
853 /*!
854 \param bond pointer to the Bond to add
855 \param takeOwnership (optional) if this is true, we take ownership of \c
856 bond
857 instead of copying it.
858
859 \return the new number of bonds
860 */
861 unsigned int addBond(Bond *bond, bool takeOwnership = false);
862
863 //! adds a Bond to our collection
864 /*!
865 \param bond pointer to the Bond to add
866
867 \return the new number of bonds
868
869 <b>Note:</b> since this is using a smart pointer, we don't need to worry
870 about
871 issues of ownership.
872 */
873 void initFromOther(const ROMol &other, bool quickCopy, int confId);
874};
875
876 typedef std::vector<ROMol> MOL_VECT;
877typedef boost::shared_ptr<ROMol> ROMOL_SPTR;
878 typedef std::vector<ROMol *> MOL_PTR_VECT;
879typedef std::vector<ROMOL_SPTR> MOL_SPTR_VECT;
880
881 typedef MOL_PTR_VECT::const_iterator MOL_PTR_VECT_CI;
882 typedef MOL_PTR_VECT::iterator MOL_PTR_VECT_I;
883
884}; // namespace RDKit
885#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:24
RDKit::RDProps::RDProps
RDProps()
Definition RDProps.h:22
RDKit::ROMol
Definition ROMol.h:199
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:279
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:568
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:791
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:510
RDKit::ROMol::numBonds
unsigned int numBonds
Definition ROMol.h:833
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:433
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:202
RDKit::ROMol::getNumAtoms
unsigned int getNumAtoms() const
returns our number of atoms
Definition ROMol.h:421
RDKit::ROMol::endConformers
ConstConformerIterator endConformers() const
Definition ROMol.h:751
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:373
RDKit::ROMol::ROMol
ROMol(const ROMol &other, bool quickCopy=false, int confId=-1)
copy constructor with a twist
Definition ROMol.h:335
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:554
RDKit::ROMol::setBondBookmark
void setBondBookmark(Bond *bond, int mark)
associates a Bond pointer with a bookmark
Definition ROMol.h:515
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:277
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:284
RDKit::ROMol::getBondBookmarks
BOND_BOOKMARK_MAP * getBondBookmarks()
returns a pointer to all of our bond bookmarks
Definition ROMol.h:535
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:779
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:531
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:438
RDKit::ROMol::bonds
CXXBondIterator< MolGraph, Bond * > bonds()
Definition ROMol.h:316
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:201
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:461
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:456
RDKit::ROMol::getAtomBookmarks
ATOM_BOOKMARK_MAP * getAtomBookmarks()
returns a pointer to all of our atom bookmarks
Definition ROMol.h:512
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:289
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:476
RDKit::ROMol::setAtomBookmark
void setAtomBookmark(Atom *at, int mark)
associates an Atom pointer with a bookmark
Definition ROMol.h:487
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:491
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:296
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:301
RDKit::ROMol::endAromaticAtoms
AromaticAtomIterator endAromaticAtoms()
get an AtomIterator pointing at the end of our Atoms
RDKit::ROMol::getRingInfo
RingInfo * getRingInfo() const
Definition ROMol.h:577
RDKit::ROMol::clearAllAtomBookmarks
void clearAllAtomBookmarks()
blows out all atomic bookmarks
Definition ROMol.h:508
RDKit::ROMol::operator[]
const Bond * operator[](const edge_descriptor &e) const
Definition ROMol.h:784
RDKit::ROMol::operator[]
Bond * operator[](const edge_descriptor &e)
Definition ROMol.h:783
RDKit::ROMol::getBondWithIdx
Bond * getBondWithIdx(unsigned int idx)
returns a pointer to a particular Bond
RDKit::ROMol::~ROMol
virtual ~ROMol()
Definition ROMol.h:414
RDKit::ROMol::beginConformers
ConformerIterator beginConformers()
Definition ROMol.h:743
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:322
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:346
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:470
RDKit::ROMol::beginConformers
ConstConformerIterator beginConformers() const
Definition ROMol.h:747
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:680
RDKit::ROMol::hasBondBookmark
bool hasBondBookmark(int mark) const
queries whether or not any bonds are associated with a bookmark
Definition ROMol.h:533
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:778
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:745
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:318
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:249
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::MOL_VECT
std::vector< ROMol > MOL_VECT
Definition ROMol.h:876
RDKit::MOL_PTR_VECT_CI
MOL_PTR_VECT::const_iterator MOL_PTR_VECT_CI
Definition ROMol.h:881
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:878
RDKit::ROMOL_SPTR
boost::shared_ptr< ROMol > ROMOL_SPTR
Definition ChemTransforms.h:22
RDKit::MOL_PTR_VECT_I
MOL_PTR_VECT::iterator MOL_PTR_VECT_I
Definition ROMol.h:882
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:55
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:119
RDKit::CXXAtomIterator::CXXAtomIter::current
Atom * current
Definition ROMol.h:128
RDKit::CXXAtomIterator::CXXAtomIter::iterator_category
std::forward_iterator_tag iterator_category
Definition ROMol.h:120
RDKit::CXXAtomIterator::CXXAtomIter::difference_type
std::ptrdiff_t difference_type
Definition ROMol.h:121
RDKit::CXXAtomIterator::CXXAtomIter::pointer
Vertex * pointer
Definition ROMol.h:123
RDKit::CXXAtomIterator::CXXAtomIter::graph
Graph * graph
Definition ROMol.h:126
RDKit::CXXAtomIterator::CXXAtomIter::operator++
CXXAtomIter & operator++()
Definition ROMol.h:137
RDKit::CXXAtomIterator::CXXAtomIter::operator*
reference operator*()
Definition ROMol.h:133
RDKit::CXXAtomIterator::CXXAtomIter::operator==
bool operator==(const CXXAtomIter &it) const
Definition ROMol.h:141
RDKit::CXXAtomIterator::CXXAtomIter::value_type
Vertex value_type
Definition ROMol.h:122
RDKit::CXXAtomIterator::CXXAtomIter::reference
Vertex & reference
Definition ROMol.h:124
RDKit::CXXAtomIterator::CXXAtomIter::CXXAtomIter
CXXAtomIter(Graph *graph, Iterator pos)
Definition ROMol.h:130
RDKit::CXXAtomIterator::CXXAtomIter::pos
Iterator pos
Definition ROMol.h:127
RDKit::CXXAtomIterator::CXXAtomIter::operator!=
bool operator!=(const CXXAtomIter &it) const
Definition ROMol.h:142
RDKit::CXXAtomIterator
Definition ROMol.h:115
RDKit::CXXAtomIterator::graph
Graph * graph
Definition ROMol.h:116
RDKit::CXXAtomIterator::vstart
Iterator vstart
Definition ROMol.h:117
RDKit::CXXAtomIterator::vend
Iterator vend
Definition ROMol.h:117
RDKit::CXXAtomIterator::end
CXXAtomIter end()
Definition ROMol.h:153
RDKit::CXXAtomIterator::CXXAtomIterator
CXXAtomIterator(Graph *graph, Iterator start, Iterator end)
Definition ROMol.h:150
RDKit::CXXAtomIterator::CXXAtomIterator
CXXAtomIterator(Graph *graph)
Definition ROMol.h:145
RDKit::CXXAtomIterator::begin
CXXAtomIter begin()
Definition ROMol.h:152
RDKit::CXXBondIterator::CXXBondIter
Definition ROMol.h:162
RDKit::CXXBondIterator::CXXBondIter::iterator_category
std::forward_iterator_tag iterator_category
Definition ROMol.h:163
RDKit::CXXBondIterator::CXXBondIter::operator*
reference operator*()
Definition ROMol.h:176
RDKit::CXXBondIterator::CXXBondIter::current
Bond * current
Definition ROMol.h:171
RDKit::CXXBondIterator::CXXBondIter::CXXBondIter
CXXBondIter(Graph *graph, Iterator pos)
Definition ROMol.h:173
RDKit::CXXBondIterator::CXXBondIter::graph
Graph * graph
Definition ROMol.h:169
RDKit::CXXBondIterator::CXXBondIter::operator==
bool operator==(const CXXBondIter &it) const
Definition ROMol.h:184
RDKit::CXXBondIterator::CXXBondIter::difference_type
std::ptrdiff_t difference_type
Definition ROMol.h:164
RDKit::CXXBondIterator::CXXBondIter::pointer
Edge * pointer
Definition ROMol.h:166
RDKit::CXXBondIterator::CXXBondIter::operator!=
bool operator!=(const CXXBondIter &it) const
Definition ROMol.h:185
RDKit::CXXBondIterator::CXXBondIter::operator++
CXXBondIter & operator++()
Definition ROMol.h:180
RDKit::CXXBondIterator::CXXBondIter::pos
Iterator pos
Definition ROMol.h:170
RDKit::CXXBondIterator::CXXBondIter::value_type
Edge value_type
Definition ROMol.h:165
RDKit::CXXBondIterator::CXXBondIter::reference
Edge & reference
Definition ROMol.h:167
RDKit::CXXBondIterator
Definition ROMol.h:158
RDKit::CXXBondIterator::graph
Graph * graph
Definition ROMol.h:159
RDKit::CXXBondIterator::begin
CXXBondIter begin()
Definition ROMol.h:195
RDKit::CXXBondIterator::vstart
Iterator vstart
Definition ROMol.h:160
RDKit::CXXBondIterator::vend
Iterator vend
Definition ROMol.h:160
RDKit::CXXBondIterator::CXXBondIterator
CXXBondIterator(Graph *graph)
Definition ROMol.h:188
RDKit::CXXBondIterator::CXXBondIterator
CXXBondIterator(Graph *graph, Iterator start, Iterator end)
Definition ROMol.h:193
RDKit::CXXBondIterator::end
CXXBondIter end()
Definition ROMol.h:196
types.h