Chemical Data Processing Library C++ API - Version 1.4.0
GaussianShapeFunction.hpp
Go to the documentation of this file.
1 /*
2  * GaussianShapeFunction.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_GAUSSIANSHAPEFUNCTION_HPP
30 #define CDPL_SHAPE_GAUSSIANSHAPEFUNCTION_HPP
31 
32 #include <cstddef>
33 #include <memory>
34 
35 #include "CDPL/Shape/APIPrefix.hpp"
36 #include "CDPL/Math/Vector.hpp"
37 #include "CDPL/Math/Matrix.hpp"
39 
40 
41 namespace CDPL
42 {
43 
44  namespace Shape
45  {
46 
47  class GaussianShape;
48  class GaussianProductList;
49  class ExactGaussianShapeOverlapFunction;
50  class FastGaussianShapeOverlapFunction;
51 
61  {
62 
63  public:
65  static constexpr std::size_t DEF_MAX_PRODUCT_ORDER = 6;
66 
68  static constexpr double DEF_DISTANCE_CUTOFF = 0.0;
69 
71  typedef std::shared_ptr<GaussianShapeFunction> SharedPointer;
72 
75 
81 
87 
90 
95  void setMaxOrder(std::size_t max_order);
96 
101  std::size_t getMaxOrder() const;
102 
107  void setDistanceCutoff(double cutoff);
108 
113  double getDistanceCutoff() const;
114 
119  void setShape(const GaussianShape& shape);
120 
125  const GaussianShape* getShape() const;
126 
128  void reset();
129 
134  void transform(const Math::Matrix4D& xform);
135 
142  const Math::Vector3D& getElementPosition(std::size_t idx) const;
143 
149 
155  double calcDensity(const Math::Vector3D& pos) const;
156 
161  double calcVolume() const;
162 
167  double calcSurfaceArea() const;
168 
174  double calcSurfaceArea(std::size_t elem_idx) const;
175 
180  void calcCentroid(Math::Vector3D& ctr) const;
181 
187  void calcQuadrupoleTensor(const Math::Vector3D& ctr, Math::Matrix3D& quad_tensor) const;
188 
195 
196  private:
199 
200  const GaussianProductList* getProductList() const;
201 
202  typedef std::unique_ptr<GaussianProductList> ProductListPtr;
203 
204  const GaussianShape* shape;
205  double volume;
206  ProductListPtr prodList;
207  };
208  } // namespace Shape
209 } // namespace CDPL
210 
211 #endif // CDPL_SHAPE_GAUSSIANSHAPEFUNCTION_HPP
Definition of matrix data types.
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 class CDPL::Math::VectorArray.
Definition of vector data types.
Shape::GaussianShapeOverlapFunction implementation that evaluates the overlap analytically using the ...
Definition: ExactGaussianShapeOverlapFunction.hpp:54
Shape::GaussianShapeOverlapFunction implementation that uses two approximation techniques to trade so...
Definition: FastGaussianShapeOverlapFunction.hpp:58
Function representation of a Gaussian shape, used to evaluate the shape's density,...
Definition: GaussianShapeFunction.hpp:61
void getElementPositions(Math::Vector3DArray &coords) const
Returns the 3D positions of all elements of the associated shape.
void setShape(const GaussianShape &shape)
Associates the function with the Gaussian shape shape.
double calcVolume() const
Calculates the total volume enclosed by the Gaussian shape.
void transform(const Math::Matrix4D &xform)
Applies an affine transformation to the element positions of the associated shape.
double getDistanceCutoff() const
Returns the currently configured distance cutoff.
GaussianShapeFunction(const GaussianShape &shape)
Constructs the GaussianShapeFunction instance associated with shape.
void reset()
Resets the function by discarding the cached Gaussian-product expansion.
const Math::Vector3D & getElementPosition(std::size_t idx) const
Returns the 3D position of the element at index idx.
GaussianShapeFunction(const GaussianShapeFunction &func)
Constructs a copy of the GaussianShapeFunction instance func.
std::size_t getMaxOrder() const
Returns the currently configured maximum order of the Gaussian-product expansion.
GaussianShapeFunction & operator=(const GaussianShapeFunction &func)
Copy assignment operator.
void setMaxOrder(std::size_t max_order)
Sets the maximum order of the Gaussian-product expansion.
double calcDensity(const Math::Vector3D &pos) const
Evaluates the Gaussian density of the shape at the 3D position pos.
const GaussianShape * getShape() const
Returns a pointer to the associated Gaussian shape (or nullptr if none is associated).
std::shared_ptr< GaussianShapeFunction > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated GaussianShapeFunction instances.
Definition: GaussianShapeFunction.hpp:71
void setDistanceCutoff(double cutoff)
Sets the distance cutoff for pruning negligible Gaussian-product contributions.
void calcCentroid(Math::Vector3D &ctr) const
Calculates the centroid of the Gaussian shape.
double calcSurfaceArea(std::size_t elem_idx) const
Calculates the surface area contribution of the single element at index elem_idx.
void calcQuadrupoleTensor(const Math::Vector3D &ctr, Math::Matrix3D &quad_tensor) const
Calculates the quadrupole tensor of the Gaussian shape with respect to the reference point ctr.
double calcSurfaceArea() const
Calculates the total surface area of the Gaussian shape.
GaussianShapeFunction()
Constructs the GaussianShapeFunction instance without an associated shape.
Data type for the descripton of arbitrary shapes composed of spheres approximated by gaussian functio...
Definition: GaussianShape.hpp:51
VectorArray< Vector3D > Vector3DArray
Array storing vectors of type Math::Vector3D.
Definition: VectorArray.hpp:85
CVector< double, 3 > Vector3D
Bounded 3 element vector holding floating point values of type double.
Definition: Vector.hpp:2937
CMatrix< double, 3, 3 > Matrix3D
Bounded 3x3 matrix holding floating point values of type double.
Definition: Matrix.hpp:3180
The namespace of the Chemical Data Processing Library.