Chemical Data Processing Library C++ API - Version 1.2.0
RMSDConformerSelector.hpp
Go to the documentation of this file.
1 /*
2  * RMSDConformerSelector.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_CONFGEN_RMSDCONFORMERSELECTOR_HPP
30 #define CDPL_CONFGEN_RMSDCONFORMERSELECTOR_HPP
31 
32 #include <vector>
33 #include <cstddef>
34 #include <unordered_map>
35 
38 #include "CDPL/Chem/Fragment.hpp"
41 #include "CDPL/Util/BitSet.hpp"
43 #include "CDPL/Util/ObjectPool.hpp"
46 
47 
48 namespace CDPL
49 {
50 
51  namespace ConfGen
52  {
53 
55  {
56 
57  public:
58  static constexpr std::size_t DEF_MAX_NUM_SYMMETRY_MAPPINGS = 32768;
59 
61 
63 
65 
66  void setMinRMSD(double min_rmsd);
67 
68  double getMinRMSD() const;
69 
71 
73 
74  std::size_t getNumSymmetryMappings() const;
75 
76  void setMaxNumSymmetryMappings(std::size_t max_num);
77 
78  std::size_t getMaxNumSymmetryMappings() const;
79 
80  void setup(const Chem::MolecularGraph& molgraph, const Util::BitSet& atom_mask);
81 
82  void setup(const Chem::MolecularGraph& molgraph, const Util::BitSet& atom_mask,
83  const Util::BitSet& stable_config_atom_mask, const Math::Vector3DArray& coords);
84 
85  bool selected(const Math::Vector3DArray& conf_coords);
86 
87  private:
88  typedef std::vector<std::size_t> IndexArray;
90  typedef VectorArrayCache::SharedObjectPointer VectorArrayPtr;
91 
92  void buildSymMappingSearchMolGraph(const Util::BitSet& atom_mask);
93  void setupSymMappingValidationData(const Util::BitSet& stable_config_atom_mask,
94  const Math::Vector3DArray& conf_coords);
95 
96  bool processSymMapping(const Chem::MolecularGraph& molgraph,
97  const Chem::AtomBondMapping& mapping);
98  bool isValidSymMapping(const Chem::AtomBondMapping& mapping) const;
99 
100  VectorArrayPtr buildCoordsArrayForMapping(const IndexArray& mapping,
101  const Math::Vector3DArray& conf_coords);
102 
103  typedef std::unordered_map<const Chem::Atom*, Chem::StereoDescriptor> AtomStereoDescriptorMap;
104  typedef std::vector<const Chem::Atom*> AtomList;
106  typedef std::vector<IndexArray*> IndexArrayList;
107  typedef std::vector<VectorArrayPtr> VectorArrayList;
109 
110  IndexArrayCache idxArrayCache;
111  VectorArrayCache vecArrayCache;
112  const Chem::MolecularGraph* molGraph;
113  Chem::AutomorphismGroupSearch symMappingSearch;
114  Chem::Fragment symMappingSearchMolGraph;
115  IndexArrayList symMappings;
116  AtomStereoDescriptorMap atomStereoDescrs;
117  AlignmentCalculator alignmentCalc;
118  VectorArrayList confAlignCoords;
119  VectorArrayList selectedConfAlignCoords;
120  AtomList atomNeighbors;
121  double minRMSD;
122  std::size_t maxNumSymMappings;
123  CallbackFunction abortCallback;
124  };
125  } // namespace ConfGen
126 } // namespace CDPL
127 
128 #endif // CDPL_CONFGEN_RMSDCONFORMERSELECTOR_HPP
Definition of the class CDPL::Chem::AutomorphismGroupSearch.
Definition of the type CDPL::Util::BitSet.
Type definition of a generic wrapper class for storing user-defined callback functions.
Definition of the preprocessor macro CDPL_CONFGEN_API.
#define CDPL_CONFGEN_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of the class CDPL::Chem::Fragment.
Definition of the class CDPL::Util::ObjectPool.
Definition of the class CDPL::Util::ObjectStack.
Definition of the type CDPL::Chem::StereoDescriptor.
Implementation of the Kabsch algorithm.
Definition of the class CDPL::Math::VectorArray.
A data structure for the common storage of related atom to atom and bond to bond mappings.
Definition: AtomBondMapping.hpp:55
AutomorphismGroupSearch.
Definition: AutomorphismGroupSearch.hpp:52
Fragment.
Definition: Fragment.hpp:52
MolecularGraph.
Definition: MolecularGraph.hpp:52
Definition: RMSDConformerSelector.hpp:55
RMSDConformerSelector & operator=(const RMSDConformerSelector &)=delete
void setMinRMSD(double min_rmsd)
const CallbackFunction & getAbortCallback() const
void setMaxNumSymmetryMappings(std::size_t max_num)
RMSDConformerSelector(const RMSDConformerSelector &)=delete
std::size_t getMaxNumSymmetryMappings() const
void setAbortCallback(const CallbackFunction &func)
void setup(const Chem::MolecularGraph &molgraph, const Util::BitSet &atom_mask)
void setup(const Chem::MolecularGraph &molgraph, const Util::BitSet &atom_mask, const Util::BitSet &stable_config_atom_mask, const Math::Vector3DArray &coords)
std::size_t getNumSymmetryMappings() const
bool selected(const Math::Vector3DArray &conf_coords)
std::shared_ptr< ObjectType > SharedObjectPointer
Definition: ObjectPool.hpp:65
std::function< bool()> CallbackFunction
A generic wrapper class used to store a user-defined callback functions (see [FUNWRP]).
Definition: CallbackFunction.hpp:44
VectorArray< Vector3D > Vector3DArray
An array of Math::Vector3D objects.
Definition: VectorArray.hpp:84
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.