RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MacroBondInfo.h
Go to the documentation of this file.
1//
2// Copyright (C) 2026 Schrödinger 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 MacroBondInfo.h
11
12 \brief Defines bond-level macro bond information
13
14*/
15#include <RDGeneral/export.h>
16#ifndef RD_MACROBONDINFO_H
17#define RD_MACROBONDINFO_H
18
19#include <cstddef>
20#include <memory>
21#include <vector>
22
23namespace RDKit {
24
25//! Captures bond-level information for macro bonds.
26/*!
27 Macro bond information is owned by a Bond. Since macro molecules may have
28 multiple macro bonds between the same pair of atoms, this stores one entry
29 for each macro-bond connection represented by the owning graph bond.
30 Use this to retrieve macro bond types; the owning graph bond's bond type
31 is not the macro bond type.
32*/
34 public:
35 //! One macro-bond connection in the owning graph bond's orientation.
37 //! The attachment point on the begin atom.
39
40 //! The attachment point on the end atom.
41 int endAttachPt{-1};
42
43 //! Stored as the numeric Bond::BondType value to avoid a Bond.h dependency.
44 unsigned int bondType{0};
45 };
46
47 virtual ~MacroBondInfo() = default;
48
49 MacroBondInfo() = default;
50
51 //! Construct macro bond information with one macro-bond connection.
52 /*!
53 \param beginAttachPt the attachment point on the begin atom
54 \param endAttachPt the attachment point on the end atom
55 \param bondType the numeric Bond::BondType value
56 */
57 MacroBondInfo(int beginAttachPt, int endAttachPt, unsigned int bondType) {
58 addBond(beginAttachPt, endAttachPt, bondType);
59 }
60 MacroBondInfo(const MacroBondInfo &other) = default;
61
62 //! Adds a macro-bond connection.
63 /*!
64 \param beginAttachPt the attachment point on the begin atom
65 \param endAttachPt the attachment point on the end atom
66 \param bondType the numeric Bond::BondType value
67 */
68 void addBond(int beginAttachPt, int endAttachPt, unsigned int bondType) {
69 d_bonds.push_back({beginAttachPt, endAttachPt, bondType});
70 }
71
72 //! Returns the number of macro-bond connections.
73 std::size_t getNumBonds() const { return d_bonds.size(); }
74
75 //! Returns a macro-bond connection by index.
76 /*!
77 \param idx the index of the macro-bond connection
78
79 \return the requested macro-bond connection
80 */
81 const BondInfo &getBond(unsigned int idx) const { return d_bonds.at(idx); }
82
83 //! Returns all macro-bond connections.
84 const std::vector<BondInfo> &getBonds() const { return d_bonds; }
85
86 //! Returns a copy of this macro bond information.
87 virtual std::unique_ptr<MacroBondInfo> copy() const {
88 return std::make_unique<MacroBondInfo>(*this);
89 }
90
91 private:
92 std::vector<BondInfo> d_bonds;
93};
94} // namespace RDKit
95
96#endif
const std::vector< BondInfo > & getBonds() const
Returns all macro-bond connections.
std::size_t getNumBonds() const
Returns the number of macro-bond connections.
MacroBondInfo(const MacroBondInfo &other)=default
MacroBondInfo(int beginAttachPt, int endAttachPt, unsigned int bondType)
Construct macro bond information with one macro-bond connection.
const BondInfo & getBond(unsigned int idx) const
Returns a macro-bond connection by index.
virtual ~MacroBondInfo()=default
virtual std::unique_ptr< MacroBondInfo > copy() const
Returns a copy of this macro bond information.
void addBond(int beginAttachPt, int endAttachPt, unsigned int bondType)
Adds a macro-bond connection.
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:321
Std stuff.
One macro-bond connection in the owning graph bond's orientation.
unsigned int bondType
Stored as the numeric Bond::BondType value to avoid a Bond.h dependency.
int endAttachPt
The attachment point on the end atom.
int beginAttachPt
The attachment point on the begin atom.