Chemical Data Processing Library C++ API - Version 1.4.0
MMFF94StretchBendParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94StretchBendParameterTable.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_MMFF94STRETCHBENDPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94STRETCHBENDPARAMETERTABLE_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<MMFF94StretchBendParameterTable> SharedPointer;
69 
74  {
75 
76  public:
80  Entry();
81 
91  Entry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
92  unsigned int term_atom2_type, double ijk_force_const, double kji_force_const);
93 
98  unsigned int getStretchBendTypeIndex() const;
99 
104  unsigned int getTerminalAtom1Type() const;
105 
110  unsigned int getCenterAtomType() const;
111 
116  unsigned int getTerminalAtom2Type() const;
117 
122  double getIJKForceConstant() const;
123 
128  double getKJIForceConstant() const;
129 
134  operator bool() const;
135 
136  private:
137  unsigned int sbTypeIdx;
138  unsigned int termAtom1Type;
139  unsigned int ctrAtomType;
140  unsigned int termAtom2Type;
141  double ijkForceConst;
142  double kjiForceConst;
143  bool initialized;
144  };
145 
147  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
148  DataStorage::const_iterator>
150 
152  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
153  DataStorage::iterator>
155 
160 
170  void addEntry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
171  unsigned int term_atom2_type, double ijk_force_const, double kji_force_const);
172 
181  const Entry& getEntry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
182  unsigned int term_atom2_type) const;
183 
188  std::size_t getNumEntries() const;
189 
193  void clear();
194 
203  bool removeEntry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type,
204  unsigned int term_atom2_type);
205 
212 
218 
224 
230 
236 
242 
248 
254 
260 
265  void load(std::istream& is);
266 
270  void loadDefaults();
271 
276  static void set(const SharedPointer& table);
277 
282  static const SharedPointer& get();
283 
284  private:
285  static SharedPointer defaultTable;
286  DataStorage entries;
287  };
288  } // namespace ForceField
289 } // namespace CDPL
290 
291 #endif // CDPL_FORCEFIELD_MMFF94STRETCHBENDPARAMETERTABLE_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 stretch-bend coupling parameter record.
Definition: MMFF94StretchBendParameterTable.hpp:74
Entry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, double ijk_force_const, double kji_force_const)
Constructs an Entry for the given (stretch-bend type, terminal-atom 1, center atom,...
unsigned int getCenterAtomType() const
Returns the numeric MMFF94 atom type of the center atom.
unsigned int getTerminalAtom2Type() const
Returns the numeric MMFF94 atom type of the second terminal atom.
unsigned int getStretchBendTypeIndex() const
Returns the MMFF94 stretch-bend type index.
unsigned int getTerminalAtom1Type() const
Returns the numeric MMFF94 atom type of the first terminal atom.
Entry()
Constructs an empty (uninitialized) Entry instance.
double getKJIForceConstant() const
Returns the KJI stretch-bend force constant (couples bond j-k to angle i-j-k).
double getIJKForceConstant() const
Returns the IJK stretch-bend force constant (couples bond i-j to angle i-j-k).
Lookup table mapping (stretch-bend type, terminal-atom-1 type, center-atom type, terminal-atom-2 type...
Definition: MMFF94StretchBendParameterTable.hpp:58
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: MMFF94StretchBendParameterTable.hpp:154
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing one past the last entry.
ConstEntryIterator getEntriesEnd() const
Returns a constant iterator pointing one past the last entry.
void clear()
Removes all entries from the table.
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
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).
std::shared_ptr< MMFF94StretchBendParameterTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94StretchBendParameterTable i...
Definition: MMFF94StretchBendParameterTable.hpp:68
const Entry & getEntry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type) const
Returns the entry for the given (stretch-bend type, terminal-atom 1, center atom, terminal-atom 2) qu...
MMFF94StretchBendParameterTable()
Constructs an empty MMFF94StretchBendParameterTable instance.
bool removeEntry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type)
Removes the entry for the given (stretch-bend type, terminal-atom 1, center atom, terminal-atom 2) qu...
EntryIterator end()
Returns a mutable iterator pointing one past the last entry (alias of getEntriesEnd()).
void addEntry(unsigned int sb_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom_type, unsigned int term_atom2_type, double ijk_force_const, double kji_force_const)
Adds (or overwrites) the entry for the given (stretch-bend type, terminal-atom 1, center atom,...
EntryIterator removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it.
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the entry list.
void load(std::istream &is)
Loads table entries from the input stream is.
void loadDefaults()
Loads the built-in default stretch-bend parameter entries.
static void set(const SharedPointer &table)
Replaces the process-wide default table by table.
EntryIterator getEntriesBegin()
Returns a mutable 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: MMFF94StretchBendParameterTable.hpp:149
std::size_t getNumEntries() const
Returns the number of entries in the table.
The namespace of the Chemical Data Processing Library.