Chemical Data Processing Library C++ API - Version 1.2.0
MMFF94PartialBondChargeIncrementTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94PartialBondChargeIncrementTable.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_MMFF94PARTIALBONDCHARGEINCREMENTTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94PARTIALBONDCHARGEINCREMENTTABLE_HPP
31 
32 #include <iosfwd>
33 #include <cstddef>
34 #include <unordered_map>
35 #include <memory>
36 #include <functional>
37 
38 #include <boost/iterator/transform_iterator.hpp>
39 
41 
42 
43 namespace CDPL
44 {
45 
46  namespace ForceField
47  {
48 
50  {
51 
52  public:
53  class Entry;
54 
55  private:
56  typedef std::unordered_map<unsigned int, Entry> DataStorage;
57 
58  public:
59  typedef std::shared_ptr<MMFF94PartialBondChargeIncrementTable> SharedPointer;
60 
62  {
63 
64  public:
65  Entry();
66 
67  Entry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor);
68 
69  unsigned int getAtomType() const;
70 
71  double getPartialChargeIncrement() const;
72 
74 
75  operator bool() const;
76 
77  private:
78  unsigned int atomType;
79  double partChargeIncr;
80  double formChargeAdjFactor;
81  bool initialized;
82  };
83 
84  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
85  DataStorage::const_iterator>
87 
88  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
89  DataStorage::iterator>
91 
93 
94  void addEntry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor);
95 
96  const Entry& getEntry(unsigned int atom_type) const;
97 
98  std::size_t getNumEntries() const;
99 
100  void clear();
101 
102  bool removeEntry(unsigned int atom_type);
103 
105 
107 
109 
111 
113 
115 
117 
119 
121 
122  void load(std::istream& is);
123 
124  void loadDefaults();
125 
126  static void set(const SharedPointer& table);
127 
128  static const SharedPointer& get();
129 
130  private:
131  static SharedPointer defaultTable;
132  DataStorage entries;
133  };
134  } // namespace ForceField
135 } // namespace CDPL
136 
137 #endif // CDPL_FORCEFIELD_MMFF94PARTIALBONDCHARGEINCREMENTTABLE_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: MMFF94PartialBondChargeIncrementTable.hpp:62
Entry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor)
Definition: MMFF94PartialBondChargeIncrementTable.hpp:50
static void set(const SharedPointer &table)
void addEntry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor)
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: MMFF94PartialBondChargeIncrementTable.hpp:86
const Entry & getEntry(unsigned int atom_type) const
std::shared_ptr< MMFF94PartialBondChargeIncrementTable > SharedPointer
Definition: MMFF94PartialBondChargeIncrementTable.hpp:59
EntryIterator removeEntry(const EntryIterator &it)
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: MMFF94PartialBondChargeIncrementTable.hpp:90
The namespace of the Chemical Data Processing Library.