Chemical Data Processing Library C++ API - Version 1.4.0
MMFF94AngleBendingParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94AngleBendingParameterTable.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_MMFF94ANGLEBENDINGPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94ANGLEBENDINGPARAMETERTABLE_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::uint32_t, Entry> DataStorage;
62 
63  public:
67  typedef std::shared_ptr<MMFF94AngleBendingParameterTable> SharedPointer;
68 
73  {
74 
75  public:
79  Entry();
80 
90  Entry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
91  unsigned int term_atom2_type, double force_const, double ref_angle);
92 
97  unsigned int getAngleTypeIndex() const;
98 
103  unsigned int getTerminalAtom1Type() const;
104 
109  unsigned int getCenterAtomType() const;
110 
115  unsigned int getTerminalAtom2Type() const;
116 
121  double getForceConstant() const;
122 
127  double getReferenceAngle() const;
128 
133  operator bool() const;
134 
135  private:
136  unsigned int angleTypeIdx;
137  unsigned int termAtom1Type;
138  unsigned int ctrAtomType;
139  unsigned int termAtom2Type;
140  double forceConst;
141  double refAngle;
142  bool initialized;
143  };
144 
148  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
149  DataStorage::const_iterator>
151 
155  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
156  DataStorage::iterator>
158 
163 
173  void addEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
174  unsigned int term_atom2_type, double force_const, double ref_angle);
175 
184  const Entry& getEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
185  unsigned int term_atom2_type) const;
186 
191  std::size_t getNumEntries() const;
192 
196  void clear();
197 
206  bool removeEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
207  unsigned int term_atom2_type);
208 
215 
221 
227 
233 
239 
245 
251 
257 
263 
268  void load(std::istream& is);
269 
273  void loadDefaults();
274 
279  static void set(const SharedPointer& table);
280 
285  static const SharedPointer& get();
286 
287  private:
288  static SharedPointer defaultTable;
289  DataStorage entries;
290  };
291  } // namespace ForceField
292 } // namespace CDPL
293 
294 #endif // CDPL_FORCEFIELD_MMFF94ANGLEBENDINGPARAMETERTABLE_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: MMFF94AngleBendingParameterTable.hpp:73
unsigned int getTerminalAtom2Type() const
Returns the numeric MMFF94 atom type of the second terminal atom.
Entry()
Constructs an empty (uninitialized) Entry instance.
double getReferenceAngle() const
Returns the reference bond angle.
Entry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, double force_const, double ref_angle)
Constructs an Entry instance storing the given query and parameter values.
unsigned int getCenterAtomType() const
Returns the numeric MMFF94 atom type of the center atom.
double getForceConstant() const
Returns the angle-bending force constant.
unsigned int getAngleTypeIndex() const
Returns the MMFF94 angle type index.
unsigned int getTerminalAtom1Type() const
Returns the numeric MMFF94 atom type of the first terminal atom.
Data structure for the storage and lookup of MMFF94 angle-bending interaction parameters.
Definition: MMFF94AngleBendingParameterTable.hpp:55
static void set(const SharedPointer &table)
Replaces the process-wide default table by table.
MMFF94AngleBendingParameterTable()
Constructs an empty MMFF94AngleBendingParameterTable instance.
ConstEntryIterator getEntriesEnd() const
Returns a constant iterator pointing one past the last entry.
void addEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, double force_const, double ref_angle)
Adds a new (or overwrites an existing) entry for the given query and parameter values.
const Entry & getEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type) const
Returns a reference to the entry matching the specified query values.
void load(std::istream &is)
Loads table entries from the input stream is.
EntryIterator getEntriesBegin()
Returns a mutable iterator pointing to the beginning of the entry list.
void clear()
Removes all entries from the table.
std::size_t getNumEntries() const
Returns the number of entries in the table.
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
A mutable iterator over the entries of the table.
Definition: MMFF94AngleBendingParameterTable.hpp:157
EntryIterator begin()
Returns a mutable iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
bool removeEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type)
Removes the entry matching the specified query values.
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing one past the last entry.
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: MMFF94AngleBendingParameterTable.hpp:150
ConstEntryIterator begin() const
Returns a constant iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the entry list.
EntryIterator end()
Returns a mutable iterator pointing one past the last entry (alias of getEntriesEnd()).
static const SharedPointer & get()
Returns the process-wide default table (lazily initialized on first call).
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
std::shared_ptr< MMFF94AngleBendingParameterTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94AngleBendingParameterTable ...
Definition: MMFF94AngleBendingParameterTable.hpp:67
void loadDefaults()
Loads the built-in default MMFF94 angle-bending parameter entries.
EntryIterator removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it.
The namespace of the Chemical Data Processing Library.