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 
55  {
56 
57  public:
58  class Entry;
59 
60  private:
61  typedef std::unordered_map<std::uint64_t, Entry> DataStorage;
62 
63  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 
164  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
165  DataStorage::const_iterator>
167 
171  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
172  DataStorage::iterator>
174 
179 
191  void addEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
192  unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3);
193 
203  const Entry& getEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
204  unsigned int term_atom2_type) const;
205 
210  std::size_t getNumEntries() const;
211 
215  void clear();
216 
226  bool removeEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
227  unsigned int term_atom2_type);
228 
235 
241 
247 
253 
259 
265 
271 
277 
283 
288  void load(std::istream& is);
289 
294  void loadDefaults(unsigned int param_set);
295 
301  static void set(const SharedPointer& table, unsigned int param_set);
302 
308  static const SharedPointer& get(unsigned int param_set);
309 
310  private:
311  static SharedPointer defaultDynTable;
312  static SharedPointer defaultStatTable;
313  static SharedPointer defaultStatRefTable;
314  DataStorage entries;
315  };
316  } // namespace ForceField
317 } // namespace CDPL
318 
319 #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.
Data structure for the storage of values associated with a single table entry.
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 instance storing the given query and parameter values.
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.
Data structure for the storage and lookup of MMFF94 torsion interaction parameters.
Definition: MMFF94TorsionParameterTable.hpp:55
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 matching the specified query values.
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:166
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 a reference to the entry matching the specified query values.
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:173
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 a new (or overwrites an existing) entry for the given query and parameter values.
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.