Chemical Data Processing Library C++ API - Version 1.2.0
SurfaceAtomExtractor.hpp
Go to the documentation of this file.
1 /*
2  * SurfaceAtomExtractor.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_CHEM_SURFACEATOMEXTRACTOR_HPP
30 #define CDPL_CHEM_SURFACEATOMEXTRACTOR_HPP
31 
32 #include <vector>
33 #include <cstddef>
34 #include <memory>
35 
36 #include "CDPL/Chem/APIPrefix.hpp"
38 #include "CDPL/Math/Matrix.hpp"
39 #include "CDPL/Math/Vector.hpp"
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Chem
46  {
47 
48  class MolecularGraph;
49  class AtomContainer;
50  class Fragment;
51 
56  {
57 
58  public:
59  static constexpr double DEF_PROBE_RADIUS = 1.2;
60  static constexpr double DEF_GRID_OVERSIZE = 5.0;
61  static constexpr double DEF_GRID_STEP_SIZE = 0.75;
62  static constexpr double DEF_MIN_SURFACE_ACC = 0.01;
63  static constexpr std::size_t DEF_NUM_TEST_POINTS = 250;
64 
69 
76  SurfaceAtomExtractor(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph, Fragment& frag);
77 
83  void setProbeRadius(double radius);
84 
85  /*
86  * \brief Returns the radius of the probe sphere that determines the accessibility of the surface atoms.
87  * \return The used probe sphere radius.
88  */
89  double getProbeRadius() const;
90 
96  void setGridStepSize(double size);
97 
102  double getGridStepSize() const;
103 
110  void setGridOversize(double size);
111 
117  double getGridOversize() const;
118 
125  void setMinSurfaceAccessibility(double min_acc);
126 
133 
139  void setNumTestPoints(std::size_t num_points);
140 
145  std::size_t getNumTestPoints() const;
146 
152 
158 
166  void extract(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph, Fragment& frag);
167 
168  private:
169  typedef std::vector<double> AtomRadiusTable;
170  typedef std::vector<std::size_t> AtomIndexList;
171  typedef std::shared_ptr<AtomIndexList> AtomIndexListPtr;
172  typedef std::vector<AtomIndexListPtr> GridAtomLookupTable;
173  typedef std::vector<Math::Vector3D> Vector3DArray;
174 
175  bool init(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph);
176 
177  void transformCoordinates();
178  void calcBoundingBox();
179  void initGridAtomLookupTable();
180  void extractSurfaceAtoms(Fragment& frag);
181 
182  void initTestPoints();
183 
184  double probeRadius;
185  double gridOversize;
186  double gridStepSize;
187  double minSurfAcc;
188  std::size_t numTestPoints;
189  Atom3DCoordinatesFunction coordsFunc;
190  const AtomContainer* atomContainer;
191  const MolecularGraph* parentMolGraph;
192  AtomRadiusTable atomRadii;
193  AtomIndexList atomIndices;
195  Vector3DArray atomCoords;
196  Vector3DArray testPoints;
197  Math::Vector3D bBoxMin;
198  Math::Vector3D bBoxMax;
199  std::size_t gridXSize;
200  std::size_t gridYSize;
201  std::size_t gridZSize;
202  GridAtomLookupTable gridAtomLookup;
203  };
204  } // namespace Chem
205 } // namespace CDPL
206 
207 #endif // CDPL_CHEM_SURFACEATOMEXTRACTOR_HPP
Type definition of a generic wrapper class for storing user-defined Chem::Atom 3D-coordinates functio...
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of matrix data types.
Definition of vector data types.
A common interface for data-structures that support a random access to stored Chem::Atom instances.
Definition: AtomContainer.hpp:55
Fragment.
Definition: Fragment.hpp:52
MolecularGraph.
Definition: MolecularGraph.hpp:52
SurfaceAtomExtractor.
Definition: SurfaceAtomExtractor.hpp:56
void setGridStepSize(double size)
Specifies the distance between the grid-points in space which store lists of atoms with proximal posi...
const Atom3DCoordinatesFunction & getAtom3DCoordinatesFunction() const
Returns the function that was registered for the retrieval of atom 3D-coordinates.
void setGridOversize(double size)
Specifies the margin that gets added to each side of the molecular graph's bounding-box for the calcu...
std::size_t getNumTestPoints() const
Returns the number of points on the atom surface at which a test for surface accessibility is carried...
void setMinSurfaceAccessibility(double min_acc)
Specifies the minimum fraction of test points that have to be accessible by the probe sphere to consi...
double getGridStepSize() const
Return the distance between the grid-points for proximal atom lookup.
SurfaceAtomExtractor()
Constructs the SurfaceAtomExtractor instance.
double getMinSurfaceAccessibility() const
Returns the minimum fraction of test points that have to be accessible by the probe sphere to conside...
SurfaceAtomExtractor(const AtomContainer &cntnr, const MolecularGraph &parent_molgraph, Fragment &frag)
Perceives the surface accessible atoms of cntnr and adds them to the fragment frag.
void setAtom3DCoordinatesFunction(const Atom3DCoordinatesFunction &func)
Specifies a function for the retrieval of atom 3D-coordinates.
void setNumTestPoints(std::size_t num_points)
Specifies the number of points on the atom surface at which a test for surface accessibility is carri...
double getGridOversize() const
Returns the margin that gets added to each side of the molecular graph's bounding-box for the calcula...
void extract(const AtomContainer &cntnr, const MolecularGraph &parent_molgraph, Fragment &frag)
Perceives the surface accessible atoms of cntnr that are part of molgraph and adds them to the fragme...
void setProbeRadius(double radius)
Specifies the radius of the probe sphere that determines the accessibility of the surface atoms.
CDPL_CHEM_API void calcBoundingBox(const AtomContainer &cntnr, Math::Vector3D &min, Math::Vector3D &max, const Atom3DCoordinatesFunction &coords_func, bool reset=true)
std::function< const Math::Vector3D &(const Chem::Atom &)> Atom3DCoordinatesFunction
A generic wrapper class used to store a user-defined Chem::Atom 3D-coordinates function.
Definition: Atom3DCoordinatesFunction.hpp:43
VectorArray< Vector3D > Vector3DArray
An array of Math::Vector3D objects.
Definition: VectorArray.hpp:84
CVector< double, 3 > Vector3D
A bounded 3 element vector holding floating point values of type double.
Definition: Vector.hpp:1637
The namespace of the Chemical Data Processing Library.