Chemical Data Processing Library C++ API - Version 1.4.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 
54  {
55 
56  public:
57  class Entry;
58 
59  private:
60  typedef std::unordered_map<unsigned int, Entry> DataStorage;
61 
62  public:
64  typedef std::shared_ptr<MMFF94PartialBondChargeIncrementTable> SharedPointer;
65 
70  {
71 
72  public:
76  Entry();
77 
84  Entry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor);
85 
90  unsigned int getAtomType() const;
91 
96  double getPartialChargeIncrement() const;
97 
103 
108  operator bool() const;
109 
110  private:
111  unsigned int atomType;
112  double partChargeIncr;
113  double formChargeAdjFactor;
114  bool initialized;
115  };
116 
118  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
119  DataStorage::const_iterator>
121 
123  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
124  DataStorage::iterator>
126 
131 
138  void addEntry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor);
139 
145  const Entry& getEntry(unsigned int atom_type) const;
146 
151  std::size_t getNumEntries() const;
152 
156  void clear();
157 
163  bool removeEntry(unsigned int atom_type);
164 
171 
177 
183 
189 
195 
201 
207 
213 
219 
224  void load(std::istream& is);
225 
229  void loadDefaults();
230 
235  static void set(const SharedPointer& table);
236 
241  static const SharedPointer& get();
242 
243  private:
244  static SharedPointer defaultTable;
245  DataStorage entries;
246  };
247  } // namespace ForceField
248 } // namespace CDPL
249 
250 #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.
A single partial-bond-charge-increment record.
Definition: MMFF94PartialBondChargeIncrementTable.hpp:70
double getPartialChargeIncrement() const
Returns the partial bond charge increment.
double getFormalChargeAdjustmentFactor() const
Returns the formal-charge adjustment factor.
Entry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor)
Constructs an Entry for the numeric MMFF94 atom type atom_type.
unsigned int getAtomType() const
Returns the numeric MMFF94 atom type of the entry.
Entry()
Constructs an empty (uninitialized) Entry instance.
Lookup table mapping numeric MMFF94 atom types to per-atom partial bond charge increments and formal-...
Definition: MMFF94PartialBondChargeIncrementTable.hpp:54
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the entry list.
void loadDefaults()
Loads the built-in default partial-bond-charge-increment entries.
void clear()
Removes all entries from the table.
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing one past the last entry.
static void set(const SharedPointer &table)
Replaces the process-wide default table by table.
static const SharedPointer & get()
Returns the process-wide default table (lazily initialized on first call).
void addEntry(unsigned int atom_type, double part_bond_chg_inc, double form_chg_adj_factor)
Adds (or overwrites) the entry for the numeric MMFF94 atom type atom_type.
ConstEntryIterator getEntriesEnd() const
Returns a constant 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: MMFF94PartialBondChargeIncrementTable.hpp:120
const Entry & getEntry(unsigned int atom_type) const
Returns the entry for the numeric MMFF94 atom type atom_type.
bool removeEntry(unsigned int atom_type)
Removes the entry for the numeric MMFF94 atom type atom_type.
std::shared_ptr< MMFF94PartialBondChargeIncrementTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94PartialBondChargeIncrementT...
Definition: MMFF94PartialBondChargeIncrementTable.hpp:64
EntryIterator end()
Returns a mutable iterator pointing one past the last entry (alias of getEntriesEnd()).
EntryIterator getEntriesBegin()
Returns a mutable iterator pointing to the beginning of the entry list.
std::size_t getNumEntries() const
Returns the number of entries in the table.
MMFF94PartialBondChargeIncrementTable()
Constructs an empty MMFF94PartialBondChargeIncrementTable instance.
EntryIterator begin()
Returns a mutable iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
EntryIterator removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it.
void load(std::istream &is)
Loads table entries from the input stream is.
ConstEntryIterator begin() const
Returns a constant iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
A mutable iterator over the entries of the table.
Definition: MMFF94PartialBondChargeIncrementTable.hpp:125
The namespace of the Chemical Data Processing Library.