RDKit
Open-source cheminformatics and machine learning.
ShapeUtils.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005-2006 Rational Discovery LLC
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 #ifndef _RD_SHAPE_UTILS_H_20050128_
11 #define _RD_SHAPE_UTILS_H_20050128_
13 #include <vector>
14 
15 namespace RDGeom {
16  class Point3D;
17  class Transform3D;
18 }
19 
20 namespace RDKit {
21  class ROMol;
22  class Conformer;
23 
24  namespace MolShapes {
25 
26  //! Compute the size of the box that can fit the conformation, and offset of the box
27  //! from the origin
28  void computeConfDimsAndOffset(const Conformer &conf, RDGeom::Point3D &dims,
29  RDGeom::Point3D &offSet, const RDGeom::Transform3D *trans=0,
30  double padding=2.5);
31 
32  //! Compute the a box that will fit the confomer
33  /*!
34  \param conf The conformer of interest
35  \param leftBottom Storage for one extremity of the box
36  \param rightTop Storage for other extremity of the box
37  \param trans Optional transformation to be applied to the atom coordinates
38  \param padding Padding added on the sides around the conformer
39  */
40  void computeConfBox(const Conformer &conf, RDGeom::Point3D &leftBottom,
41  RDGeom::Point3D &rightTop, const RDGeom::Transform3D *trans=0,
42  double padding=2.5);
43 
44  //! Compute the union of two boxes
45  void computeUnionBox(const RDGeom::Point3D &leftBottom1, const RDGeom::Point3D &rightTop1,
46  const RDGeom::Point3D &leftBottom2, const RDGeom::Point3D &rightTop2,
47  RDGeom::Point3D &uLeftBottom, RDGeom::Point3D &uRightTop);
48 
49  //! Compute dimensions of a conformer
50  /*!
51  \param conf Conformer of interest
52  \param padding Padding added to the atom coordinates on all sides
53  \param center Optionally specify the center
54  \param ignoreHs if true, ignore the hydrogen atoms in computing the centroid
55  */
56  std::vector<double> getConfDimensions(const Conformer &conf, double padding=2.5,
57  const RDGeom::Point3D *center=0, bool ignoreHs=true);
58 
59  //! Compute the shape tanimoto distance between two molecule based on a predefined alignment
60  /*!
61  \param mol1 The first molecule of interest
62  \param mol2 The second molecule of interest
63  \param confId1 Conformer in the first molecule (defaults to first conformer)
64  \param confId2 Conformer in the second molecule (defaults to first conformer)
65  \param gridSpacing resolution of the grid used to encode the molecular shapes
66  \param bitsPerPoint number of bit used to encode the occupancy at each grid point
67  defaults to two bits per grid point
68  \param vdwScale Scaling factor for the radius of the atoms to determine the base radius
69  used in the encoding - grid points inside this sphere carry the maximum occupany
70  \param stepSize thickness of the each layer outside the base radius, the occupancy value is decreased
71  from layer to layer from the maximum value
72  \param maxLayers the maximum number of layers - defaults to the number allowed the number of bits
73  use per grid point - e.g. two bits per grid point will allow 3 layers
74  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding process
75  */
76 
77  double tanimotoDistance(const ROMol &mol1, const ROMol &mol2, int confId1=-1, int confId2=-1,
78  double gridSpacing=0.5,
79  DiscreteValueVect::DiscreteValueType bitsPerPoint=DiscreteValueVect::TWOBITVALUE,
80  double vdwScale=0.8, double stepSize=0.25, int maxLayers=-1,
81  bool ignoreHs=true);
82 
83 
84  //! Compute the shape tanimoto distance between two conformers based on a predefined alignment
85  /*!
86  \param conf1 The first conformer of interest
87  \param conf2 The second conformer of interest
88  \param gridSpacing resolution of the grid used to encode the molecular shapes
89  \param bitsPerPoint number of bit used to encode the occupancy at each grid point
90  \param vdwScale Scaling factor for the radius of the atoms to determine the base radius
91  used in the encoding - grid points inside this sphere carry the maximum occupany
92  \param stepSize thickness of the each layer outside the base radius, the occupancy value is decreased
93  from layer to layer from the maximum value
94  \param maxLayers the maximum number of layers - defaults to the number allowed the number of bits
95  use per grid point - e.g. two bits per grid point will allow 3 layers
96  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding process
97  */
98 
99  double tanimotoDistance(const Conformer &conf1, const Conformer &conf2, double gridSpacing=0.5,
100  DiscreteValueVect::DiscreteValueType bitsPerPoint=DiscreteValueVect::TWOBITVALUE,
101  double vdwScale=0.8, double stepSize=0.25, int maxLayers=-1, bool ignoreHs=true);
102 
103 
104  //! Compute the shape protrusion distance between two molecule based on a predefined alignment
105  /*!
106  \param mol1 The first molecule of interest
107  \param mol2 The second molecule of interest
108  \param confId1 Conformer in the first molecule (defaults to first conformer)
109  \param confId2 Conformer in the second molecule (defaults to first conformer)
110  \param gridSpacing resolution of the grid used to encode the molecular shapes
111  \param bitsPerPoint number of bit used to encode the occupancy at each grid point
112  defaults to two bits per grid point
113  \param vdwScale Scaling factor for the radius of the atoms to determine the base radius
114  used in the encoding - grid points inside this sphere carry the maximum occupany
115  \param stepSize thickness of the each layer outside the base radius, the occupancy value is decreased
116  from layer to layer from the maximum value
117  \param maxLayers the maximum number of layers - defaults to the number allowed the number of bits
118  use per grid point - e.g. two bits per grid point will allow 3 layers
119  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding process
120  \param allowReordering if set the order will be automatically updated so that the value calculated
121  is the protrusion of the smaller shape from the larger one.
122  */
123 
124  double protrudeDistance(const ROMol &mol1, const ROMol &mol2, int confId1=-1, int confId2=-1,
125  double gridSpacing=0.5,
126  DiscreteValueVect::DiscreteValueType bitsPerPoint=DiscreteValueVect::TWOBITVALUE,
127  double vdwScale=0.8, double stepSize=0.25, int maxLayers=-1,
128  bool ignoreHs=true, bool allowReordering=true);
129 
130 
131  //! Compute the shape protrusion distance between two conformers based on a predefined alignment
132  /*!
133  \param conf1 The first conformer of interest
134  \param conf2 The second conformer of interest
135  \param gridSpacing resolution of the grid used to encode the molecular shapes
136  \param bitsPerPoint number of bit used to encode the occupancy at each grid point
137  \param vdwScale Scaling factor for the radius of the atoms to determine the base radius
138  used in the encoding - grid points inside this sphere carry the maximum occupany
139  \param stepSize thickness of the each layer outside the base radius, the occupancy value is decreased
140  from layer to layer from the maximum value
141  \param maxLayers the maximum number of layers - defaults to the number allowed the number of bits
142  use per grid point - e.g. two bits per grid point will allow 3 layers
143  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding process
144  \param allowReordering if set the order will be automatically updated so that the value calculated
145  is the protrusion of the smaller shape from the larger one.
146  */
147 
148  double protrudeDistance(const Conformer &conf1, const Conformer &conf2, double gridSpacing=0.5,
149  DiscreteValueVect::DiscreteValueType bitsPerPoint=DiscreteValueVect::TWOBITVALUE,
150  double vdwScale=0.8, double stepSize=0.25, int maxLayers=-1, bool ignoreHs=true,
151  bool allowReordering=true);
152 
153  }
154 
155 }
156 
157 #endif
void computeUnionBox(const RDGeom::Point3D &leftBottom1, const RDGeom::Point3D &rightTop1, const RDGeom::Point3D &leftBottom2, const RDGeom::Point3D &rightTop2, RDGeom::Point3D &uLeftBottom, RDGeom::Point3D &uRightTop)
Compute the union of two boxes.
std::vector< double > getConfDimensions(const Conformer &conf, double padding=2.5, const RDGeom::Point3D *center=0, bool ignoreHs=true)
Compute dimensions of a conformer.
void computeConfBox(const Conformer &conf, RDGeom::Point3D &leftBottom, RDGeom::Point3D &rightTop, const RDGeom::Transform3D *trans=0, double padding=2.5)
Compute the a box that will fit the confomer.
double tanimotoDistance(const GRIDTYPE &grid1, const GRIDTYPE &grid2)
calculate the tanimoto distance between the shapes encoded on two grids
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
void computeConfDimsAndOffset(const Conformer &conf, RDGeom::Point3D &dims, RDGeom::Point3D &offSet, const RDGeom::Transform3D *trans=0, double padding=2.5)
double protrudeDistance(const GRIDTYPE &grid1, const GRIDTYPE &grid2)
calculate the protrude distance between the shapes encoded on two grids