Chemical Data Processing Library C++ API - Version 1.4.0
PEOESigmaChargeCalculator.hpp
Go to the documentation of this file.
1 /*
2  * PEOESigmaChargeCalculator.hpp
3  *
4  * Charge calculation by partial equalization of orbital electronegativities (PEOE)
5  * (J. Gasteiger, M. Marsili, Tetrahedron 1980, 36, 3219-3228)
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_PEOESIGMACHARGECALCULATOR_HPP
33 #define CDPL_MOLPROP_PEOESIGMACHARGECALCULATOR_HPP
34 
35 #include <cstddef>
36 #include <vector>
37 #include <memory>
38 
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Chem
46  {
47 
48  class MolecularGraph;
49  class Atom;
50  } // namespace Chem
51 
52  namespace MolProp
53  {
54 
55  class MHMOPiChargeCalculator;
56 
69  {
70 
71  public:
75  typedef std::shared_ptr<PEOESigmaChargeCalculator> SharedPointer;
76 
80  static constexpr std::size_t DEF_NUM_ITERATIONS = 20;
81 
85  static constexpr double DEF_DAMPING_FACTOR = 0.48;
86 
91 
93 
100 
102 
108  void setNumIterations(std::size_t num_iter);
109 
114  std::size_t getNumIterations() const;
115 
121  void setDampingFactor(double factor);
122 
127  double getDampingFactor() const;
128 
133  void calculate(const Chem::MolecularGraph& molgraph);
134 
141  double getCharge(std::size_t idx) const;
142 
149  double getElectronegativity(std::size_t idx) const;
150 
151  private:
153 
154  void init(const Chem::MolecularGraph& molgraph);
155  void calcCharges();
156 
157  double getNbrElectronegativityAvg(std::size_t idx) const;
158 
159  class AtomState
160  {
161 
162  public:
163  typedef std::shared_ptr<AtomState> SharedPointer;
164 
165  AtomState();
166  AtomState(const Chem::Atom&, const Chem::MolecularGraph&);
167 
168  void linkTo(AtomState* nbr_state);
169 
170  double getCharge() const;
171  double getElectronegativity() const;
172 
173  void shiftCharges(double att_fact);
174  void updateElectronegativity();
175 
176  double getNbrElectronegativityAvg() const;
177 
178  private:
179  typedef std::vector<AtomState*> AtomStateList;
180 
181  AtomStateList nbrAtomStates;
182  double a;
183  double b;
184  double c;
185  double enegativity;
186  double enegativityP1;
187  double charge;
188  };
189 
190  typedef std::vector<AtomState::SharedPointer> AtomStateList;
191 
192  std::size_t numIterations;
193  double dampingFactor;
194  AtomStateList atomStates;
195  AtomStateList implHStates;
196  };
197  } // namespace MolProp
198 } // namespace CDPL
199 
200 #endif // CDPL_MOLPROP_PEOESIGMACHARGECALCULATOR_HPP
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.
Abstract base class representing a chemical atom and its bonded neighborhood.
Definition: Atom.hpp:57
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
Calculator that uses the Partial Equalization of Orbital Electronegativities (PEOE) method of Gasteig...
Definition: PEOESigmaChargeCalculator.hpp:69
void setNumIterations(std::size_t num_iter)
Allows to specify the number of charge shifting iterations that have to be performed.
void setDampingFactor(double factor)
Allows to specify the applied damping factor.
std::shared_ptr< PEOESigmaChargeCalculator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated PEOESigmaChargeCalculator instanc...
Definition: PEOESigmaChargeCalculator.hpp:75
double getCharge(std::size_t idx) const
Returns the calculated sigma charge of the atom with index idx.
void calculate(const Chem::MolecularGraph &molgraph)
Calculates the sigma charges and electronegativities of the atoms in the molecular graph molgraph by ...
PEOESigmaChargeCalculator & operator=(const PEOESigmaChargeCalculator &)=delete
double getDampingFactor() const
Returns the applied damping factor.
PEOESigmaChargeCalculator(const PEOESigmaChargeCalculator &)=delete
PEOESigmaChargeCalculator()
Constructs the PEOESigmaChargeCalculator instance.
double getElectronegativity(std::size_t idx) const
Returns the calculated sigma electronegativity of the atom with index idx.
PEOESigmaChargeCalculator(const Chem::MolecularGraph &molgraph)
Constructs the PEOESigmaChargeCalculator instance and calculates the sigma charges and electronegativ...
std::size_t getNumIterations() const
Returns the number of performed charge shifting iterations.
The namespace of the Chemical Data Processing Library.