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