Chemical Data Processing Library C++ API - Version 1.2.0
MMFF94TorsionParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94TorsionParameterTable.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_MMFF94TORSIONPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94TORSIONPARAMETERTABLE_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 
51  {
52 
53  public:
54  class Entry;
55 
56  private:
57  typedef std::unordered_map<std::uint64_t, Entry> DataStorage;
58 
59  public:
60  typedef std::shared_ptr<MMFF94TorsionParameterTable> SharedPointer;
61 
63  {
64 
65  public:
66  Entry();
67 
68  Entry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
69  unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3);
70 
71  unsigned int getTorsionTypeIndex() const;
72 
73  unsigned int getTerminalAtom1Type() const;
74 
75  unsigned int getCenterAtom1Type() const;
76 
77  unsigned int getCenterAtom2Type() const;
78 
79  unsigned int getTerminalAtom2Type() const;
80 
81  double getTorsionParameter1() const;
82 
83  double getTorsionParameter2() const;
84 
85  double getTorsionParameter3() const;
86 
87  operator bool() const;
88 
89  private:
90  unsigned int torTypeIdx;
91  unsigned int termAtom1Type;
92  unsigned int ctrAtom1Type;
93  unsigned int ctrAtom2Type;
94  unsigned int termAtom2Type;
95  double torParam1;
96  double torParam2;
97  double torParam3;
98  bool initialized;
99  };
100 
101  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
102  DataStorage::const_iterator>
104 
105  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
106  DataStorage::iterator>
108 
110 
111  void addEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
112  unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3);
113 
114  const Entry& getEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
115  unsigned int term_atom2_type) const;
116 
117  std::size_t getNumEntries() const;
118 
119  void clear();
120 
121  bool removeEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type,
122  unsigned int term_atom2_type);
123 
125 
127 
129 
131 
133 
135 
137 
139 
141 
142  void load(std::istream& is);
143 
144  void loadDefaults(unsigned int param_set);
145 
146  static void set(const SharedPointer& table, unsigned int param_set);
147 
148  static const SharedPointer& get(unsigned int param_set);
149 
150  private:
151  static SharedPointer defaultDynTable;
152  static SharedPointer defaultStatTable;
153  static SharedPointer defaultStatRefTable;
154  DataStorage entries;
155  };
156  } // namespace ForceField
157 } // namespace CDPL
158 
159 #endif // CDPL_FORCEFIELD_MMFF94TORSIONPARAMETERTABLE_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.
Definition: MMFF94TorsionParameterTable.hpp:63
Entry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3)
Definition: MMFF94TorsionParameterTable.hpp:51
bool removeEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type)
std::shared_ptr< MMFF94TorsionParameterTable > SharedPointer
Definition: MMFF94TorsionParameterTable.hpp:60
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: MMFF94TorsionParameterTable.hpp:103
const Entry & getEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type) const
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: MMFF94TorsionParameterTable.hpp:107
static void set(const SharedPointer &table, unsigned int param_set)
void loadDefaults(unsigned int param_set)
EntryIterator removeEntry(const EntryIterator &it)
ConstEntryIterator getEntriesBegin() const
static const SharedPointer & get(unsigned int param_set)
void addEntry(unsigned int tor_type_idx, unsigned int term_atom1_type, unsigned int ctr_atom1_type, unsigned int ctr_atom2_type, unsigned int term_atom2_type, double tor_param1, double tor_param2, double tor_param3)
ConstEntryIterator getEntriesEnd() const
The namespace of the Chemical Data Processing Library.