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 
54  {
55 
56  public:
57  class Entry;
58 
59  private:
60  typedef std::unordered_map<std::uint32_t, Entry> DataStorage;
61 
62  public:
64  typedef std::shared_ptr<MMFF94AngleBendingParameterTable> SharedPointer;
65 
70  {
71 
72  public:
76  Entry();
77 
87  Entry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
88  unsigned int term_atom2_type, double force_const, double ref_angle);
89 
94  unsigned int getAngleTypeIndex() const;
95 
100  unsigned int getTerminalAtom1Type() const;
101 
106  unsigned int getCenterAtomType() const;
107 
112  unsigned int getTerminalAtom2Type() const;
113 
118  double getForceConstant() const;
119 
124  double getReferenceAngle() const;
125 
130  operator bool() const;
131 
132  private:
133  unsigned int angleTypeIdx;
134  unsigned int termAtom1Type;
135  unsigned int ctrAtomType;
136  unsigned int termAtom2Type;
137  double forceConst;
138  double refAngle;
139  bool initialized;
140  };
141 
143  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
144  DataStorage::const_iterator>
146 
148  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
149  DataStorage::iterator>
151 
156 
166  void addEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
167  unsigned int term_atom2_type, double force_const, double ref_angle);
168 
177  const Entry& getEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
178  unsigned int term_atom2_type) const;
179 
184  std::size_t getNumEntries() const;
185 
189  void clear();
190 
199  bool removeEntry(unsigned int angle_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
200  unsigned int term_atom2_type);
201 
208 
214 
220 
226 
232 
238 
244 
250 
256 
261  void load(std::istream& is);
262 
266  void loadDefaults();
267 
272  static void set(const SharedPointer& table);
273 
278  static const SharedPointer& get();
279 
280  private:
281  static SharedPointer defaultTable;
282  DataStorage entries;
283  };
284  } // namespace ForceField
285 } // namespace CDPL
286 
287 #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 parameter table entry.
Definition: MMFF94AngleBendingParameterTable.hpp:70
unsigned int getTerminalAtom2Type() const
Returns the numeric MMFF94 atom type of the second terminal atom.
Entry()
Constructs an empty (uninitialized) parameter entry.
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 for 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:54
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:150
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:145
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:64
void loadDefaults()
Loads the built-in default 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.