Chemical Data Processing Library C++ API - Version 1.2.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 
62  {
63 
64  public:
65  typedef std::shared_ptr<PEOESigmaChargeCalculator> SharedPointer;
66 
67  static constexpr std::size_t DEF_NUM_ITERATIONS = 20;
68  static constexpr double DEF_DAMPING_FACTOR = 0.48;
69 
74 
76 
83 
85 
91  void setNumIterations(std::size_t num_iter);
92 
97  std::size_t getNumIterations() const;
98 
104  void setDampingFactor(double factor);
105 
110  double getDampingFactor() const;
111 
116  void calculate(const Chem::MolecularGraph& molgraph);
117 
124  double getCharge(std::size_t idx) const;
125 
132  double getElectronegativity(std::size_t idx) const;
133 
134  private:
136 
137  void init(const Chem::MolecularGraph& molgraph);
138  void calcCharges();
139 
140  double getNbrElectronegativityAvg(std::size_t idx) const;
141 
142  class AtomState
143  {
144 
145  public:
146  typedef std::shared_ptr<AtomState> SharedPointer;
147 
148  AtomState();
149  AtomState(const Chem::Atom&, const Chem::MolecularGraph&);
150 
151  void linkTo(AtomState* nbr_state);
152 
153  double getCharge() const;
154  double getElectronegativity() const;
155 
156  void shiftCharges(double att_fact);
157  void updateElectronegativity();
158 
159  double getNbrElectronegativityAvg() const;
160 
161  private:
162  typedef std::vector<AtomState*> AtomStateList;
163 
164  AtomStateList nbrAtomStates;
165  double a;
166  double b;
167  double c;
168  double enegativity;
169  double enegativityP1;
170  double charge;
171  };
172 
173  typedef std::vector<AtomState::SharedPointer> AtomStateList;
174 
175  std::size_t numIterations;
176  double dampingFactor;
177  AtomStateList atomStates;
178  AtomStateList implHStates;
179  };
180  } // namespace MolProp
181 } // namespace CDPL
182 
183 #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.
Atom.
Definition: Atom.hpp:52
MolecularGraph.
Definition: MolecularGraph.hpp:52
MHMOPiChargeCalculator.
Definition: MHMOPiChargeCalculator.hpp:67
PEOESigmaChargeCalculator.
Definition: PEOESigmaChargeCalculator.hpp:62
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
Definition: PEOESigmaChargeCalculator.hpp:65
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.