Chemical Data Processing Library C++ API - Version 1.4.0
TorsionDriver.hpp
Go to the documentation of this file.
1 /*
2  * TorsionDriver.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_TORSIONDRIVER_HPP
30 #define CDPL_CONFGEN_TORSIONDRIVER_HPP
31 
32 #include <cstddef>
33 #include <memory>
34 
35 #include <boost/iterator/indirect_iterator.hpp>
36 
43 #include "CDPL/Util/BitSet.hpp"
44 
45 
46 namespace CDPL
47 {
48 
49  namespace Chem
50  {
51 
52  class MolecularGraph;
53  class Fragment;
54  } // namespace Chem
55 
56  namespace ConfGen
57  {
58 
59  class TorsionDriverImpl;
60 
66  {
67 
68  public:
70  typedef boost::indirect_iterator<ConformerDataArray::const_iterator, const ConformerData> ConstConformerIterator;
72  typedef boost::indirect_iterator<ConformerDataArray::const_iterator, ConformerData> ConformerIterator;
73 
78 
79  TorsionDriver(const TorsionDriver&) = delete;
80 
85 
87 
93 
99 
104 
110 
116 
122 
128 
134 
140 
146 
152  unsigned int setup(const Chem::MolecularGraph& molgraph);
153 
160  unsigned int setup(const Chem::MolecularGraph& molgraph, const Util::BitSet& bond_mask);
161 
166 
171  void clearInputCoordinates(std::size_t frag_idx);
172 
178 
184  void addInputCoordinates(const Math::Vector3DArray& coords, std::size_t frag_idx);
185 
191  void addInputCoordinates(const ConformerData& conf_data, std::size_t frag_idx);
192 
198  void addInputCoordinates(const ConformerData::SharedPointer& conf_data, std::size_t frag_idx);
199 
204  std::size_t getNumFragments() const;
205 
212  const Chem::Fragment& getFragment(std::size_t idx) const;
213 
218  unsigned int generateConformers();
219 
224  std::size_t getNumConformers() const;
225 
232  const ConformerData& getConformer(std::size_t idx) const;
233 
240  ConformerData& getConformer(std::size_t idx);
241 
247 
253 
259 
265 
271 
277 
283 
289 
290  private:
291  typedef std::unique_ptr<TorsionDriverImpl> ImplementationPointer;
292 
293  ImplementationPointer impl;
294  };
295  } // namespace ConfGen
296 } // namespace CDPL
297 
298 #endif // CDPL_CONFGEN_TORSIONDRIVER_HPP
Declaration of 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 type CDPL::ConfGen::ConformerDataArray.
Type definition of a generic wrapper class for storing user-defined log message callback functions.
Definition of class CDPL::ConfGen::TorsionDriverSettings.
Definition of class CDPL::ConfGen::TorsionLibrary.
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
Container for the 3D coordinates of a generated conformer plus its associated energy value.
Definition: ConformerData.hpp:51
std::shared_ptr< ConformerData > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated ConformerData instances.
Definition: ConformerData.hpp:55
Bundle of configuration parameters for systematic conformer enumeration via class ConfGen::TorsionDri...
Definition: TorsionDriverSettings.hpp:47
Driver for the systematic enumeration of conformers obtained by rotating around rotatable bonds of a ...
Definition: TorsionDriver.hpp:66
const LogMessageCallbackFunction & getLogMessageCallback() const
Returns the currently configured log-message callback.
ConformerIterator end()
Returns a mutable iterator pointing one past the last conformer (range-based for support).
boost::indirect_iterator< ConformerDataArray::const_iterator, const ConformerData > ConstConformerIterator
A constant iterator over the generated conformers.
Definition: TorsionDriver.hpp:70
ConstConformerIterator begin() const
Returns a constant iterator pointing to the first conformer (range-based for support).
ConformerIterator begin()
Returns a mutable iterator pointing to the first conformer (range-based for support).
void clearTorsionLibraries()
Removes all configured torsion libraries.
const TorsionDriverSettings & getSettings() const
Returns the current driver settings.
void addTorsionLibrary(const TorsionLibrary::SharedPointer &lib)
Adds lib to the list of torsion libraries consulted during torsion driving.
void clearInputCoordinates()
Removes all stored input coordinates.
void clearInputCoordinates(std::size_t frag_idx)
Removes all input coordinates of the fragment at index frag_idx.
void addInputCoordinates(const ConformerData &conf_data, std::size_t frag_idx)
Adds the conformer data conf_data as a new starting conformation restricted to the fragment at index ...
std::size_t getNumFragments() const
Returns the number of fragments produced by the rotatable bond decomposition.
unsigned int generateConformers()
Runs the torsion-driving conformer enumeration.
const Chem::Fragment & getFragment(std::size_t idx) const
Returns the fragment at index idx.
std::size_t getNumConformers() const
Returns the number of generated conformers.
ConformerIterator getConformersEnd()
Returns a mutable iterator pointing one past the last conformer.
TorsionDriver(const TorsionDriver &)=delete
void setTimeoutCallback(const CallbackFunction &func)
Sets the callback invoked periodically to check whether the configured timeout has elapsed.
TorsionDriver & operator=(const TorsionDriver &)=delete
const CallbackFunction & getAbortCallback() const
Returns the currently configured abort-check callback.
void addInputCoordinates(const ConformerData::SharedPointer &conf_data, std::size_t frag_idx)
Adds the conformer data shared pointer conf_data as a new starting conformation restricted to the fra...
void addInputCoordinates(const Math::Vector3DArray &coords)
Adds coords as a new starting conformation that the driver will torsion-drive.
ConformerData & getConformer(std::size_t idx)
Returns the conformer at index idx.
ConstConformerIterator getConformersBegin() const
Returns a constant iterator pointing to the first conformer.
ConformerIterator getConformersBegin()
Returns a mutable iterator pointing to the first conformer.
void setLogMessageCallback(const LogMessageCallbackFunction &func)
Sets the callback receiving log messages emitted by the driver.
void setAbortCallback(const CallbackFunction &func)
Sets the callback invoked periodically to allow the generation to be aborted by the user.
ConstConformerIterator getConformersEnd() const
Returns a constant iterator pointing one past the last conformer.
TorsionDriver()
Constructs the TorsionDriver instance.
void addInputCoordinates(const Math::Vector3DArray &coords, std::size_t frag_idx)
Adds coords as a new starting conformation restricted to the fragment at index frag_idx.
TorsionDriverSettings & getSettings()
Returns the current driver settings (mutable).
const ConformerData & getConformer(std::size_t idx) const
Returns the conformer at index idx.
unsigned int setup(const Chem::MolecularGraph &molgraph)
Sets up the driver for molgraph with the default rotatable bond perception.
const CallbackFunction & getTimeoutCallback() const
Returns the currently configured timeout-check callback.
boost::indirect_iterator< ConformerDataArray::const_iterator, ConformerData > ConformerIterator
A mutable iterator over the generated conformers.
Definition: TorsionDriver.hpp:72
unsigned int setup(const Chem::MolecularGraph &molgraph, const Util::BitSet &bond_mask)
Sets up the driver for molgraph using only the bonds whose corresponding bit is set in bond_mask as r...
ConstConformerIterator end() const
Returns a constant iterator pointing one past the last conformer (range-based for support).
std::shared_ptr< TorsionLibrary > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated TorsionLibrary instances.
Definition: TorsionLibrary.hpp:56
std::function< void(const std::string &)> LogMessageCallbackFunction
Generic wrapper for storing user-defined log message callback functions (see [FUNWRP]).
Definition: LogMessageCallbackFunction.hpp:48
std::function< bool()> CallbackFunction
Generic wrapper for storing user-defined callback functions returning a bool status flag (see [FUNWRP...
Definition: CallbackFunction.hpp:47
VectorArray< Vector3D > Vector3DArray
Array storing vectors of type Math::Vector3D.
Definition: VectorArray.hpp:85
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.