Chemical Data Processing Library C++ API - Version 1.4.0
FastGaussianShapeOverlapFunction.hpp
Go to the documentation of this file.
1 /*
2  * FastGaussianShapeOverlapFunction.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_FASTGAUSSIANSHAPEOVERLAPFUNCTION_HPP
30 #define CDPL_SHAPE_FASTGAUSSIANSHAPEOVERLAPFUNCTION_HPP
31 
32 #include <memory>
33 
34 #include "CDPL/Shape/APIPrefix.hpp"
36 
37 
38 namespace CDPL
39 {
40 
41  namespace Shape
42  {
43 
44  class GaussianProductList;
45 
58  {
59 
60  public:
62  static constexpr double DEF_RADIUS_SCALING_FACTOR = 1.4;
63 
65  typedef std::shared_ptr<FastGaussianShapeOverlapFunction> SharedPointer;
66 
71 
77 
84  const GaussianShapeFunction& ovl_shape_func);
85 
90 
95  void proximityOptimization(bool enable);
96 
101  bool proximityOptimization() const;
102 
107  void setRadiusScalingFactor(double factor);
108 
113  double getRadiusScalingFactor() const;
114 
119  void fastExpFunction(bool enable);
120 
125  bool fastExpFunction() const;
126 
132  void setShapeFunction(const GaussianShapeFunction& func, bool is_ref);
133 
139  const GaussianShapeFunction* getShapeFunction(bool ref) const;
140 
146 
152 
158 
164 
170  double calcSelfOverlap(bool ref) const;
171 
177  double calcColorSelfOverlap(bool ref) const;
178 
183  double calcOverlap() const;
184 
189  double calcColorOverlap() const;
190 
196  double calcOverlap(const Math::Vector3DArray& coords) const;
197 
203  double calcColorOverlap(const Math::Vector3DArray& coords) const;
204 
211  double calcOverlapGradient(const Math::Vector3DArray& coords, Math::Vector3DArray& grad) const;
212 
219 
220  private:
221  bool checkShapeFuncsNotNull() const;
222 
223  double calcOverlap(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
224  bool color) const;
225  double calcOverlapExact(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
226  bool color) const;
227  double calcOverlapFastExp(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
228  bool color) const;
229  double calcOverlapProxCheck(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
230  bool color) const;
231  double calcOverlapFastExpProxCheck(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
232  bool color) const;
233 
234  double calcOverlap(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
235  const Math::Vector3DArray& coords, bool color) const;
236  double calcOverlapExact(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
237  const Math::Vector3DArray& coords, bool color) const;
238  double calcOverlapFastExp(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
239  const Math::Vector3DArray& coords, bool color) const;
240  double calcOverlapProxCheck(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
241  const Math::Vector3DArray& coords, bool color) const;
242  double calcOverlapFastExpProxCheck(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
243  const Math::Vector3DArray& coords, bool color) const;
244 
245  double calcOverlapGradient(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
246  const Math::Vector3DArray& coords, Math::Vector3DArray& grad) const;
247  double calcOverlapGradientExact(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
248  const Math::Vector3DArray& coords, Math::Vector3DArray& grad) const;
249  double calcOverlapGradientFastExp(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
250  const Math::Vector3DArray& coords, Math::Vector3DArray& grad) const;
251  double calcOverlapGradientProxCheck(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
252  const Math::Vector3DArray& coords, Math::Vector3DArray& grad) const;
253  double calcOverlapGradientFastExpProxCheck(const GaussianProductList* ref_prod_list, const GaussianProductList* ovl_prod_list,
254  const Math::Vector3DArray& coords, Math::Vector3DArray& grad) const;
255 
256  const GaussianShapeFunction* refShapeFunc;
257  const GaussianShapeFunction* ovlShapeFunc;
258  ColorMatchFunction colorMatchFunc;
259  ColorFilterFunction colorFilterFunc;
260  bool proximityOpt;
261  bool fastExpFunc;
262  double radScalingFact;
263  };
264  } // namespace Shape
265 } // namespace CDPL
266 
267 #endif // CDPL_SHAPE_FASTGAUSSIANSHAPEOVERLAPFUNCTION_HPP
Definition of class CDPL::Shape::GaussianShapeOverlapFunction.
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.
Shape::GaussianShapeOverlapFunction implementation that uses two approximation techniques to trade so...
Definition: FastGaussianShapeOverlapFunction.hpp:58
void setRadiusScalingFactor(double factor)
Sets the scaling factor applied to Van der Waals radii during the proximity check.
void proximityOptimization(bool enable)
Enables or disables the proximity-check pruning of Gaussian-product pair contributions.
const ColorFilterFunction & getColorFilterFunction() const
Returns the currently configured color-filter function.
void setShapeFunction(const GaussianShapeFunction &func, bool is_ref)
Specifies the reference or aligned shape function used by the overlap evaluation.
FastGaussianShapeOverlapFunction & operator=(const FastGaussianShapeOverlapFunction &func)
Copy assignment operator.
double calcOverlap(const Math::Vector3DArray &coords) const
Calculates the shape-only overlap with the aligned shape element positions taken from coords.
double calcOverlap() const
Calculates the shape-only overlap of the reference and aligned shape functions.
void fastExpFunction(bool enable)
Enables or disables the use of a fast approximation for the exponential function.
bool proximityOptimization() const
Tells whether the proximity-check pruning is enabled.
void setColorFilterFunction(const ColorFilterFunction &func)
Specifies the function used to filter color features by type.
const ColorMatchFunction & getColorMatchFunction() const
Returns the currently configured color-match function.
const GaussianShapeFunction * getShapeFunction(bool ref) const
Returns the reference or aligned shape function.
double calcOverlapGradient(const Math::Vector3DArray &coords, Math::Vector3DArray &grad) const
Calculates the shape overlap with the aligned shape element positions taken from coords and returns t...
FastGaussianShapeOverlapFunction(const GaussianShapeFunction &ref_shape_func, const GaussianShapeFunction &ovl_shape_func)
Constructs the FastGaussianShapeOverlapFunction instance with the given reference and aligned shape f...
double calcSelfOverlap(bool ref) const
Calculates the shape-only self-overlap of the reference or aligned shape function.
void setColorMatchFunction(const ColorMatchFunction &func)
Specifies the function used to decide whether two color features match.
double getRadiusScalingFactor() const
Returns the currently configured radius scaling factor.
bool fastExpFunction() const
Tells whether the fast-exponential approximation is enabled.
double calcColorOverlap() const
Calculates the color overlap of the reference and aligned shape functions.
double calcColorOverlap(const Math::Vector3DArray &coords) const
Calculates the color overlap with the aligned shape element positions taken from coords.
std::shared_ptr< FastGaussianShapeOverlapFunction > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated FastGaussianShapeOverlapFunction ...
Definition: FastGaussianShapeOverlapFunction.hpp:65
FastGaussianShapeOverlapFunction(const FastGaussianShapeOverlapFunction &func)
Constructs a copy of the FastGaussianShapeOverlapFunction instance func.
double calcColorSelfOverlap(bool ref) const
Calculates the color self-overlap of the reference or aligned shape function.
FastGaussianShapeOverlapFunction()
Constructs the FastGaussianShapeOverlapFunction instance without associated shape functions.
Function representation of a Gaussian shape, used to evaluate the shape's density,...
Definition: GaussianShapeFunction.hpp:61
Abstract base class for functions evaluating the overlap between two Gaussian shape functions.
Definition: GaussianShapeOverlapFunction.hpp:56
std::function< bool(std::size_t)> ColorFilterFunction
Type of the function used to filter color (pharmacophore) features by type.
Definition: GaussianShapeOverlapFunction.hpp:63
std::function< bool(std::size_t, std::size_t)> ColorMatchFunction
Type of the function used to decide whether two color features match.
Definition: GaussianShapeOverlapFunction.hpp:66
VectorArray< Vector3D > Vector3DArray
Array storing vectors of type Math::Vector3D.
Definition: VectorArray.hpp:85
The namespace of the Chemical Data Processing Library.