Chemical Data Processing Library C++ API - Version 1.4.0
MMFF94DefaultStretchBendParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94DefaultStretchBendParameterTable.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_MMFF94DEFAULTSTRETCHBENDPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94DEFAULTSTRETCHBENDPARAMETERTABLE_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 
58  {
59 
60  public:
61  class Entry;
62 
63  private:
64  typedef std::unordered_map<std::uint32_t, Entry> DataStorage;
65 
66  public:
68  typedef std::shared_ptr<MMFF94DefaultStretchBendParameterTable> SharedPointer;
69 
74  {
75 
76  public:
80  Entry();
81 
90  Entry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row,
91  unsigned int term_atom2_pte_row, double ijk_force_const, double kji_force_const);
92 
97  unsigned int getTerminalAtom1PTERow() const;
98 
103  unsigned int getCenterAtomPTERow() const;
104 
109  unsigned int getTerminalAtom2PTERow() const;
110 
115  double getIJKForceConstant() const;
116 
121  double getKJIForceConstant() const;
122 
127  operator bool() const;
128 
129  private:
130  unsigned int termAtom1PTERow;
131  unsigned int ctrAtomPTERow;
132  unsigned int termAtom2PTERow;
133  double ijkForceConst;
134  double kjiForceConst;
135  bool initialized;
136  };
137 
139  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
140  DataStorage::const_iterator>
142 
144  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
145  DataStorage::iterator>
147 
152 
161  void addEntry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row,
162  unsigned int term_atom2_pte_row, double ijk_force_const, double kji_force_const);
163 
171  const Entry& getEntry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row,
172  unsigned int term_atom2_pte_row) const;
173 
178  std::size_t getNumEntries() const;
179 
183  void clear();
184 
192  bool removeEntry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row,
193  unsigned int term_atom2_pte_row);
194 
201 
207 
213 
219 
225 
231 
237 
243 
249 
254  void load(std::istream& is);
255 
259  void loadDefaults();
260 
265  static void set(const SharedPointer& table);
266 
271  static const SharedPointer& get();
272 
273  private:
274  static SharedPointer defaultTable;
275  DataStorage entries;
276  };
277  } // namespace ForceField
278 } // namespace CDPL
279 
280 #endif // CDPL_FORCEFIELD_MMFF94DEFAULTSTRETCHBENDPARAMETERTABLE_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 PTE-row-based default stretch-bend parameter record.
Definition: MMFF94DefaultStretchBendParameterTable.hpp:74
double getKJIForceConstant() const
Returns the KJI stretch-bend force constant.
Entry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row, unsigned int term_atom2_pte_row, double ijk_force_const, double kji_force_const)
Constructs an Entry for the given (terminal-atom 1 PTE row, center-atom PTE row, terminal-atom 2 PTE ...
unsigned int getTerminalAtom2PTERow() const
Returns the PTE row of the second terminal atom.
unsigned int getTerminalAtom1PTERow() const
Returns the PTE row of the first terminal atom.
unsigned int getCenterAtomPTERow() const
Returns the PTE row of the center atom.
Entry()
Constructs an empty (uninitialized) Entry instance.
double getIJKForceConstant() const
Returns the IJK stretch-bend force constant.
Lookup table mapping (terminal-atom-1 PTE row, center-atom PTE row, terminal-atom-2 PTE row) triples ...
Definition: MMFF94DefaultStretchBendParameterTable.hpp:58
std::size_t getNumEntries() const
Returns the number of entries in the table.
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
static void set(const SharedPointer &table)
Replaces the process-wide default table by table.
const Entry & getEntry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row, unsigned int term_atom2_pte_row) const
Returns the entry for the given (terminal-atom 1 PTE row, center-atom PTE row, terminal-atom 2 PTE ro...
void loadDefaults()
Loads the built-in default stretch-bend fallback entries.
EntryIterator begin()
Returns a mutable iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
void clear()
Removes all entries from the table.
void load(std::istream &is)
Loads table entries from the input stream is.
void addEntry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row, unsigned int term_atom2_pte_row, double ijk_force_const, double kji_force_const)
Adds (or overwrites) the entry for the given (terminal-atom 1 PTE row, center-atom PTE row,...
MMFF94DefaultStretchBendParameterTable()
Constructs an empty MMFF94DefaultStretchBendParameterTable instance.
std::shared_ptr< MMFF94DefaultStretchBendParameterTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94DefaultStretchBendParameter...
Definition: MMFF94DefaultStretchBendParameterTable.hpp:68
ConstEntryIterator getEntriesEnd() const
Returns a constant 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()).
static const SharedPointer & get()
Returns the process-wide default table (lazily initialized on first call).
EntryIterator end()
Returns a mutable iterator pointing one past the last entry (alias of getEntriesEnd()).
bool removeEntry(unsigned int term_atom1_pte_row, unsigned int ctr_atom_pte_row, unsigned int term_atom2_pte_row)
Removes the entry for the given (terminal-atom 1 PTE row, center-atom PTE row, terminal-atom 2 PTE ro...
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing one past the last entry.
EntryIterator removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it.
EntryIterator getEntriesBegin()
Returns a mutable iterator pointing to the beginning of the entry list.
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the entry list.
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: MMFF94DefaultStretchBendParameterTable.hpp:141
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
A mutable iterator over the entries of the table.
Definition: MMFF94DefaultStretchBendParameterTable.hpp:146
The namespace of the Chemical Data Processing Library.