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