RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
GaussianShape.h
Go to the documentation of this file.
1//
2// Copyright (C) 2026 David Cosgrove 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// Original author: David Cosgrove (CozChemIx Limited)
11//
12// This is the interface for the functions to perform shape-based molecule
13// alignments and scoring. It is experimental code and the API and/or
14// results may change in future releases.
15
16#ifndef RDKIT_GAUSSIANSHAPE_GUARD
17#define RDKIT_GAUSSIANSHAPE_GUARD
18
19#include <RDGeneral/export.h>
23
24namespace RDKit {
25class ROMol;
26class Conformer;
27
28namespace GaussianShape {
29
30//! Align a shape onto a reference shape.
31/*!
32 \param refShape the reference shape
33 \param fitShape the shape to align
34 \param xform if passed in as non-null, will be populated with the
35 transformation matrix that aligns fit onto ref.
36 \param overlayOpts options for the overlay
37
38\return an array of the combination score of the shape Tversky value and the
39 color Tversky value (zero if colors not used) and the individual values. If
40 using color features, defaults to RDKit pharmacophore types for the features.
41*/
43 const ShapeInput &refShape, ShapeInput &fitShape,
44 RDGeom::Transform3D *xform = nullptr,
45 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions());
46
47//! Align a molecule to a reference shape
48/*!
49 \param refShape the reference shape
50 \param fit the molecule to align
51 \param fitOpts the options for creating the fit shape
52 \param xform if passed in as non-null, will be populated with the
53 transformation matrix that aligns fit onto ref.
54 \param overlayOpts options for setting up and running the overlay
55 \param fitConfId (optional) the conformer to use for the fit
56 molecule
57
58\return an array of the combination score of the shape Tversky value and the
59 color Tversky value (zero if colors not used) and the individual values. If
60 using color features, defaults to RDKit pharmacophore types for the features.
61*/
63 const ShapeInput &refShape, ROMol &fit,
64 const ShapeInputOptions &fitOpts = ShapeInputOptions(),
65 RDGeom::Transform3D *xform = nullptr,
66 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions(),
67 int fitConfId = -1);
68
69//! Align a molecule to a reference molecule
70/*!
71 \param ref the reference molecule
72 \param fit the molecule to align
73 \param refOpts the options for creating the ref shape
74 \param fitOpts the options for creating the fit shape
75 \param xform if passed in as non-null, will be populated with the
76 transformation matrix that aligns fit onto ref.
77 \param overlayOpts options for setting up and running the overlay
78 \param refConfId (optional) the conformer to use for the reference
79 molecule
80 \param fitConfId (optional) the conformer to use for the fit
81 molecule
82
83 \return an array of the combination score of the shape Tversky value and the
84 color Tversky value (zero if colors not used) and the individual values. If
85 using color features, defaults to RDKit pharmacophore types for the features.
86*/
88 const ROMol &ref, ROMol &fit,
89 const ShapeInputOptions &refOpts = ShapeInputOptions(),
90 const ShapeInputOptions &fitOpts = ShapeInputOptions(),
91 RDGeom::Transform3D *xform = nullptr,
92 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions(),
93 int refConfId = -1, int fitConfId = -1);
94
95//! Calculate scores for the alignment of all conformers of one molecule
96//! onto another. Returns a matrix of the combination scores, the conformer
97//! numbers of the two molecules that gave the best overlay and the
98//! transformation matrix for that overlay if requested. The molecules
99//! themselves are not altered. scores[0][1] is the score of aligning
100//! fit conformer 1 onto ref conformer 0
101/*!
102 \param ref the reference molecule
103 \param fit the molecule to align
104 \param refConfId returns the reference conformer for the best scoring
105 overlay
106 \param fitConfId returns the fit conformer for the best scoring overlay
107 \param combScores the scores for all the overlays. Will be returned sized
108 by the number of conformers of the ref and fit molecules.
109 combScores[i][j] will be the score for the jth fit
110 conformer onto the ith ref conformer.
111 \param refOpts the options for creating the ref shape
112 \param fitOpts the options for creating the fit shape
113 \param overlayOpts options for setting up and running the overlay
114 \param xform if passed in as non-null, will be populated with the
115 transformation matrix that gives the best-scoring
116 overlay.
117 */
119 const ROMol &ref, const ROMol &fit, int &refConfId, int &fitConfId,
120 std::vector<std::vector<double>> &combScores,
121 const ShapeInputOptions &refOpts = ShapeInputOptions(),
122 const ShapeInputOptions &fitOpts = ShapeInputOptions(),
123 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions(),
124 RDGeom::Transform3D *xform = nullptr);
125
126//! Score the overlap of a shape to a reference shape without moving
127// either.
128/*!
129 \param refShape the reference shape
130 \param fitShape the shape to score
131 \param overlayOpts options for controlling the volume calculation
132 \param overlapVols if not-null, is filled with the raw overlap volumes
133
134\return an array of the combination score of the shape Tversky value and the
135 color Tversky value (zero if colors not used) and the individual values. If
136 using color features, defaults to RDKit pharmacophore types for the features.
137*/
139 const ShapeInput &refShape, const ShapeInput &fitShape,
140 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions(),
141 std::pair<double, double> *overlapVols = nullptr);
142
143//! Score the overlap of a molecule to a reference shape without moving
144// either.
145/*!
146 \param refShape the reference shape
147 \param fit the molecule to score
148 \param fitOpts the options for creating the fit shape
149 \param overlayOpts options for controlling the volume calculation
150 \param fitConfId (optional) the conformer to use for the fit
151 molecule
152 \param overlapVols if not-null, is filled with the raw overlap volumes
153
154\return an array of the combination score of the shape Tversky value and the
155 color Tversky value (zero if colors not used) and the individual values. If
156 using color features, defaults to RDKit pharmacophore types for the features.
157*/
159 const ShapeInput &refShape, const ROMol &fit,
160 const ShapeInputOptions &fitOpts = ShapeInputOptions(),
161 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions(),
162 int fitConfId = -1,
163 std::pair<double, double> *overlapVols = nullptr);
164
165//! Score the overlap of a molecule to a reference molecule without moving
166// either.
167/*!
168 \param ref the reference molecule
169 \param fit the molecule to score
170 \param refOpts the options for creating the ref shape
171 \param fitOpts the options for creating the fit shape
172 \param overlayOpts options for controlling the volume calculation
173 \param refConfId (optional) the conformer to use for the reference
174 molecule
175 \param fitConfId (optional) the conformer to use for the fit
176 molecule
177 \param overlapVols if not-null, is filled with the raw overlap volumes
178
179\return an array of the combination score of the shape Tverksy value and the
180 color Tversky value (zero if colors not used) and the individual values. If
181 using color features, defaults to RDKit pharmacophore types for the features.
182*/
184 const ROMol &ref, const ROMol &fit,
185 const ShapeInputOptions &refOpts = ShapeInputOptions(),
186 const ShapeInputOptions &fitOpts = ShapeInputOptions(),
187 const ShapeOverlayOptions &overlayOpts = ShapeOverlayOptions(),
188 int refConfId = -1, int fitConfId = -1,
189 std::pair<double, double> *overlapVols = nullptr);
190
191} // namespace GaussianShape
192} // namespace RDKit
193
194#endif // RDKIT_GAUSSIANSHAPE_GUARD
The class for representing 2D or 3D conformation of a molecule.
Definition Conformer.h:46
#define RDKIT_GAUSSIANSHAPE_EXPORT
Definition export.h:233
RDKIT_GAUSSIANSHAPE_EXPORT void ScoreMoleculeAllConformers(const ROMol &ref, const ROMol &fit, int &refConfId, int &fitConfId, std::vector< std::vector< double > > &combScores, const ShapeInputOptions &refOpts=ShapeInputOptions(), const ShapeInputOptions &fitOpts=ShapeInputOptions(), const ShapeOverlayOptions &overlayOpts=ShapeOverlayOptions(), RDGeom::Transform3D *xform=nullptr)
RDKIT_GAUSSIANSHAPE_EXPORT std::array< double, 3 > AlignShape(const ShapeInput &refShape, ShapeInput &fitShape, RDGeom::Transform3D *xform=nullptr, const ShapeOverlayOptions &overlayOpts=ShapeOverlayOptions())
Align a shape onto a reference shape.
RDKIT_GAUSSIANSHAPE_EXPORT std::array< double, 3 > ScoreMolecule(const ShapeInput &refShape, const ROMol &fit, const ShapeInputOptions &fitOpts=ShapeInputOptions(), const ShapeOverlayOptions &overlayOpts=ShapeOverlayOptions(), int fitConfId=-1, std::pair< double, double > *overlapVols=nullptr)
Score the overlap of a molecule to a reference shape without moving.
RDKIT_GAUSSIANSHAPE_EXPORT std::array< double, 3 > AlignMolecule(const ShapeInput &refShape, ROMol &fit, const ShapeInputOptions &fitOpts=ShapeInputOptions(), RDGeom::Transform3D *xform=nullptr, const ShapeOverlayOptions &overlayOpts=ShapeOverlayOptions(), int fitConfId=-1)
Align a molecule to a reference shape.
RDKIT_GAUSSIANSHAPE_EXPORT std::array< double, 3 > ScoreShape(const ShapeInput &refShape, const ShapeInput &fitShape, const ShapeOverlayOptions &overlayOpts=ShapeOverlayOptions(), std::pair< double, double > *overlapVols=nullptr)
Score the overlap of a shape to a reference shape without moving.
Std stuff.