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:
62  static constexpr double DEF_SYMMETRY_THRESHOLD = 0.15;
63 
65  static constexpr std::size_t DEF_NUM_RANDOM_STARTS = 4;
66 
68  static constexpr double DEF_MAX_RANDOM_TRANSLATION = 2.0;
69 
74 
81  unsigned int setupReference(GaussianShapeFunction& func, Math::Matrix4D& xform) const;
82 
89  unsigned int setupAligned(GaussianShapeFunction& func, Math::Matrix4D& xform) const;
90 
95  void genShapeCenterStarts(bool generate);
96 
101  bool genShapeCenterStarts() const;
102 
107  void genColorCenterStarts(bool generate);
108 
113  bool genColorCenterStarts() const;
114 
119  void genNonColorCenterStarts(bool generate);
120 
126 
131  void genRandomStarts(bool generate);
132 
137  bool genRandomStarts() const;
138 
143  void genForAlignedShapeCenters(bool generate);
144 
150 
155  void genForReferenceShapeCenters(bool generate);
156 
162 
167  void genForLargerShapeCenters(bool generate);
168 
174 
179  void setSymmetryThreshold(double thresh);
180 
186 
191  void setMaxRandomTranslation(double max_trans);
192 
197  double getMaxRandomTranslation() const;
198 
203  void setNumRandomStarts(std::size_t num_starts);
204 
209  std::size_t getNumRandomStarts() const;
210 
215  void setRandomSeed(unsigned int seed);
216 
222  void setReference(const GaussianShapeFunction& func, unsigned int sym_class);
223 
230  bool generate(const GaussianShapeFunction& func, unsigned int sym_class);
231 
236  std::size_t getNumStartTransforms() const;
237 
242  std::size_t getNumStartSubTransforms() const;
243 
250  const QuaternionTransformation& getStartTransform(std::size_t idx) const;
251 
252  private:
253  void generateForElementCenters(const GaussianShapeFunction& func, unsigned int axes_swap_flags, bool ref_shape);
254  void generate(const Math::Vector3D& ctr_trans, unsigned int axes_swap_flags);
255 
256  template <typename QE>
257  void addStartTransform(Math::Vector3D::ConstPointer ctr_trans_data, const Math::QuaternionExpression<QE>& rot_quat);
258 
259  typedef std::vector<QuaternionTransformation> StartTransformList;
260  typedef boost::random::mt11213b RandomEngine;
261 
262  bool shapeCtrStarts;
263  bool colCtrStarts;
264  bool nonColCtrStarts;
265  bool randomStarts;
266  bool genForAlgdShape;
267  bool genForRefShape;
268  bool genForLargerShape;
269  StartTransformList startTransforms;
270  const GaussianShapeFunction* refShapeFunc;
271  double symThreshold;
272  double maxRandomTrans;
273  std::size_t numRandomStarts;
274  unsigned int refAxesSwapFlags;
275  std::size_t numSubTransforms;
276  RandomEngine randomEngine;
277  };
278  } // namespace Shape
279 } // namespace CDPL
280 
281 #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:1876
CRTP base class for all quaternion expression types.
Definition: Expression.hpp:142
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:2937
The namespace of the Chemical Data Processing Library.