Chemical Data Processing Library C++ API - Version 1.3.0
UFFAtomTypePropertyTable.hpp
Go to the documentation of this file.
1 /*
2  * UFFAtomTypePropertyTable.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_UFFATOMTYPEPROPERTYTABLE_HPP
30 #define CDPL_FORCEFIELD_UFFATOMTYPEPROPERTYTABLE_HPP
31 
32 #include <cstddef>
33 #include <string>
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<UFFAtomTypePropertyTable> SharedPointer;
60 
62  {
63 
64  public:
65  Entry();
66 
67  Entry(unsigned int atom_type, const std::string& atom_type_sym, unsigned int atomic_no, double bond_rad,
68  double bond_ang, double vdw_dist, double vdw_energy, double vdw_scale, double eff_charge);
69 
70  unsigned int getAtomType() const;
71 
72  const std::string& getAtomTypeSymbol() const;
73 
74  unsigned int getAtomicNumber() const;
75 
76  double getBondRadius() const;
77 
78  double getBondAngle() const;
79 
80  double getVdWDistance() const;
81 
82  double getVdWEnergy() const;
83 
84  double getVdWScale() const;
85 
86  double getEffectiveCharge() const;
87 
88  operator bool() const;
89 
90  private:
91  unsigned int atomType;
92  std::string atomTypeSym;
93  unsigned int atomicNo;
94  double bondRadius;
95  double bondAngle;
96  double vdwDistance;
97  double vdwEnergy;
98  double vdwScale;
99  double effCharge;
100  bool initialized;
101  };
102 
103  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
104  DataStorage::const_iterator>
106 
107  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
108  DataStorage::iterator>
110 
112 
113  void addEntry(unsigned int atom_type, const std::string& atom_type_sym, unsigned int atomic_no, double bond_rad,
114  double bond_ang, double vdw_dist, double vdw_energy, double vdw_scale, double eff_charge);
115 
116  const Entry& getEntry(unsigned int atom_type) const;
117 
118  std::size_t getNumEntries() const;
119 
120  void clear();
121 
122  bool removeEntry(unsigned int atom_type);
123 
125 
127 
129 
131 
133 
135 
137 
139 
141 
142  void loadDefaults();
143 
144  static void set(const SharedPointer& table);
145 
146  static const SharedPointer& get();
147 
148  private:
149  static SharedPointer defaultTable;
150  DataStorage entries;
151  };
152  } // namespace ForceField
153 } // namespace CDPL
154 
155 #endif // CDPL_FORCEFIELD_UFFATOMTYPEPROPERTYTABLE_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: UFFAtomTypePropertyTable.hpp:62
Entry(unsigned int atom_type, const std::string &atom_type_sym, unsigned int atomic_no, double bond_rad, double bond_ang, double vdw_dist, double vdw_energy, double vdw_scale, double eff_charge)
Definition: UFFAtomTypePropertyTable.hpp:50
EntryIterator removeEntry(const EntryIterator &it)
static void set(const SharedPointer &table)
ConstEntryIterator getEntriesBegin() const
std::shared_ptr< UFFAtomTypePropertyTable > SharedPointer
Definition: UFFAtomTypePropertyTable.hpp:59
void addEntry(unsigned int atom_type, const std::string &atom_type_sym, unsigned int atomic_no, double bond_rad, double bond_ang, double vdw_dist, double vdw_energy, double vdw_scale, double eff_charge)
const Entry & getEntry(unsigned int atom_type) const
ConstEntryIterator getEntriesEnd() const
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: UFFAtomTypePropertyTable.hpp:109
static const SharedPointer & get()
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: UFFAtomTypePropertyTable.hpp:105
bool removeEntry(unsigned int atom_type)
The namespace of the Chemical Data Processing Library.