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:
67  static constexpr std::size_t DEF_MAX_PRODUCT_ORDER = 6;
68 
72  static constexpr double DEF_DISTANCE_CUTOFF = 0.0;
73 
77  typedef std::shared_ptr<GaussianShapeFunction> SharedPointer;
78 
83 
89 
95 
100 
105  void setMaxOrder(std::size_t max_order);
106 
111  std::size_t getMaxOrder() const;
112 
117  void setDistanceCutoff(double cutoff);
118 
123  double getDistanceCutoff() const;
124 
129  void setShape(const GaussianShape& shape);
130 
135  const GaussianShape* getShape() const;
136 
140  void reset();
141 
146  void transform(const Math::Matrix4D& xform);
147 
154  const Math::Vector3D& getElementPosition(std::size_t idx) const;
155 
161 
167  double calcDensity(const Math::Vector3D& pos) const;
168 
173  double calcVolume() const;
174 
179  double calcSurfaceArea() const;
180 
186  double calcSurfaceArea(std::size_t elem_idx) const;
187 
192  void calcCentroid(Math::Vector3D& ctr) const;
193 
199  void calcQuadrupoleTensor(const Math::Vector3D& ctr, Math::Matrix3D& quad_tensor) const;
200 
207 
208  private:
211 
212  const GaussianProductList* getProductList() const;
213 
214  typedef std::unique_ptr<GaussianProductList> ProductListPtr;
215 
216  const GaussianShape* shape;
217  double volume;
218  ProductListPtr prodList;
219  };
220  } // namespace Shape
221 } // namespace CDPL
222 
223 #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:77
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:87
CVector< double, 3 > Vector3D
Bounded 3 element vector holding floating-point values of type double.
Definition: Vector.hpp:3218
CMatrix< double, 3, 3 > Matrix3D
Bounded 3×3 matrix holding floating-point values of type double.
Definition: Matrix.hpp:3504
The namespace of the Chemical Data Processing Library.