Chemical Data Processing Library C++ API - Version 1.4.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 
64  {
65 
66  public:
70  static constexpr double DEF_PROBE_RADIUS = 1.2;
74  static constexpr double DEF_GRID_OVERSIZE = 5.0;
78  static constexpr double DEF_GRID_STEP_SIZE = 0.75;
82  static constexpr double DEF_MIN_SURFACE_ACC = 0.01;
86  static constexpr std::size_t DEF_NUM_TEST_POINTS = 250;
87 
92 
99  SurfaceAtomExtractor(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph, Fragment& frag);
100 
106  void setProbeRadius(double radius);
107 
112  double getProbeRadius() const;
113 
119  void setGridStepSize(double size);
120 
125  double getGridStepSize() const;
126 
133  void setGridOversize(double size);
134 
140  double getGridOversize() const;
141 
148  void setMinSurfaceAccessibility(double min_acc);
149 
156 
162  void setNumTestPoints(std::size_t num_points);
163 
168  std::size_t getNumTestPoints() const;
169 
175 
181 
189  void extract(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph, Fragment& frag);
190 
191  private:
192  typedef std::vector<double> AtomRadiusTable;
193  typedef std::vector<std::size_t> AtomIndexList;
194  typedef std::shared_ptr<AtomIndexList> AtomIndexListPtr;
195  typedef std::vector<AtomIndexListPtr> GridAtomLookupTable;
196  typedef std::vector<Math::Vector3D> Vector3DArray;
197 
198  bool init(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph);
199 
200  void transformCoordinates();
201  void calcBoundingBox();
202  void initGridAtomLookupTable();
203  void extractSurfaceAtoms(Fragment& frag);
204 
205  void initTestPoints();
206 
207  double probeRadius;
208  double gridOversize;
209  double gridStepSize;
210  double minSurfAcc;
211  std::size_t numTestPoints;
212  Atom3DCoordinatesFunction coordsFunc;
213  const AtomContainer* atomContainer;
214  const MolecularGraph* parentMolGraph;
215  AtomRadiusTable atomRadii;
216  AtomIndexList atomIndices;
218  Vector3DArray atomCoords;
219  Vector3DArray testPoints;
220  Math::Vector3D bBoxMin;
221  Math::Vector3D bBoxMax;
222  std::size_t gridXSize;
223  std::size_t gridYSize;
224  std::size_t gridZSize;
225  GridAtomLookupTable gridAtomLookup;
226  };
227  } // namespace Chem
228 } // namespace CDPL
229 
230 #endif // CDPL_CHEM_SURFACEATOMEXTRACTOR_HPP
Type declaration of a generic wrapper class for storing user-defined Chem::Atom 3D coordinates functi...
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.
Common interface for data structures that support a random access to stored Chem::Atom instances.
Definition: AtomContainer.hpp:55
Concrete implementation of the Chem::MolecularGraph interface that stores references to selectable Ch...
Definition: Fragment.hpp:60
Abstract base class for data structures that represent chemical structures as molecular graphs.
Definition: MolecularGraph.hpp:60
Identifies the accessible surface atoms in a given set of atoms.
Definition: SurfaceAtomExtractor.hpp:64
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.
double getProbeRadius() const
Returns the radius of the probe sphere that determines the accessibility of the surface atoms.
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)
Computes the axis-aligned bounding box enclosing the atoms of cntnr.
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:87
CVector< double, 3 > Vector3D
Bounded 3 element vector holding floating-point values of type double.
Definition: Vector.hpp:3218
The namespace of the Chemical Data Processing Library.