RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
Loading...
Searching...
No Matches
SynthonShapeInput.h
Go to the documentation of this file.
1
//
2
// Copyright (C) David Cosgrove 2026.
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
// A class building on ShapeInput for Synthon shape searching.
11
12
#ifndef RDKIT_SYNTHONSHAPEINPUT_H
13
#define RDKIT_SYNTHONSHAPEINPUT_H
14
15
#include <
GraphMol/RWMol.h
>
16
#include <
GraphMol/GaussianShape/ShapeInput.h
>
17
#include <
GraphMol/GaussianShape/ShapeOverlayOptions.h
>
18
19
#include <
RDGeneral/BoostStartInclude.h
>
20
#ifdef RDK_USE_BOOST_SERIALIZATION
21
#include <boost/archive/text_oarchive.hpp>
22
#include <boost/archive/text_iarchive.hpp>
23
#include <boost/serialization/unique_ptr.hpp>
24
#include <boost/serialization/utility.hpp>
// for std::pair
25
#include <boost/serialization/vector.hpp>
26
#include <boost/serialization/split_member.hpp>
27
#endif
28
#include <
RDGeneral/BoostEndInclude.h
>
29
30
namespace
RDKit
{
31
namespace
SynthonSpaceSearch
{
32
33
class
SynthonShapeInput
{
34
public
:
35
SynthonShapeInput
(
const
ROMol
&mol,
int
confId = -1,
36
const
GaussianShape::ShapeInputOptions
&opts =
37
GaussianShape::ShapeInputOptions
(),
38
const
GaussianShape::ShapeOverlayOptions
&overlayOpts =
39
GaussianShape::ShapeOverlayOptions
());
40
SynthonShapeInput
(
const
std::string &str) {
41
#ifndef RDK_USE_BOOST_SERIALIZATION
42
PRECONDITION
(0,
"Boost SERIALIZATION is not enabled"
)
43
#else
44
std::stringstream ss(str);
45
boost::archive::text_iarchive ia(ss);
46
ia &*
this
;
47
#endif
48
}
49
SynthonShapeInput
(
const
SynthonShapeInput
&);
50
SynthonShapeInput
(
SynthonShapeInput
&&) =
default
;
51
SynthonShapeInput
&
operator=
(
const
SynthonShapeInput
&);
52
SynthonShapeInput
&
operator=
(
SynthonShapeInput
&&) =
default
;
53
~SynthonShapeInput
() =
default
;
54
55
// Merge the other SynthonShapeInput, assuming it has the correct number
56
// of atoms etc. Empties other, unless they can't be merged in which case
57
// it returns unscathed.
58
void
merge
(
SynthonShapeInput
&&other);
59
60
std::string
toString
()
const
{
61
#ifndef RDK_USE_BOOST_SERIALIZATION
62
PRECONDITION
(0,
"Boost SERIALIZATION is not enabled"
)
63
#else
64
std::stringstream ss;
65
boost::archive::text_oarchive oa(ss);
66
oa &*
this
;
67
return
ss.str();
68
#endif
69
}
70
71
GaussianShape::ShapeInput
&
getShapes
()
const
{
return
*d_shapes; }
72
73
double
getDummyVolume
(
unsigned
int
shapeNum)
const
;
74
unsigned
int
getNumDummyAtoms
()
const
;
75
unsigned
int
getNumDummyAtomNbors
()
const
{
76
return
d_dummyAtomsAndNbrs.size();
77
}
78
const
std::vector<std::pair<unsigned int, unsigned int>> &
79
getDummyAtomsAndNbrs
()
const
{
80
return
d_dummyAtomsAndNbrs;
81
}
82
83
#ifdef RDK_USE_BOOST_SERIALIZATION
84
template
<
class
Archive>
85
void
serialize(Archive &ar,
const
unsigned
int
) {
86
if
(Archive::is_saving::value) {
87
std::string shape = d_shapes->toString();
88
ar & shape;
89
}
else
{
90
std::string shape;
91
ar & shape;
92
d_shapes.reset(
new
GaussianShape::ShapeInput
(shape));
93
}
94
ar & d_dummyVolumes;
95
ar & d_dummyAtomsAndNbrs;
96
}
97
#endif
98
99
private
:
100
std::unique_ptr<GaussianShape::ShapeInput> d_shapes;
101
std::vector<double>
102
d_dummyVolumes;
// The volumes of the dummy atoms in the shapes
103
// These pairs are the dummy atoms and neighbour atoms. On rare occasions
104
// a dummy may have 2 neighbours, so the first numbers in the pairs
105
// may not be unique.
106
std::vector<std::pair<unsigned int, unsigned int>> d_dummyAtomsAndNbrs;
107
108
void
buildDummyAtomsAndNbrs();
109
void
calculateDummyVols(
const
GaussianShape::ShapeOverlayOptions &opts);
110
};
111
112
}
// namespace SynthonSpaceSearch
113
}
// namespace RDKit
114
115
#endif
// RDKIT_SYNTHONSHAPEINPUT_H
BoostEndInclude.h
BoostStartInclude.h
PRECONDITION
#define PRECONDITION(expr, mess)
Definition
Invariant.h:108
RWMol.h
Defines the editable molecule class RWMol.
ShapeInput.h
ShapeOverlayOptions.h
RDKit::GaussianShape::ShapeInput
Definition
ShapeInput.h:128
RDKit::ROMol
Definition
ROMol.h:344
RDKit::SynthonSpaceSearch::SynthonShapeInput::SynthonShapeInput
SynthonShapeInput(const ROMol &mol, int confId=-1, const GaussianShape::ShapeInputOptions &opts=GaussianShape::ShapeInputOptions(), const GaussianShape::ShapeOverlayOptions &overlayOpts=GaussianShape::ShapeOverlayOptions())
RDKit::SynthonSpaceSearch::SynthonShapeInput::getShapes
GaussianShape::ShapeInput & getShapes() const
Definition
SynthonShapeInput.h:71
RDKit::SynthonSpaceSearch::SynthonShapeInput::SynthonShapeInput
SynthonShapeInput(const std::string &str)
Definition
SynthonShapeInput.h:40
RDKit::SynthonSpaceSearch::SynthonShapeInput::operator=
SynthonShapeInput & operator=(SynthonShapeInput &&)=default
RDKit::SynthonSpaceSearch::SynthonShapeInput::getDummyAtomsAndNbrs
const std::vector< std::pair< unsigned int, unsigned int > > & getDummyAtomsAndNbrs() const
Definition
SynthonShapeInput.h:79
RDKit::SynthonSpaceSearch::SynthonShapeInput::getDummyVolume
double getDummyVolume(unsigned int shapeNum) const
RDKit::SynthonSpaceSearch::SynthonShapeInput::getNumDummyAtoms
unsigned int getNumDummyAtoms() const
RDKit::SynthonSpaceSearch::SynthonShapeInput::operator=
SynthonShapeInput & operator=(const SynthonShapeInput &)
RDKit::SynthonSpaceSearch::SynthonShapeInput::~SynthonShapeInput
~SynthonShapeInput()=default
RDKit::SynthonSpaceSearch::SynthonShapeInput::getNumDummyAtomNbors
unsigned int getNumDummyAtomNbors() const
Definition
SynthonShapeInput.h:75
RDKit::SynthonSpaceSearch::SynthonShapeInput::SynthonShapeInput
SynthonShapeInput(const SynthonShapeInput &)
RDKit::SynthonSpaceSearch::SynthonShapeInput::toString
std::string toString() const
Definition
SynthonShapeInput.h:60
RDKit::SynthonSpaceSearch::SynthonShapeInput::SynthonShapeInput
SynthonShapeInput(SynthonShapeInput &&)=default
RDKit::SynthonSpaceSearch::SynthonShapeInput::merge
void merge(SynthonShapeInput &&other)
RDKit::SynthonSpaceSearch
Definition
MemoryMappedFileReader.h:19
RDKit
Std stuff.
Definition
Abbreviations.h:19
RDKit::GaussianShape::ShapeInputOptions
Definition
ShapeInput.h:89
RDKit::GaussianShape::ShapeOverlayOptions
Definition
ShapeOverlayOptions.h:50
GraphMol
SynthonSpaceSearch
SynthonShapeInput.h
Generated on
for RDKit by
1.17.0