Chemical Data Processing Library C++ API - Version 1.1.1
MHMOPiChargeCalculator.hpp
Go to the documentation of this file.
1 /*
2  * MHMOPiChargeCalculator.hpp
3  *
4  * Modified Hueckel Molecular Orbital calculation of various pi electron system properties
5  * (according to T. Kleinöder, PhD Thesis, FAU Erlangen-Nuremberg, 2005)
6  *
7  * This file is part of the Chemical Data Processing Toolkit
8  *
9  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this library; see the file COPYING. If not, write to
23  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  */
26 
32 #ifndef CDPL_MOLPROP_MHMOPICHARGECALCULATOR_HPP
33 #define CDPL_MOLPROP_MHMOPICHARGECALCULATOR_HPP
34 
35 #include <vector>
36 #include <cstddef>
37 #include <cstdint>
38 #include <memory>
39 
42 #include "CDPL/Math/Matrix.hpp"
43 #include "CDPL/Math/Vector.hpp"
44 #include "CDPL/Util/BitSet.hpp"
45 
46 
47 namespace CDPL
48 {
49 
50  namespace Chem
51  {
52 
53  class MolecularGraph;
54  class Bond;
55  } // namespace Chem
56 
57  namespace MolProp
58  {
59 
60  class PEOESigmaChargeCalculator;
61 
67  {
68 
69  public:
70  typedef std::shared_ptr<MHMOPiChargeCalculator> SharedPointer;
71 
73 
75 
77 
79 
80  void localizedPiBonds(bool localized);
81 
82  bool localizedPiBonds() const;
83 
84  void calculate(const Chem::MolecularGraph& molgraph);
85 
86  void calculate(const Chem::ElectronSystemList& pi_sys_list, const Chem::MolecularGraph& molgraph);
87 
88  double getElectronDensity(std::size_t atom_idx) const;
89 
90  double getCharge(std::size_t atom_idx) const;
91 
92  double getBondOrder(std::size_t bond_idx) const;
93 
94  double getEnergy() const;
95 
96  private:
98 
100 
101  void initAtomPiSysCounts(const Chem::ElectronSystemList& pi_sys_list, const Chem::MolecularGraph& molgraph);
102  void initAtomFreeElecCounts(const Chem::ElectronSystemList& pi_sys_list, const Chem::MolecularGraph& molgraph);
103 
104  void calcForPiSys(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
105 
106  void initAtomPiElecCounts(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
107 
108  std::size_t getNumBonds(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys,
109  const Chem::MolecularGraph& molgraph) const;
110 
111  void getInvolvedBonds(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
112  void initHueckelMatrix(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
113 
114  void calcSigmaCharges(const Chem::MolecularGraph& molgraph);
115  double getAlpha(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
116  double getAlphaCorrection(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
117  double getBeta(const Chem::Bond& bond, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
118 
119  std::uint64_t getAtomID(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
120  std::uint64_t getBondID(const Chem::Bond& bond, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
121 
122  bool diagHueckelMatrix();
123  void distElectrons(const Chem::ElectronSystem& pi_sys);
124  void updateEnergy();
125  void updateAtomElecDensitiesAndCharges(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
126  void updateBondElecDensities(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
127 
128  double calcElecDensity(std::size_t i, std::size_t j) const;
129 
130  struct MODescr
131  {
132 
133  double energy;
134  double coeffVecIndex;
135  double elecCount;
136  };
137 
138  typedef Math::Matrix<double> Matrix;
139  typedef Math::Vector<double> Vector;
140  typedef std::vector<const Chem::Bond*> BondList;
141  typedef std::vector<std::size_t> CountsArray;
142  typedef std::vector<double> DoubleArray;
143  typedef std::vector<MODescr> MODescrArray;
144  typedef std::vector<MODescr*> MODescrPtrArray;
145  typedef std::unique_ptr<PEOESigmaChargeCalculator> PEOECalculatorPtr;
146 
147  Matrix hueckelMatrix;
148  Matrix hmEigenVectors;
149  Vector hmEigenValues;
150  BondList piSysBonds;
151  CountsArray atomPiSysCounts;
152  CountsArray atomFreeElecCounts;
153  CountsArray atomPiElecCounts;
154  Util::BitSet specialAtomTypes;
155  MODescrArray moDescriptors;
156  MODescrPtrArray moDescriptorPtrs;
157  bool locPiBonds;
158  DoubleArray atomElecDensities;
159  DoubleArray bondElecDensities;
160  DoubleArray atomPiCharges;
161  double energy;
162  PEOECalculatorPtr peoeCalculatorPtr;
163  };
164  } // namespace MolProp
165 } // namespace CDPL
166 
167 #endif // CDPL_MOLPROP_MHMOPICHARGECALCULATOR_HPP
CDPL::Math::Vector< double >
CDPL::MolProp::MHMOPiChargeCalculator::MHMOPiChargeCalculator
MHMOPiChargeCalculator()
CDPL::MolProp::MHMOPiChargeCalculator::localizedPiBonds
void localizedPiBonds(bool localized)
CDPL::Chem::Bond
Bond.
Definition: Bond.hpp:50
CDPL::MolProp::MHMOPiChargeCalculator::MHMOPiChargeCalculator
MHMOPiChargeCalculator(const Chem::MolecularGraph &molgraph)
CDPL::MolProp::MHMOPiChargeCalculator::getCharge
double getCharge(std::size_t atom_idx) const
CDPL::MolProp::MHMOPiChargeCalculator::getEnergy
double getEnergy() const
CDPL::Util::BitSet
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
CDPL::Chem::Atom
Atom.
Definition: Atom.hpp:52
CDPL::Chem::MolecularGraph
MolecularGraph.
Definition: MolecularGraph.hpp:52
CDPL::MolProp::MHMOPiChargeCalculator
MHMOPiChargeCalculator.
Definition: MHMOPiChargeCalculator.hpp:67
BitSet.hpp
Definition of the type CDPL::Util::BitSet.
CDPL::Chem::ElectronSystem
Describes an electron system of a molecule in terms of involved atoms and their electron contribution...
Definition: ElectronSystem.hpp:55
CDPL::MolProp::MHMOPiChargeCalculator::getElectronDensity
double getElectronDensity(std::size_t atom_idx) const
CDPL::Chem::ElectronSystemList
A data type for the storage of Chem::ElectronSystem objects.
Definition: ElectronSystemList.hpp:49
ElectronSystemList.hpp
Definition of the class CDPL::Chem::ElectronSystemList.
CDPL::MolProp::MHMOPiChargeCalculator::calculate
void calculate(const Chem::ElectronSystemList &pi_sys_list, const Chem::MolecularGraph &molgraph)
CDPL::Math::Matrix< double >
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::MolProp::MHMOPiChargeCalculator::SharedPointer
std::shared_ptr< MHMOPiChargeCalculator > SharedPointer
Definition: MHMOPiChargeCalculator.hpp:70
APIPrefix.hpp
Definition of the preprocessor macro CDPL_MOLPROP_API.
CDPL_MOLPROP_API
#define CDPL_MOLPROP_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::MolProp::MHMOPiChargeCalculator::calculate
void calculate(const Chem::MolecularGraph &molgraph)
Matrix.hpp
Definition of matrix data types.
CDPL::MolProp::MHMOPiChargeCalculator::localizedPiBonds
bool localizedPiBonds() const
CDPL::MolProp::MHMOPiChargeCalculator::~MHMOPiChargeCalculator
~MHMOPiChargeCalculator()
CDPL::MolProp::MHMOPiChargeCalculator::getBondOrder
double getBondOrder(std::size_t bond_idx) const
Vector.hpp
Definition of vector data types.
CDPL::MolProp::MHMOPiChargeCalculator::MHMOPiChargeCalculator
MHMOPiChargeCalculator(const Chem::ElectronSystemList &pi_sys_list, const Chem::MolecularGraph &molgraph)