Chemical Data Processing Library C++ API - Version 1.4.0
MMFF94ChargeCalculator.hpp
Go to the documentation of this file.
1 /*
2  * MMFF94ChargeCalculator.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_MMFF94CHARGECALCULATOR_HPP
30 #define CDPL_FORCEFIELD_MMFF94CHARGECALCULATOR_HPP
31 
32 #include <cstddef>
33 #include <memory>
34 
41 #include "CDPL/Util/Array.hpp"
42 #include "CDPL/Util/BitSet.hpp"
43 
44 
45 namespace CDPL
46 {
47 
48  namespace Chem
49  {
50 
51  class MolecularGraph;
52  class Atom;
53  } // namespace Chem
54 
55  namespace ForceField
56  {
57 
67  {
68 
69  public:
73  typedef std::shared_ptr<MMFF94ChargeCalculator> SharedPointer;
74 
79 
88  MMFF94ChargeCalculator(const Chem::MolecularGraph& molgraph, Util::DArray& charges, bool strict);
89 
95 
101 
107 
113 
119 
125 
131 
137 
175  void calculate(const Chem::MolecularGraph& molgraph, Util::DArray& charges, bool strict);
176 
182 
183  private:
188 
189  typedef std::vector<std::size_t> AtomIndexList;
190 
191  void init(const Chem::MolecularGraph& molgraph, Util::DArray& charges);
192 
193  void assignFormalCharges();
194  void distFormalNeighborCharges(const Chem::Atom& atom, const FormChargeDefEntry& entry);
195  void distFormalAromAtomCharges(const Chem::Atom& atom, const FormChargeDefEntry& entry);
196 
197  void calcPartialCharges(Util::DArray& charges, bool strict) const;
198  double getBondChargeIncrement(unsigned int bnd_type_idx, unsigned int atom_type1, unsigned int atom_type2,
199  const PBCIEntry& pbci_entry1, const PBCIEntry& pbci_entry2) const;
200 
205  MMFF94RingSetFunction aromRingSetFunc;
206  MMFF94NumericAtomTypeFunction numAtomTypeFunc;
207  MMFF94SymbolicAtomTypeFunction symAtomTypeFunc;
208  MMFF94BondTypeIndexFunction bondTypeIdxFunc;
209  Util::DArray formCharges;
210  Util::BitSet assFormChargeMask;
211  AtomIndexList atomList;
212  const Chem::MolecularGraph* molGraph;
213  };
214  } // namespace ForceField
215 } // namespace CDPL
216 
217 #endif // CDPL_FORCEFIELD_MMFF94CHARGECALCULATOR_HPP
Definition of class CDPL::Util::Array.
Declaration of type CDPL::Util::BitSet.
Definition of the preprocessor macro CDPL_FORCEFIELD_API.
#define CDPL_FORCEFIELD_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::ForceField::MMFF94AtomTypePropertyTable.
Definition of class CDPL::ForceField::MMFF94BondChargeIncrementTable.
Definition of class CDPL::ForceField::MMFF94FormalAtomChargeDefinitionTable.
Definition of class CDPL::ForceField::MMFF94PartialBondChargeIncrementTable.
Type declaration of generic wrapper classes for storing user-defined functions for the retrieval of M...
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
A single atom-type property record.
Definition: MMFF94AtomTypePropertyTable.hpp:74
std::shared_ptr< MMFF94AtomTypePropertyTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94AtomTypePropertyTable insta...
Definition: MMFF94AtomTypePropertyTable.hpp:68
A single bond charge increment table record.
Definition: MMFF94BondChargeIncrementTable.hpp:73
std::shared_ptr< MMFF94BondChargeIncrementTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94BondChargeIncrementTable in...
Definition: MMFF94BondChargeIncrementTable.hpp:67
Calculator for the MMFF94 partial atomic charges of a molecular graph.
Definition: MMFF94ChargeCalculator.hpp:67
void setFormalChargeDefinitionTable(const MMFF94FormalAtomChargeDefinitionTable::SharedPointer &table)
Sets the formal charge definition table to use.
const Util::DArray & getFormalCharges() const
Returns the formal atomic charges assigned during the last calculation.
void setAromaticRingSetFunction(const MMFF94RingSetFunction &func)
Specifies the function used to retrieve the aromatic ring set of a molecular graph.
void setSymbolicAtomTypeFunction(const MMFF94SymbolicAtomTypeFunction &func)
Specifies the function used to retrieve the symbolic MMFF94 atom type of an atom.
void calculate(const Chem::MolecularGraph &molgraph, Util::DArray &charges, bool strict)
Calculates MMFF94 partial charges for the atoms of a molecular graph.
std::shared_ptr< MMFF94ChargeCalculator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94ChargeCalculator instances.
Definition: MMFF94ChargeCalculator.hpp:73
MMFF94ChargeCalculator(const Chem::MolecularGraph &molgraph, Util::DArray &charges, bool strict)
Constructs the MMFF94ChargeCalculator instance and immediately calculates partial charges for the ato...
MMFF94ChargeCalculator()
Constructs the MMFF94ChargeCalculator instance.
void setNumericAtomTypeFunction(const MMFF94NumericAtomTypeFunction &func)
Specifies the function used to retrieve the numeric MMFF94 atom type of an atom.
void setAtomTypePropertyTable(const MMFF94AtomTypePropertyTable::SharedPointer &table)
Sets the MMFF94 atom type property table to use.
void setPartialBondChargeIncrementTable(const MMFF94PartialBondChargeIncrementTable::SharedPointer &table)
Sets the partial bond charge increment table to use.
void setBondTypeIndexFunction(const MMFF94BondTypeIndexFunction &func)
Specifies the function used to retrieve the MMFF94 bond type index of a bond.
void setBondChargeIncrementTable(const MMFF94BondChargeIncrementTable::SharedPointer &table)
Sets the bond charge increment table to use.
A single formal-charge definition.
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:75
std::shared_ptr< MMFF94FormalAtomChargeDefinitionTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94FormalAtomChargeDefinitionT...
Definition: MMFF94FormalAtomChargeDefinitionTable.hpp:69
A single partial-bond-charge-increment record.
Definition: MMFF94PartialBondChargeIncrementTable.hpp:70
std::shared_ptr< MMFF94PartialBondChargeIncrementTable > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMFF94PartialBondChargeIncrementT...
Definition: MMFF94PartialBondChargeIncrementTable.hpp:64
std::function< unsigned int(const Chem::Atom &)> MMFF94NumericAtomTypeFunction
Generic wrapper class used to store a user-defined numeric MMFF94 atom type function.
Definition: MMFF94PropertyFunctions.hpp:56
std::function< const Chem::FragmentList::SharedPointer &(const Chem::MolecularGraph &)> MMFF94RingSetFunction
Generic wrapper class used to store a user-defined MMFF94 ring set function.
Definition: MMFF94PropertyFunctions.hpp:76
std::function< unsigned int(const Chem::Bond &)> MMFF94BondTypeIndexFunction
Generic wrapper class used to store a user-defined MMFF94 bond type index function.
Definition: MMFF94PropertyFunctions.hpp:71
std::function< const std::string &(const Chem::Atom &)> MMFF94SymbolicAtomTypeFunction
Generic wrapper class used to store a user-defined symbolic MMFF94 atom type function.
Definition: MMFF94PropertyFunctions.hpp:61
Array< double > DArray
Array storing floating point values of type double.
Definition: Array.hpp:595
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.