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