Chemical Data Processing Library C++ API - Version 1.4.0
PrincipalAxesAlignmentStartGenerator.hpp
Go to the documentation of this file.
1 /*
2  * PrincipalAxesAlignmentStartGenerator.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_SHAPE_PRINCIPALAXESALIGNMENTSTARTGENERATOR_HPP
30 #define CDPL_SHAPE_PRINCIPALAXESALIGNMENTSTARTGENERATOR_HPP
31 
32 #include <vector>
33 
34 #include <boost/random/mersenne_twister.hpp>
35 
36 #include "CDPL/Shape/APIPrefix.hpp"
38 #include "CDPL/Math/Vector.hpp"
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Shape
46  {
47 
58  {
59 
60  public:
64  static constexpr double DEF_SYMMETRY_THRESHOLD = 0.15;
65 
69  static constexpr std::size_t DEF_NUM_RANDOM_STARTS = 4;
70 
74  static constexpr double DEF_MAX_RANDOM_TRANSLATION = 2.0;
75 
80 
87  unsigned int setupReference(GaussianShapeFunction& func, Math::Matrix4D& xform) const;
88 
95  unsigned int setupAligned(GaussianShapeFunction& func, Math::Matrix4D& xform) const;
96 
101  void genShapeCenterStarts(bool generate);
102 
107  bool genShapeCenterStarts() const;
108 
113  void genColorCenterStarts(bool generate);
114 
119  bool genColorCenterStarts() const;
120 
125  void genNonColorCenterStarts(bool generate);
126 
132 
137  void genRandomStarts(bool generate);
138 
143  bool genRandomStarts() const;
144 
149  void genForAlignedShapeCenters(bool generate);
150 
156 
161  void genForReferenceShapeCenters(bool generate);
162 
168 
173  void genForLargerShapeCenters(bool generate);
174 
180 
185  void setSymmetryThreshold(double thresh);
186 
192 
197  void setMaxRandomTranslation(double max_trans);
198 
203  double getMaxRandomTranslation() const;
204 
209  void setNumRandomStarts(std::size_t num_starts);
210 
215  std::size_t getNumRandomStarts() const;
216 
221  void setRandomSeed(unsigned int seed);
222 
228  void setReference(const GaussianShapeFunction& func, unsigned int sym_class);
229 
236  bool generate(const GaussianShapeFunction& func, unsigned int sym_class);
237 
242  std::size_t getNumStartTransforms() const;
243 
248  std::size_t getNumStartSubTransforms() const;
249 
256  const QuaternionTransformation& getStartTransform(std::size_t idx) const;
257 
258  private:
259  void generateForElementCenters(const GaussianShapeFunction& func, unsigned int axes_swap_flags, bool ref_shape);
260  void generate(const Math::Vector3D& ctr_trans, unsigned int axes_swap_flags);
261 
262  template <typename QE>
263  void addStartTransform(Math::Vector3D::ConstPointer ctr_trans_data, const Math::QuaternionExpression<QE>& rot_quat);
264 
265  typedef std::vector<QuaternionTransformation> StartTransformList;
266  typedef boost::random::mt11213b RandomEngine;
267 
268  bool shapeCtrStarts;
269  bool colCtrStarts;
270  bool nonColCtrStarts;
271  bool randomStarts;
272  bool genForAlgdShape;
273  bool genForRefShape;
274  bool genForLargerShape;
275  StartTransformList startTransforms;
276  const GaussianShapeFunction* refShapeFunc;
277  double symThreshold;
278  double maxRandomTrans;
279  std::size_t numRandomStarts;
280  unsigned int refAxesSwapFlags;
281  std::size_t numSubTransforms;
282  RandomEngine randomEngine;
283  };
284  } // namespace Shape
285 } // namespace CDPL
286 
287 #endif // CDPL_SHAPE_PRINCIPALAXESALIGNMENTSTARTGENERATOR_HPP
Definition of class CDPL::Shape::GaussianShapeAlignmentStartGenerator.
Definition of various quaternion expression types and operations.
Definition of the preprocessor macro CDPL_SHAPE_API.
#define CDPL_SHAPE_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of vector data types.
Fixed-size vector of dimension N backed by a C-array (no dynamic allocation).
Definition: Vector.hpp:2047
CRTP base class of all quaternion expression types.
Definition: Expression.hpp:148
Abstract base class for generators of starting transformations used to seed Gaussian-shape overlap op...
Definition: GaussianShapeAlignmentStartGenerator.hpp:57
Function representation of a Gaussian shape, used to evaluate the shape's density,...
Definition: GaussianShapeFunction.hpp:61
Generator that produces alignment starting transformations by aligning the principal axes of the alig...
Definition: PrincipalAxesAlignmentStartGenerator.hpp:58
bool genForReferenceShapeCenters() const
Tells whether element-/color-center starts are generated for centers of the reference shape.
bool genForAlignedShapeCenters() const
Tells whether element-/color-center starts are generated for centers of the aligned shape.
void setRandomSeed(unsigned int seed)
Sets the seed used by the random number generator that produces the random starts.
double getSymmetryThreshold()
Returns the currently configured symmetry threshold.
void setNumRandomStarts(std::size_t num_starts)
Sets the number of random starting transformations.
void setSymmetryThreshold(double thresh)
Sets the relative threshold for treating two principal moments as equal.
bool genNonColorCenterStarts() const
Tells whether starting transformations at non-color (shape) element centers are generated.
bool generate(const GaussianShapeFunction &func, unsigned int sym_class)
Generates the starting transformations for the alignment of func against the previously configured re...
const QuaternionTransformation & getStartTransform(std::size_t idx) const
Returns the starting transformation at index idx.
void genNonColorCenterStarts(bool generate)
Enables or disables the generation of starting transformations at non-color (shape) element centers.
std::size_t getNumStartSubTransforms() const
Returns the number of sub-transformations applied per generated starting transformation (e....
void genForAlignedShapeCenters(bool generate)
Specifies whether element-/color-center starts shall be generated for centers of the aligned shape.
bool genColorCenterStarts() const
Tells whether starting transformations at color (pharmacophore) feature centers are generated.
void genForLargerShapeCenters(bool generate)
Specifies whether element-/color-center starts shall be generated for centers of the shape with more ...
void genForReferenceShapeCenters(bool generate)
Specifies whether element-/color-center starts shall be generated for centers of the reference shape.
PrincipalAxesAlignmentStartGenerator()
Constructs the PrincipalAxesAlignmentStartGenerator instance.
std::size_t getNumStartTransforms() const
Returns the total number of starting transformations produced by the last generate() call.
unsigned int setupReference(GaussianShapeFunction &func, Math::Matrix4D &xform) const
Prepares the reference shape function for use by the start generator.
bool genForLargerShapeCenters() const
Tells whether element-/color-center starts are generated for centers of the shape with more elements ...
void genRandomStarts(bool generate)
Enables or disables the generation of random starting transformations.
std::size_t getNumRandomStarts() const
Returns the currently configured number of random starts.
void setReference(const GaussianShapeFunction &func, unsigned int sym_class)
Specifies the reference shape function and its symmetry class.
bool genRandomStarts() const
Tells whether random starting transformations are generated.
double getMaxRandomTranslation() const
Returns the currently configured maximum random translation.
void genColorCenterStarts(bool generate)
Enables or disables the generation of starting transformations at color (pharmacophore) feature cente...
void setMaxRandomTranslation(double max_trans)
Sets the maximum random translation magnitude applied to random starts.
bool genShapeCenterStarts() const
Tells whether a starting transformation at the shape centroid is generated.
void genShapeCenterStarts(bool generate)
Enables or disables the generation of a starting transformation at the shape centroid.
unsigned int setupAligned(GaussianShapeFunction &func, Math::Matrix4D &xform) const
Prepares the aligned shape function for use by the start generator.
CVector< double, 3 > Vector3D
Bounded 3 element vector holding floating-point values of type double.
Definition: Vector.hpp:3218
The namespace of the Chemical Data Processing Library.