Chemical Data Processing Library C++ API - Version 1.4.0
AtomDensityGridCalculator.hpp
Go to the documentation of this file.
1 /*
2  * AtomDensityGridCalculator.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_GRAIL_ATOMDENSITYGRIDCALCULATOR_HPP
30 #define CDPL_GRAIL_ATOMDENSITYGRIDCALCULATOR_HPP
31 
32 #include <vector>
33 #include <cstddef>
34 #include <memory>
35 #include <functional>
36 
37 #include "CDPL/GRAIL/APIPrefix.hpp"
38 #include "CDPL/Math/Vector.hpp"
42 
43 
44 namespace CDPL
45 {
46 
47  // \cond DOC_IMPL_DETAILS
48  namespace Internal
49  {
50 
51  template <typename PT, typename CT, typename ST>
52  class Octree;
53  }
54  // \endcond
55 
56  namespace Chem
57  {
58 
59  class AtomContainer;
60  }
61 
62  namespace GRAIL
63  {
64 
73  {
74 
75  public:
79  static constexpr double DEF_DISTANCE_CUTOFF = 4.5;
80 
84  typedef std::shared_ptr<AtomDensityGridCalculator> SharedPointer;
85 
89  typedef std::function<double(const Math::Vector3D&, const Math::Vector3D&, const Chem::Atom&)> DensityFunction;
90 
94  typedef std::function<double(const Math::DVector&)> DensityCombinationFunction;
95 
100 
106 
112 
119 
124  void setDistanceCutoff(double dist);
125 
130  double getDistanceCutoff() const;
131 
137 
143 
149 
155 
161 
167 
174 
181 
182  private:
183  typedef Internal::Octree<Math::Vector3D, Math::Vector3DArray, double> Octree;
184  typedef std::shared_ptr<Octree> OctreePtr;
185  typedef std::vector<std::size_t> AtomIndexList;
186 
187  Math::DVector partialDensities;
188  DensityFunction densityFunc;
189  DensityCombinationFunction densityCombinationFunc;
191  double distCutoff;
192  OctreePtr octree;
193  Math::Vector3DArray atomCoords;
194  AtomIndexList atomIndices;
195  };
196  } // namespace GRAIL
197 } // namespace CDPL
198 
199 #endif // CDPL_GRAIL_ATOMDENSITYGRIDCALCULATOR_HPP
Type declaration of a generic wrapper class for storing user-defined Chem::Atom 3D-coordinates functi...
Definition of the preprocessor macro CDPL_GRAIL_API.
#define CDPL_GRAIL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of a spatial grid data type.
Definition of class CDPL::Math::VectorArray.
Definition of vector data types.
Common interface for data structures that support a random access to stored Chem::Atom instances.
Definition: AtomContainer.hpp:55
Abstract base class representing a chemical atom and its bonded neighborhood.
Definition: Atom.hpp:57
Calculator that fills a spatial grid with combined per-atom density contributions.
Definition: AtomDensityGridCalculator.hpp:73
void setAtom3DCoordinatesFunction(const Chem::Atom3DCoordinatesFunction &func)
Specifies a function for the retrieval of atom 3D-coordinates for grid calculation.
void setDistanceCutoff(double dist)
Sets the distance cutoff beyond which atoms are not considered.
const Chem::Atom3DCoordinatesFunction & getAtom3DCoordinatesFunction() const
Returns the function used for the retrieval of atom 3D-coordinates.
void setDensityCombinationFunction(const DensityCombinationFunction &func)
Sets the function used to combine per-atom density contributions.
AtomDensityGridCalculator(const AtomDensityGridCalculator &calc)
Constructs a copy of the AtomDensityGridCalculator instance calc.
std::function< double(const Math::DVector &)> DensityCombinationFunction
Type of the generic functor that combines per-atom density contributions into a single value.
Definition: AtomDensityGridCalculator.hpp:94
const DensityCombinationFunction & getDensityCombinationFunction() const
Returns the currently configured density-combination function.
const DensityFunction & getDensityFunction() const
Returns the currently configured density function.
AtomDensityGridCalculator & operator=(const AtomDensityGridCalculator &calc)
Copy assignment operator.
void setDensityFunction(const DensityFunction &func)
Sets the density function used to evaluate per-atom contributions.
std::shared_ptr< AtomDensityGridCalculator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated AtomDensityGridCalculator instanc...
Definition: AtomDensityGridCalculator.hpp:84
void calculate(const Chem::AtomContainer &atoms, Grid::DSpatialGrid &grid)
Calculates the combined per-atom density at each cell of grid for the given atoms.
AtomDensityGridCalculator(const DensityFunction &density_func, const DensityCombinationFunction &comb_func)
Constructs the AtomDensityGridCalculator instance with the given density and density-combination func...
double getDistanceCutoff() const
Returns the currently configured distance cutoff.
std::function< double(const Math::Vector3D &, const Math::Vector3D &, const Chem::Atom &)> DensityFunction
Type of the generic functor that evaluates the density contribution of an atom at a query position.
Definition: AtomDensityGridCalculator.hpp:89
AtomDensityGridCalculator(const DensityFunction &func)
Constructs the AtomDensityGridCalculator instance with the given density function.
AtomDensityGridCalculator()
Constructs the AtomDensityGridCalculator instance.
Abstract base class for attributed grids whose elements have a defined 3D position in space.
Definition: SpatialGrid.hpp:53
std::function< const Math::Vector3D &(const Chem::Atom &)> Atom3DCoordinatesFunction
Generic wrapper class used to store a user-defined Chem::Atom 3D-coordinates function.
Definition: Atom3DCoordinatesFunction.hpp:43
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
The namespace of the Chemical Data Processing Library.