RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
ShapeOverlayOptions.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// Options for the Roshambo2-based shape overlay.
13
14#ifndef RDKIT_SHAPEOVERLAYOPTIONS_GUARD
15#define RDKIT_SHAPEOVERLAYOPTIONS_GUARD
16
17#include <RDGeneral/export.h>
18
19namespace RDKit {
20class ROMol;
21namespace GaussianShape {
22
23enum class RDKIT_GAUSSIANSHAPE_EXPORT StartMode {
24 ROTATE_0, //! No rotation, just normalization if requested
25 ROTATE_180, //! ROTATE_0 plus rotate by 180 degrees about each of x, y, z
26 ROTATE_180_WIGGLE, //! ROTATE_180 plus, as the PubChem code does, rotate by a
27 //! small amount (~25 degrees) about each axis and use the
28 //! highest scoring of those as the start point for that
29 //! rotation angle
30 ROTATE_45, //! ROTATE_180 plus rotate by 45 degrees about pairs of each of x,
31 //! y, z
32 ROTATE_0_FRAGMENT, //! No rotation, translate probe to each end of ref
33 ROTATE_180_FRAGMENT, //! Translate probe to each end of ref and then
34 //! ROTATE_180
35 ROTATE_45_FRAGMENT, //! Translate probe to each end of ref and then ROTATE_90
36 A_LA_PUBCHEM, //! Uses the eigenvalues of the principal vectors to decide
37 //! whether to do ROTATE_180_WIGGLE or ROTATE_45
38};
39
40enum class RDKIT_GAUSSIANSHAPE_EXPORT OptimMode {
41 SHAPE_ONLY, //! Drive the optimisation by shape overlap only.
42 SHAPE_PLUS_COLOR_SCORE, //! Drive the optimisation by shape, but include
43 //! color in the score to determine the best
44 //! solution. Color never used in the optimisation
45 //! stage.
46 SHAPE_PLUS_COLOR, //! Drive the optimisation by overlap of shape and color
47 //! features.
48};
49
51 //! Different modes for starting the optimisation. Default is as used by the
52 //! PubChem code. The molecules are normalized so the principal axes are
53 //! along the cartesian axes rather than the shape quadrupole axes as Grant et
54 //! al. did.
55 StartMode startMode{StartMode::A_LA_PUBCHEM};
56 OptimMode optimMode{
57 OptimMode::SHAPE_PLUS_COLOR_SCORE}; //! Optimisation mode.
58 double simAlpha{
59 1.0}; //! When doing a Tversky similarity, the alpha value. If alpha and
60 //! beta are both the default 1.0, it's a Tanimoto similarity. A
61 //! high alpha and low beta emphasize the fit volume in the
62 //! similarity and vice versa. Tversky is O / (A * (R - O) + B * (F
63 //! - O) + O) where O is the overlap volume, R is the reference's
64 //! volume and F is the fit's volume. This is different from that
65 //! used by OpenEye (O / (A * R + B * F)).
66 double simBeta{1.0}; //! When doing a Tversky similarity, the beta value.
67 double optParam{0.5}; //! If using colors, the relative weights of shape and
68 //! color scores.
69 int nSteps{100}; //! Maximum number of steps for optimiser to take.
70
72 true}; //! Whether to normalise the shapes by putting them into their
73 //! canonical conformations (centred at the origin, aligned along
74 //! its principal axes) before starting.
76 true}; //! Whether to use a distance cutoff for the volume calculation.
77 double distCutoff{4.5}; //! The distance cutoff. If 2 atoms are more than
78 //! this distance apart, they are not included in the
79 //! volume calculation. A smaller value is faster but
80 //! less precise.
82 0.001}; //! Optimisation stops when the shape score changes by less
83 //! than this amount. A larger number is faster but less
84 //! precise.
85};
86
87inline std::ostream &operator<<(std::ostream &os, const StartMode &sm) {
88 switch (sm) {
89 case StartMode::ROTATE_0:
90 os << "ROTATE_0";
91 break;
92 case StartMode::ROTATE_0_FRAGMENT:
93 os << "ROTATE_0_FRAGMENT";
94 break;
95 case StartMode::ROTATE_180:
96 os << "ROTATE_180";
97 break;
98 case StartMode::ROTATE_180_FRAGMENT:
99 os << "ROTATE_180_FRAGMENT";
100 break;
101 case StartMode::ROTATE_180_WIGGLE:
102 os << "ROTATE_180_WIGGLE";
103 break;
104 case StartMode::ROTATE_45:
105 os << "ROTATE_45";
106 break;
107 case StartMode::ROTATE_45_FRAGMENT:
108 os << "ROTATE_45_FRAGMENT";
109 break;
110 case StartMode::A_LA_PUBCHEM:
111 os << "A_LA_PUBCHEM";
112 break;
113 }
114 return os;
115}
116} // namespace GaussianShape
117} // namespace RDKit
118
119#endif // RDKIT_SHAPEOVERLAYOPTIONS_GUARD
ROTATE_180_WIGGLE
ROTATE_0 plus rotate by 180 degrees about each of x, y, z.
ROTATE_0_FRAGMENT
SHAPE_PLUS_COLOR
ROTATE_45_FRAGMENT
SHAPE_PLUS_COLOR_SCORE
Drive the optimisation by shape overlap only.
ROTATE_180_FRAGMENT
No rotation, translate probe to each end of ref.
ROTATE_180
No rotation, just normalization if requested.
A_LA_PUBCHEM
Translate probe to each end of ref and then ROTATE_90.
#define RDKIT_GAUSSIANSHAPE_EXPORT
Definition export.h:233
std::ostream & operator<<(std::ostream &os, const StartMode &sm)
Std stuff.
bool normalize
Maximum number of steps for optimiser to take.
double distCutoff
Whether to use a distance cutoff for the volume calculation.
double optParam
When doing a Tversky similarity, the beta value.