/usr/include/openbabel-2.0/openbabel/chargemodel.h is in libopenbabel-dev 2.3.2+dfsg-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /**********************************************************************
chargemodel.h - Base class for partial charge models
Copyright (C) 2010 by Geoffrey Hutchison
Some portions Copyright (C) 2009 by Frank Peters
This file is part of the Open Babel project.
For more information, see <http://openbabel.org/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef OB_CHARGEMODEL_H
#define OB_CHARGEMODEL_H
#include <openbabel/babelconfig.h>
#include <openbabel/plugin.h>
#include <openbabel/math/vector3.h>
namespace OpenBabel
{
class OBMol; //Forward declaration; used only as pointer.
// Documentation is down below
class OBAPI OBChargeModel : public OBPlugin
{
MAKE_PLUGIN(OBChargeModel)
public:
const char* TypeID(){return "charges";};
/// \return whether partial charges were successfully assigned to this molecule
/// \note The method should fill m_partialCharges and m_formalCharges as well
virtual bool ComputeCharges(OBMol &) { return false; }
/// \return a vector of the formal charges on each atom, indexed from 0
/// This method returns floating point formal charges since some
/// charge models consider fractional charges (e.g., 0.5 for an
/// oxygen in a carboxylate CO2- group).
/// \note If ComputeCharges() has not been called, this will return an empty vector
const std::vector<double> & GetFormalCharges() const
{ return m_formalCharges; }
/// \return a vector of the partial charges on each atom, indexed from 0
/// \note If ComputeCharges() has not been called, this will return an empty vector
const std::vector<double> & GetPartialCharges() const
{ return m_partialCharges; }
/// \return a vector of the dipole moment from this molecule
vector3 GetDipoleMoment(OBMol &);
protected:
std::vector<double> m_partialCharges;
std::vector<double> m_formalCharges;
/// Fill the internal partial and formal charge vectors (convenience function)
void FillChargeVectors(OBMol &mol);
/// Provide a scaling factor for the dipole moment -- ideally calibrated from many molecules
virtual double DipoleScalingFactor() { return 1.0; }
};
/** \class OBChargeModel chargemodel.h <openbabel/chargemodel.h>
\brief Atomic partial charge models
\since version 2.3
Classes derived from OBChargeModel implement different atomic partial
charge models. It is intended to allow assinging partial charges
beyond the traditional Gasteiger-Marsili sigma charges previously used
in Open Babel. A --partialcharge method is provided for the babel
command-line, allowing you to override the Gasteiger charge assignment
and use other charge models.
The advantage of plugin classes is that no existing code has to be modified
when a new class is added. You can list those that are present by
babel -L charges
or from a menu item in the GUI.
Any OBChargeModel derived class works like other plugins and needs to
to have a constructor, a function returning a short description, and a
ComputeCharges() function which does the work. A single global
instance of the class needs to be instantiated to define the ID, by
which the class is subsequently accessed.
Once ComputeCharges() has been called, the atoms of the molecule can
be queried for partial or formal charges using
OBAtom::GetPartialCharge() or in vector form from the model itself:
\code
OBMol inputMolecule;
OBChargeModel *mmffCharges = OBChargeModel::FindType("mmff94");
const std::vector<double> partialCharges;
if (mmffCharges && mmffCharges->ComputeCharges(inputMolecule)) {
partialCharges = mmffCharges->GetPartialCharges();
}
\endcode
Note: Formal charges are also returned as floating point values, since
some charge models consider delocalized charges (e.g., 0.5 for an O in
a carboxylate CO2- group).
\code
OBChargeModel *gasteiger = OBChargeModel::FindType("gasteiger");
if (gasteiger) {
cout << " gasteiger: " << dipoleMagnitude(gasteiger->GetDipoleMoment(mol));
}
\endcode
By default, Open Babel 2.3 includes Gasteiger and MMFF94 partial
charges. If the Eigen matrix library is found when compiling, the QEq
and QTPIE methods will be added. Future releases will likely add
additional charge models, including the EEM method.
*/
}//namespace
#endif
//! \file chargemodel.h
//! \brief Base class for molecular partial charge models
|