Chemical Data Processing Library C++ API - Version 1.4.0
MMFF94TorsionParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94TorsionParameterTable.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_FORCEFIELD_MMFF94TORSIONPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94TORSIONPARAMETERTABLE_HPP
31 
32 #include <cstddef>
33 #include <cstdint>
34 #include <iosfwd>
35 #include <unordered_map>
36 #include <memory>
37 #include <functional>
38 
39 #include <boost/iterator/transform_iterator.hpp>
40 
42 
43 
44 namespace CDPL
45 {
46 
47  namespace ForceField
48  {
49 
57  {
58 
59  public:
60  class Entry;
61 
62  private:
63  typedef std::unordered_map<std::uint64_t, Entry> DataStorage;
64 
65  public:
67  typedef std::shared_ptr<MMFF94TorsionParameterTable> SharedPointer;
68 
73  {
74 
75  public:
79  Entry();
80 
92  Entry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
93  unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3);
94 
99  unsigned int getTorsionTypeIndex() const;
100 
105  unsigned int getTerminalAtom1Type() const;
106 
111  unsigned int getCenterAtom1Type() const;
112 
117  unsigned int getCenterAtom2Type() const;
118 
123  unsigned int getTerminalAtom2Type() const;
124 
129  double getTorsionParameter1() const;
130 
135  double getTorsionParameter2() const;
136 
141  double getTorsionParameter3() const;
142 
147  operator bool() const;
148 
149  private:
150  unsigned int torTypeIdx;
151  unsigned int termAtom1Type;
152  unsigned int ctrAtom1Type;
153  unsigned int ctrAtom2Type;
154  unsigned int termAtom2Type;
155  double torParam1;
156  double torParam2;
157  double torParam3;
158  bool initialized;
159  };
160 
162  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
163  DataStorage::const_iterator>
165 
167  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
168  DataStorage::iterator>
170 
175 
187  void addEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
188  unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3);
189 
199  const Entry& getEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
200  unsigned int term_atom2_type) const;
201 
206  std::size_t getNumEntries() const;
207 
211  void clear();
212 
222  bool removeEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
223  unsigned int term_atom2_type);
224 
231 
237 
243 
249 
255 
261 
267 
273 
279 
284  void load(std::istream& is);
285 
290  void loadDefaults(unsigned int param_set);
291 
297  static void set(const SharedPointer& table, unsigned int param_set);
298 
304  static const SharedPointer& get(unsigned int param_set);
305 
306  private:
307  static SharedPointer defaultDynTable;
308  static SharedPointer defaultStatTable;
309  static SharedPointer defaultStatRefTable;
310  DataStorage entries;
311  };
312  } // namespace ForceField
313 } // namespace CDPL
314 
315 #endif // CDPL_FORCEFIELD_MMFF94TORSIONPARAMETERTABLE_HPP
Definition of the preprocessor macro CDPL_FORCEFIELD_API.
#define CDPL_FORCEFIELD_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
A single torsion parameter record.
Definition: MMFF94TorsionParameterTable.hpp:73
double getTorsionParameter3() const
Returns the torsion-energy parameter V3.
double getTorsionParameter1() const
Returns the torsion-energy parameter V1.
Entry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3)
Constructs an Entry for the given (torsion type, terminal-atom 1, center-atom 1, center-atom 2,...
unsigned int getCenterAtom1Type() const
Returns the numeric MMFF94 atom type of the first center atom.
unsigned int getTerminalAtom2Type() const
Returns the numeric MMFF94 atom type of the second terminal atom.
double getTorsionParameter2() const
Returns the torsion-energy parameter V2.
Entry()
Constructs an empty (uninitialized) Entry instance.
unsigned int getTerminalAtom1Type() const
Returns the numeric MMFF94 atom type of the first terminal atom.
unsigned int getTorsionTypeIndex() const
Returns the MMFF94 torsion type index.
unsigned int getCenterAtom2Type() const
Returns the numeric MMFF94 atom type of the second center atom.
Lookup table mapping (torsion type, terminal-atom-1 type, center-atom-1 type, center-atom-2 type,...
Definition: MMFF94TorsionParameterTable.hpp:57
bool removeEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type)
Removes the entry for the given (torsion type, terminal-atom 1, center-atom 1, center-atom 2,...
void clear()
Removes all entries from the table.
std::shared_ptr< MMFF94TorsionParameterTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94TorsionParameterTable insta...
Definition: MMFF94TorsionParameterTable.hpp:67
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
A constant iterator over the entries of the table.
Definition: MMFF94TorsionParameterTable.hpp:164
void load(std::istream &is)
Loads table entries from the input stream is.
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing one past the last entry.
ConstEntryIterator begin() const
Returns a constant iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
EntryIterator end()
Returns a mutable iterator pointing one past the last entry (alias of getEntriesEnd()).
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
const Entry & getEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type) const
Returns the entry for the given (torsion type, terminal-atom 1, center-atom 1, center-atom 2,...
EntryIterator begin()
Returns a mutable iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
A mutable iterator over the entries of the table.
Definition: MMFF94TorsionParameterTable.hpp:169
static void set(const SharedPointer &table, unsigned int param_set)
Replaces the process-wide default table for param_set by table.
void loadDefaults(unsigned int param_set)
Loads the built-in default torsion parameter entries for the specified MMFF94 parameter set.
EntryIterator removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it.
MMFF94TorsionParameterTable()
Constructs an empty MMFF94TorsionParameterTable instance.
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the entry list.
EntryIterator getEntriesBegin()
Returns a mutable iterator pointing to the beginning of the entry list.
static const SharedPointer & get(unsigned int param_set)
Returns the process-wide default table for param_set (lazily initialized on first call).
void addEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3)
Adds (or overwrites) the entry for the given (torsion type, terminal-atom 1, center-atom 1,...
std::size_t getNumEntries() const
Returns the number of entries in the table.
ConstEntryIterator getEntriesEnd() const
Returns a constant iterator pointing one past the last entry.
The namespace of the Chemical Data Processing Library.