Chemical Data Processing Library C++ API - Version 1.1.1
MMFF94BondStretchingRuleParameterTable.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94BondStretchingRuleParameterTable.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_MMFF94BONDSTRETCHINGRULEPARAMETERTABLE_HPP
30 #define CDPL_FORCEFIELD_MMFF94BONDSTRETCHINGRULEPARAMETERTABLE_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<MMFF94BondStretchingRuleParameterTable> SharedPointer;
61 
63  {
64 
65  public:
66  Entry();
67 
68  Entry(unsigned int atomic_no1, unsigned int atomic_no2, double force_const, double ref_length);
69 
70  unsigned int getAtomicNumber1() const;
71 
72  unsigned int getAtomicNumber2() const;
73 
74  double getForceConstant() const;
75 
76  double getReferenceLength() const;
77 
78  operator bool() const;
79 
80  private:
81  unsigned int atomicNo1;
82  unsigned int atomicNo2;
83  double forceConst;
84  double refLength;
85  bool initialized;
86  };
87 
88  typedef boost::transform_iterator<std::function<const Entry&(const DataStorage::value_type&)>,
89  DataStorage::const_iterator>
91 
92  typedef boost::transform_iterator<std::function<Entry&(DataStorage::value_type&)>,
93  DataStorage::iterator>
95 
97 
98  void addEntry(unsigned int atomic_no1, unsigned int atomic_no2, double force_const, double ref_length);
99 
100  const Entry& getEntry(unsigned int atomic_no1, unsigned int atomic_no2) const;
101 
102  std::size_t getNumEntries() const;
103 
104  void clear();
105 
106  bool removeEntry(unsigned int atomic_no1, unsigned int atomic_no2);
107 
109 
111 
113 
115 
117 
119 
121 
123 
125 
126  void load(std::istream& is);
127 
128  void loadDefaults();
129 
130  static void set(const SharedPointer& table);
131 
132  static const SharedPointer& get();
133 
134  private:
135  static SharedPointer defaultTable;
136  DataStorage entries;
137  };
138  } // namespace ForceField
139 } // namespace CDPL
140 
141 #endif // CDPL_FORCEFIELD_MMFF94BONDSTRETCHINGRULEPARAMETERTABLE_HPP
APIPrefix.hpp
Definition of the preprocessor macro CDPL_FORCEFIELD_API.
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::begin
EntryIterator begin()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::removeEntry
bool removeEntry(unsigned int atomic_no1, unsigned int atomic_no2)
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::clear
void clear()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::getEntry
const Entry & getEntry(unsigned int atomic_no1, unsigned int atomic_no2) const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry::getAtomicNumber2
unsigned int getAtomicNumber2() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::loadDefaults
void loadDefaults()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::end
EntryIterator end()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::getEntriesBegin
ConstEntryIterator getEntriesBegin() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::getEntriesEnd
EntryIterator getEntriesEnd()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::getNumEntries
std::size_t getNumEntries() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry::getForceConstant
double getForceConstant() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry::Entry
Entry()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::set
static void set(const SharedPointer &table)
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::getEntriesBegin
EntryIterator getEntriesBegin()
bool
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::addEntry
void addEntry(unsigned int atomic_no1, unsigned int atomic_no2, double force_const, double ref_length)
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry::Entry
Entry(unsigned int atomic_no1, unsigned int atomic_no2, double force_const, double ref_length)
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::getEntriesEnd
ConstEntryIterator getEntriesEnd() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::SharedPointer
std::shared_ptr< MMFF94BondStretchingRuleParameterTable > SharedPointer
Definition: MMFF94BondStretchingRuleParameterTable.hpp:60
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::load
void load(std::istream &is)
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::removeEntry
EntryIterator removeEntry(const EntryIterator &it)
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::end
ConstEntryIterator end() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry::getAtomicNumber1
unsigned int getAtomicNumber1() const
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable
Definition: MMFF94BondStretchingRuleParameterTable.hpp:51
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::begin
ConstEntryIterator begin() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::EntryIterator
boost::transform_iterator< std::function< Entry &(DataStorage::value_type &)>, DataStorage::iterator > EntryIterator
Definition: MMFF94BondStretchingRuleParameterTable.hpp:94
CDPL_FORCEFIELD_API
#define CDPL_FORCEFIELD_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry::getReferenceLength
double getReferenceLength() const
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::Entry
Definition: MMFF94BondStretchingRuleParameterTable.hpp:63
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::get
static const SharedPointer & get()
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::ConstEntryIterator
boost::transform_iterator< std::function< const Entry &(const DataStorage::value_type &)>, DataStorage::const_iterator > ConstEntryIterator
Definition: MMFF94BondStretchingRuleParameterTable.hpp:90
CDPL::ForceField::MMFF94BondStretchingRuleParameterTable::MMFF94BondStretchingRuleParameterTable
MMFF94BondStretchingRuleParameterTable()