RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
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
23
namespace
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
*/
33
class
RDKIT_GRAPHMOL_EXPORT
MacroBondInfo
{
34
public
:
35
//! One macro-bond connection in the owning graph bond's orientation.
36
struct
RDKIT_GRAPHMOL_EXPORT
BondInfo
{
37
//! The attachment point on the begin atom.
38
int
beginAttachPt
{-1};
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
RDKit::MacroBondInfo::getBonds
const std::vector< BondInfo > & getBonds() const
Returns all macro-bond connections.
Definition
MacroBondInfo.h:84
RDKit::MacroBondInfo::getNumBonds
std::size_t getNumBonds() const
Returns the number of macro-bond connections.
Definition
MacroBondInfo.h:73
RDKit::MacroBondInfo::MacroBondInfo
MacroBondInfo(const MacroBondInfo &other)=default
RDKit::MacroBondInfo::MacroBondInfo
MacroBondInfo(int beginAttachPt, int endAttachPt, unsigned int bondType)
Construct macro bond information with one macro-bond connection.
Definition
MacroBondInfo.h:57
RDKit::MacroBondInfo::getBond
const BondInfo & getBond(unsigned int idx) const
Returns a macro-bond connection by index.
Definition
MacroBondInfo.h:81
RDKit::MacroBondInfo::~MacroBondInfo
virtual ~MacroBondInfo()=default
RDKit::MacroBondInfo::copy
virtual std::unique_ptr< MacroBondInfo > copy() const
Returns a copy of this macro bond information.
Definition
MacroBondInfo.h:87
RDKit::MacroBondInfo::addBond
void addBond(int beginAttachPt, int endAttachPt, unsigned int bondType)
Adds a macro-bond connection.
Definition
MacroBondInfo.h:68
RDKit::MacroBondInfo::MacroBondInfo
MacroBondInfo()=default
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition
export.h:321
RDKit
Std stuff.
Definition
Abbreviations.h:19
RDKit::MacroBondInfo::BondInfo
One macro-bond connection in the owning graph bond's orientation.
Definition
MacroBondInfo.h:36
RDKit::MacroBondInfo::BondInfo::bondType
unsigned int bondType
Stored as the numeric Bond::BondType value to avoid a Bond.h dependency.
Definition
MacroBondInfo.h:44
RDKit::MacroBondInfo::BondInfo::endAttachPt
int endAttachPt
The attachment point on the end atom.
Definition
MacroBondInfo.h:41
RDKit::MacroBondInfo::BondInfo::beginAttachPt
int beginAttachPt
The attachment point on the begin atom.
Definition
MacroBondInfo.h:38
GraphMol
MacroBondInfo.h
Generated on
for RDKit by
1.17.0