Chemical Data Processing Library C++ API - Version 1.4.0
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 
74  {
75 
76  public:
80  typedef std::shared_ptr<MHMOPiChargeCalculator> SharedPointer;
81 
86 
95 
103 
105 
110 
112 
117  void localizedPiBonds(bool localized);
118 
123  bool localizedPiBonds() const;
124 
129  void calculate(const Chem::MolecularGraph& molgraph);
130 
136  void calculate(const Chem::ElectronSystemList& pi_sys_list, const Chem::MolecularGraph& molgraph);
137 
144  double getElectronDensity(std::size_t atom_idx) const;
145 
152  double getCharge(std::size_t atom_idx) const;
153 
160  double getBondOrder(std::size_t bond_idx) const;
161 
166  double getEnergy() const;
167 
168  private:
169  void initAtomPiSysCounts(const Chem::ElectronSystemList& pi_sys_list, const Chem::MolecularGraph& molgraph);
170  void initAtomFreeElecCounts(const Chem::ElectronSystemList& pi_sys_list, const Chem::MolecularGraph& molgraph);
171 
172  void calcForPiSys(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
173 
174  void initAtomPiElecCounts(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
175 
176  std::size_t getNumBonds(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys,
177  const Chem::MolecularGraph& molgraph) const;
178 
179  void getInvolvedBonds(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
180  void initHueckelMatrix(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
181 
182  void calcSigmaCharges(const Chem::MolecularGraph& molgraph);
183  double getAlpha(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
184  double getAlphaCorrection(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
185  double getBeta(const Chem::Bond& bond, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
186 
187  std::uint64_t getAtomID(const Chem::Atom& atom, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
188  std::uint64_t getBondID(const Chem::Bond& bond, const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph) const;
189 
190  bool diagHueckelMatrix();
191  void distElectrons(const Chem::ElectronSystem& pi_sys);
192  void updateEnergy();
193  void updateAtomElecDensitiesAndCharges(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
194  void updateBondElecDensities(const Chem::ElectronSystem& pi_sys, const Chem::MolecularGraph& molgraph);
195 
196  double calcElecDensity(std::size_t i, std::size_t j) const;
197 
198  struct MODescr
199  {
200 
201  double energy;
202  double coeffVecIndex;
203  double elecCount;
204  };
205 
206  typedef Math::Matrix<double> Matrix;
207  typedef Math::Vector<double> Vector;
208  typedef std::vector<const Chem::Bond*> BondList;
209  typedef std::vector<std::size_t> CountsArray;
210  typedef std::vector<double> DoubleArray;
211  typedef std::vector<MODescr> MODescrArray;
212  typedef std::vector<MODescr*> MODescrPtrArray;
213  typedef std::unique_ptr<PEOESigmaChargeCalculator> PEOECalculatorPtr;
214 
215  Matrix hueckelMatrix;
216  Matrix hmEigenVectors;
217  Vector hmEigenValues;
218  BondList piSysBonds;
219  CountsArray atomPiSysCounts;
220  CountsArray atomFreeElecCounts;
221  CountsArray atomPiElecCounts;
222  Util::BitSet specialAtomTypes;
223  MODescrArray moDescriptors;
224  MODescrPtrArray moDescriptorPtrs;
225  bool locPiBonds;
226  DoubleArray atomElecDensities;
227  DoubleArray bondElecDensities;
228  DoubleArray atomPiCharges;
229  double energy;
230  PEOECalculatorPtr peoeCalculatorPtr;
231  };
232  } // namespace MolProp
233 } // namespace CDPL
234 
235 #endif // CDPL_MOLPROP_MHMOPICHARGECALCULATOR_HPP
Declaration of type CDPL::Util::BitSet.
Definition of class CDPL::Chem::ElectronSystemList.
Definition of matrix data types.
Definition of the preprocessor macro CDPL_MOLPROP_API.
#define CDPL_MOLPROP_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of vector data types.
Abstract base class representing a chemical atom and its bonded neighborhood.
Definition: Atom.hpp:57
Abstract base class representing a chemical bond between two Chem::Atom instances.
Definition: Bond.hpp:54
Data type for the storage of Chem::ElectronSystem objects.
Definition: ElectronSystemList.hpp:49
Describes an electron system of a molecule in terms of involved atoms and their electron contribution...
Definition: ElectronSystem.hpp:55
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Calculator that uses a Modified Hückel Molecular Orbital (MHMO) treatment to compute pi-electron dens...
Definition: MHMOPiChargeCalculator.hpp:74
double getElectronDensity(std::size_t atom_idx) const
Returns the calculated pi-electron density of the atom at index atom_idx.
void calculate(const Chem::MolecularGraph &molgraph)
Performs the MHMO calculation for molgraph, perceiving the pi-electron systems on the fly.
double getBondOrder(std::size_t bond_idx) const
Returns the calculated pi-bond order of the bond at index bond_idx.
void localizedPiBonds(bool localized)
Specifies whether the calculation shall use localized pi-bonds.
double getCharge(std::size_t atom_idx) const
Returns the calculated pi-charge of the atom at index atom_idx.
MHMOPiChargeCalculator(const MHMOPiChargeCalculator &)=delete
void calculate(const Chem::ElectronSystemList &pi_sys_list, const Chem::MolecularGraph &molgraph)
Performs the MHMO calculation for the given pi-electron systems of molgraph.
MHMOPiChargeCalculator(const Chem::ElectronSystemList &pi_sys_list, const Chem::MolecularGraph &molgraph)
Constructs the MHMOPiChargeCalculator instance and performs the MHMO calculation for the given pi-ele...
MHMOPiChargeCalculator(const Chem::MolecularGraph &molgraph)
Constructs the MHMOPiChargeCalculator instance and performs the MHMO calculation for molgraph.
std::shared_ptr< MHMOPiChargeCalculator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MHMOPiChargeCalculator instances.
Definition: MHMOPiChargeCalculator.hpp:80
MHMOPiChargeCalculator()
Constructs the MHMOPiChargeCalculator instance.
MHMOPiChargeCalculator & operator=(const MHMOPiChargeCalculator &)=delete
bool localizedPiBonds() const
Tells whether the calculation uses localized pi-bonds.
double getEnergy() const
Returns the total pi-electron energy of the molecular graph from the last calculation.
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.