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 
63  {
64 
65  public:
69  static constexpr double DEF_PROBE_RADIUS = 1.2;
73  static constexpr double DEF_GRID_OVERSIZE = 5.0;
77  static constexpr double DEF_GRID_STEP_SIZE = 0.75;
81  static constexpr double DEF_MIN_SURFACE_ACC = 0.01;
85  static constexpr std::size_t DEF_NUM_TEST_POINTS = 250;
86 
91 
98  SurfaceAtomExtractor(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph, Fragment& frag);
99 
105  void setProbeRadius(double radius);
106 
111  double getProbeRadius() const;
112 
118  void setGridStepSize(double size);
119 
124  double getGridStepSize() const;
125 
132  void setGridOversize(double size);
133 
139  double getGridOversize() const;
140 
147  void setMinSurfaceAccessibility(double min_acc);
148 
155 
161  void setNumTestPoints(std::size_t num_points);
162 
167  std::size_t getNumTestPoints() const;
168 
174 
180 
188  void extract(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph, Fragment& frag);
189 
190  private:
191  typedef std::vector<double> AtomRadiusTable;
192  typedef std::vector<std::size_t> AtomIndexList;
193  typedef std::shared_ptr<AtomIndexList> AtomIndexListPtr;
194  typedef std::vector<AtomIndexListPtr> GridAtomLookupTable;
195  typedef std::vector<Math::Vector3D> Vector3DArray;
196 
197  bool init(const AtomContainer& cntnr, const MolecularGraph& parent_molgraph);
198 
199  void transformCoordinates();
200  void calcBoundingBox();
201  void initGridAtomLookupTable();
202  void extractSurfaceAtoms(Fragment& frag);
203 
204  void initTestPoints();
205 
206  double probeRadius;
207  double gridOversize;
208  double gridStepSize;
209  double minSurfAcc;
210  std::size_t numTestPoints;
211  Atom3DCoordinatesFunction coordsFunc;
212  const AtomContainer* atomContainer;
213  const MolecularGraph* parentMolGraph;
214  AtomRadiusTable atomRadii;
215  AtomIndexList atomIndices;
217  Vector3DArray atomCoords;
218  Vector3DArray testPoints;
219  Math::Vector3D bBoxMin;
220  Math::Vector3D bBoxMax;
221  std::size_t gridXSize;
222  std::size_t gridYSize;
223  std::size_t gridZSize;
224  GridAtomLookupTable gridAtomLookup;
225  };
226  } // namespace Chem
227 } // namespace CDPL
228 
229 #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 Chem::MolecularGraph implementation that stores references to a selectable subset of atoms a...
Definition: Fragment.hpp:57
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Extracts the solvent-accessible surface atoms of a set of atoms.
Definition: SurfaceAtomExtractor.hpp:63
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: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.