Chemical Data Processing Library C++ API - Version 1.1.1
MMFF94BondStretchingParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94BondStretchingParameterTable.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_MMFF94BONDSTRETCHINGPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94BONDSTRETCHINGPARAMETERTABLE_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::uint32_t, Entry> DataStorage;
58 
59  public:
60  typedef std::shared_ptr<MMFF94BondStretchingParameterTable> SharedPointer;
61 
63  {
64 
65  public:
66  Entry();
67 
68  Entry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type,
69  double force_const, double ref_length);
70 
71  unsigned int getBondTypeIndex() const;
72 
73  unsigned int getAtom1Type() const;
74 
75  unsigned int getAtom2Type() const;
76 
77  double getForceConstant() const;
78 
79  double getReferenceLength() const;
80 
81  operator bool() const;
82 
83  private:
84  unsigned int bondTypeIdx;
85  unsigned int atom1Type;
86  unsigned int atom2Type;
87  double forceConst;
88  double refLength;
89  bool initialized;
90  };
91 
92  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
93  DataStorage::const_iterator>
95 
96  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
97  DataStorage::iterator>
99 
101 
102  void addEntry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type,
103  double force_const, double ref_length);
104 
105  const Entry& getEntry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type) const;
106 
107  std::size_t getNumEntries() const;
108 
109  void clear();
110 
111  bool removeEntry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type);
112 
114 
116 
118 
120 
122 
124 
126 
128 
130 
131  void load(std::istream& is);
132 
133  void loadDefaults();
134 
135  static void set(const SharedPointer& table);
136 
137  static const SharedPointer& get();
138 
139  private:
140  static SharedPointer defaultTable;
141  DataStorage entries;
142  };
143  } // namespace ForceField
144 } // namespace CDPL
145 
146 #endif // CDPL_FORCEFIELD_MMFF94BONDSTRETCHINGPARAMETERTABLE_HPP
CDPL::ForceField::MMFF94BondStretchingParameterTable::end
EntryIterator end()
CDPL::ForceField::MMFF94BondStretchingParameterTable::EntryIterator
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: MMFF94BondStretchingParameterTable.hpp:98
APIPrefix.hpp
Definition of the preprocessor macro CDPL_FORCEFIELD_API.
CDPL::ForceField::MMFF94BondStretchingParameterTable::begin
EntryIterator begin()
CDPL::ForceField::MMFF94BondStretchingParameterTable::get
static const SharedPointer & get()
CDPL::ForceField::MMFF94BondStretchingParameterTable::set
static void set(const SharedPointer &table)
CDPL::ForceField::MMFF94BondStretchingParameterTable::end
ConstEntryIterator end() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::getEntriesBegin
EntryIterator getEntriesBegin()
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry
Definition: MMFF94BondStretchingParameterTable.hpp:63
CDPL::ForceField::MMFF94BondStretchingParameterTable::getEntriesBegin
ConstEntryIterator getEntriesBegin() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::removeEntry
EntryIterator removeEntry(const EntryIterator &it)
CDPL::ForceField::MMFF94BondStretchingParameterTable::SharedPointer
std::shared_ptr< MMFF94BondStretchingParameterTable > SharedPointer
Definition: MMFF94BondStretchingParameterTable.hpp:60
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::getReferenceLength
double getReferenceLength() const
CDPL::ForceField::MMFF94BondStretchingParameterTable
Definition: MMFF94BondStretchingParameterTable.hpp:51
bool
CDPL::ForceField::MMFF94BondStretchingParameterTable::getNumEntries
std::size_t getNumEntries() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::getAtom2Type
unsigned int getAtom2Type() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::begin
ConstEntryIterator begin() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::Entry
Entry()
CDPL::ForceField::MMFF94BondStretchingParameterTable::removeEntry
bool removeEntry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type)
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::ForceField::MMFF94BondStretchingParameterTable::ConstEntryIterator
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: MMFF94BondStretchingParameterTable.hpp:94
CDPL::ForceField::MMFF94BondStretchingParameterTable::addEntry
void addEntry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type, double force_const, double ref_length)
CDPL::ForceField::MMFF94BondStretchingParameterTable::getEntriesEnd
ConstEntryIterator getEntriesEnd() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::load
void load(std::istream &is)
CDPL::ForceField::MMFF94BondStretchingParameterTable::getEntriesEnd
EntryIterator getEntriesEnd()
CDPL::ForceField::MMFF94BondStretchingParameterTable::loadDefaults
void loadDefaults()
CDPL_FORCEFIELD_API
#define CDPL_FORCEFIELD_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::ForceField::MMFF94BondStretchingParameterTable::clear
void clear()
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::getBondTypeIndex
unsigned int getBondTypeIndex() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::MMFF94BondStretchingParameterTable
MMFF94BondStretchingParameterTable()
CDPL::ForceField::MMFF94BondStretchingParameterTable::getEntry
const Entry & getEntry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type) const
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::getAtom1Type
unsigned int getAtom1Type() const
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::Entry
Entry(unsigned int bond_type_idx, unsigned int atom1_type, unsigned int atom2_type, double force_const, double ref_length)
CDPL::ForceField::MMFF94BondStretchingParameterTable::Entry::getForceConstant
double getForceConstant() const