Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New obthermo tool with corresponding data #200

Merged
merged 16 commits into from Jul 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10,066 changes: 9,910 additions & 156 deletions data/atomization-energies.txt

Large diffs are not rendered by default.

70 changes: 55 additions & 15 deletions include/openbabel/data.h
Expand Up @@ -221,7 +221,7 @@ namespace OpenBabel
//! \return the exact masss of the isotope
//! (or by default (i.e. "isotope 0") the most abundant isotope)
double GetExactMass(const unsigned int atomicNum,
const unsigned int isotope = 0);
const unsigned int isotope = 0);
};

/** \class OBAtomHOF data.h <openbabel/data.h>
Expand All @@ -235,29 +235,56 @@ namespace OpenBabel
class OBAPI OBAtomHOF
{
private:
std::string _element,_method,_desc;
std::string _element,_method,_desc,_unit;
double _T,_value;
int _charge;
int _multiplicity;

public:
OBAtomHOF(std::string element,std::string method,std::string desc,
double T,double value,int multiplicity)
/** \brief Initialize Heat of Formation for atom

@param element The element string
@param charge The formal charge of the particle (if an ion)
@param method The method used for determining the value
@param desc Description of the value
@param T Temperature
@param value The value of the property (energy)
@param multiplicity The multiplicity of the atomic system
@param unit The (energy) unit
*/
OBAtomHOF(std::string element,int charge,
std::string method,std::string desc,
double T,double value,int multiplicity,
std::string unit)
{
_element = element;
_charge = charge;
_method = method;
_desc = desc;
_T = T;
_value = value;
_multiplicity = multiplicity;
_unit = unit;
}

/** \brief Destructor */
~OBAtomHOF() {}
/** \brief Return the chemical element */
std::string Element() { return _element; }
/** \brief Return the formal charge */
int Charge() { return _charge; }
/** \brief Return the method used for the measurement/calculation */
std::string Method() { return _method; }
/** \brief Return specification of the measurement/calculation type */
std::string Desc() { return _desc; }
/** \brief Return the temperature */
double T() { return _T; }
/** \brief Return the (energy) value */
double Value() { return _value; }
/** \brief Return the multiplicity */
int Multiplicity() { return _multiplicity; }
/** \brief Return the (energy) unit */
std::string Unit() { return _unit; }
};

/** \class OBAtomicHeatOfFormationTable data.h <openbabel/data.h>
Expand All @@ -276,22 +303,35 @@ namespace OpenBabel
std::vector<OBAtomHOF> _atomhof;

public:

/** \brief Constructor */
OBAtomicHeatOfFormationTable(void);
~OBAtomicHeatOfFormationTable()
{
//delete _atomhof;
}
/** \brief Destructor */
~OBAtomicHeatOfFormationTable() {}

//! \return the number of elements in the Atomic Heat Of Formation table
size_t GetSize() { return _atomhof.size(); }

/** \brief Read one line in the file and parse it
@param Unnamed the line to be parsed
*/
void ParseLine(const char*);
//! \return 1 if the contribution to the Heat of Formation for this atom
//! is known at temperatures 0K and 298.15K. If 1 the values
//! including all corrections are returned in the respective double variables.
int GetHeatOfFormation(const char *elem,char *method,
int multiplicity,double *dhof0,double *dhof298);
/** \brief Extract heat of formation and entropy for an atom
@param elem The chemical element we're looking for
@param charge At this formal charge
@param method The method used for computing/measuring
@param T The temperature
@param dhof0 The output energy at 0K
@param dhof1 The output energy at T
@param S0T The entropy at T (it is 0 at 0K)
\return 1 if the contribution to the Heat of Formation for this atom
is known at temperature T. If 1 the values
including all corrections are returned in the dhof variable.
*/
int GetHeatOfFormation(std::string elem,
int charge,
std::string method,
double T, double *dhof0,
double *dhofT,double *S0T);
};

// class introduction in data.cpp
Expand Down Expand Up @@ -376,7 +416,7 @@ namespace OpenBabel
};

} // end namespace OpenBabel

#endif //DATA_H

//! \file data.h
Expand Down
75 changes: 75 additions & 0 deletions include/openbabel/data_utilities.h
@@ -0,0 +1,75 @@
/**********************************************************************
data_utilities.h - Global data and resource file parsers.

Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
Copyright (C) 2015 by David van der Spoel

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_DATA_UTILITIES_H
#define OB_DATA_UTILITIES_H

#include <openbabel/babelconfig.h>

#include <openbabel/mol.h>
#include <vector>
#include <string>

namespace OpenBabel {

const double HARTEE_TO_KCALPERMOL = 627.509469;
const double KJPERMOL_TO_KCALPERMOL = 1.0/4.184;
const double RYDBERG_TO_KCALPERMOL = 313.755026;
const double ELECTRONVOLT_TO_KCALPERMOL = 23.060538;

/*! \brief
* Convenience function to extract thermochemistry from a molecule structure
*
* \param[in] mol The molecule structure
* \param[in] bVerbose If true will print information
* \param[inout] Nsymm If not zero and differing from the rotational symmetry
* in the input molecule, corrections to the entropy and
* free energy will be applied. If zero will hold the symmetry
* number from the input molecule on return.
* \param[out] temperature The temperature
* \param[out] DeltaHf0 Enthalpy of formation at T = 0
* \param[out] DeltaHfT Enthalpy of formation at T
* \param[out] DeltaGfT Gibbs energy of formation at T
* \param[out] DeltaSfT Entropy of formation at T
* \param[out] S0T Standard entropy at T
* \param[out] CVT Heat capacity at T and constant Volume
* \param[out] Scomponents Translational, Rotational and Vibrational components of S0
* \return true if all values were found, false otherwise.
*/
OBAPI bool extract_thermochemistry(OpenBabel::OBMol &mol,
bool bVerbose,
int *Nsymm,
int Nrotbonds,
double dbdt,
double *temperature,
double *DeltaHf0,
double *DeltaHfT,
double *DeltaGfT,
double *DeltaSfT,
double *S0T,
double *CVT,
double *CPT,
std::vector<double> &Scomponents);

}

#endif //DATA_UTILITIES_H

//! \file data_utilities.h
//! \brief Data related tools and utilities
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -113,6 +113,7 @@ set(openbabel_srcs
chargemodel.cpp
chiral.cpp
data.cpp
data_utilities.cpp
descriptor.cpp
fingerprint.cpp
forcefield.cpp
Expand Down