Chemical Data Processing Library C++ API - Version 1.4.0
MMFF94OutOfPlaneBendingParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94OutOfPlaneBendingParameterTable.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_MMFF94OUTOFPLANEBENDINGPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94OUTOFPLANEBENDINGPARAMETERTABLE_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::uint32_t, Entry> DataStorage;
64 
65  public:
67  typedef std::shared_ptr<MMFF94OutOfPlaneBendingParameterTable> SharedPointer;
68 
73  {
74 
75  public:
79  Entry();
80 
89  Entry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type,
90  unsigned int oop_atom_type, double force_const);
91 
96  unsigned int getTerminalAtom1Type() const;
97 
102  unsigned int getTerminalAtom2Type() const;
103 
108  unsigned int getCenterAtomType() const;
109 
114  unsigned int getOutOfPlaneAtomType() const;
115 
120  double getForceConstant() const;
121 
126  operator bool() const;
127 
128  private:
129  unsigned int termAtom1Type;
130  unsigned int ctrAtomType;
131  unsigned int termAtom2Type;
132  unsigned int oopAtomType;
133  double forceConst;
134  bool initialized;
135  };
136 
138  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
139  DataStorage::const_iterator>
141 
143  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
144  DataStorage::iterator>
146 
151 
160  void addEntry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type,
161  unsigned int oop_atom_type, double force_const);
162 
171  const Entry& getEntry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type,
172  unsigned int oop_atom_type) const;
173 
178  std::size_t getNumEntries() const;
179 
183  void clear();
184 
193  bool removeEntry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type,
194  unsigned int oop_atom_type);
195 
202 
208 
214 
220 
226 
232 
238 
244 
250 
255  void load(std::istream& is);
256 
261  void loadDefaults(unsigned int param_set);
262 
268  static void set(const SharedPointer& table, unsigned int param_set);
269 
275  static const SharedPointer& get(unsigned int param_set);
276 
277  private:
278  static SharedPointer defaultDynTable;
279  static SharedPointer defaultStatTable;
280  static SharedPointer defaultStatExtTable;
281  DataStorage entries;
282  };
283  } // namespace ForceField
284 } // namespace CDPL
285 
286 #endif // CDPL_FORCEFIELD_MMFF94OUTOFPLANEBENDINGPARAMETERTABLE_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 out-of-plane bending parameter record.
Definition: MMFF94OutOfPlaneBendingParameterTable.hpp:73
unsigned int getCenterAtomType() const
Returns the numeric MMFF94 atom type of the center atom.
unsigned int getOutOfPlaneAtomType() const
Returns the numeric MMFF94 atom type of the out-of-plane atom.
Entry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, unsigned int oop_atom_type, double force_const)
Constructs an Entry for the given (terminal-atom 1, center atom, terminal-atom 2, out-of-plane atom) ...
unsigned int getTerminalAtom2Type() const
Returns the numeric MMFF94 atom type of the second terminal atom.
double getForceConstant() const
Returns the out-of-plane bending force constant.
Entry()
Constructs an empty (uninitialized) Entry instance.
unsigned int getTerminalAtom1Type() const
Returns the numeric MMFF94 atom type of the first terminal atom.
Lookup table mapping (terminal-atom-1 type, center-atom type, terminal-atom-2 type,...
Definition: MMFF94OutOfPlaneBendingParameterTable.hpp:57
MMFF94OutOfPlaneBendingParameterTable()
Constructs an empty MMFF94OutOfPlaneBendingParameterTable instance.
static void set(const SharedPointer &table, unsigned int param_set)
Replaces the process-wide default table for param_set by table.
void load(std::istream &is)
Loads table entries from the input stream is.
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
static const SharedPointer & get(unsigned int param_set)
Returns the process-wide default table for param_set (lazily initialized on first call).
bool removeEntry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, unsigned int oop_atom_type)
Removes the entry for the given (terminal-atom 1, center atom, terminal-atom 2, out-of-plane atom) qu...
ConstEntryIterator begin() const
Returns a constant 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: MMFF94OutOfPlaneBendingParameterTable.hpp:145
void clear()
Removes all entries from the table.
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: MMFF94OutOfPlaneBendingParameterTable.hpp:140
void addEntry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, unsigned int oop_atom_type, double force_const)
Adds (or overwrites) the entry for the given (terminal-atom 1, center atom, terminal-atom 2,...
ConstEntryIterator getEntriesEnd() const
Returns a constant iterator pointing one past the last entry.
std::size_t getNumEntries() const
Returns the number of entries in the table.
void loadDefaults(unsigned int param_set)
Loads the built-in default out-of-plane bending parameter entries for the specified MMFF94 parameter ...
EntryIterator getEntriesBegin()
Returns a mutable iterator pointing to the beginning of the entry list.
const Entry & getEntry(unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, unsigned int oop_atom_type) const
Returns the entry for the given (terminal-atom 1, center atom, terminal-atom 2, out-of-plane atom) qu...
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing one past the last entry.
std::shared_ptr< MMFF94OutOfPlaneBendingParameterTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94OutOfPlaneBendingParameterT...
Definition: MMFF94OutOfPlaneBendingParameterTable.hpp:67
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()).
EntryIterator removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it.
EntryIterator begin()
Returns a mutable iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
The namespace of the Chemical Data Processing Library.