Skip to content

Commit

Permalink
New obthermo tool with correspoding data
Browse files Browse the repository at this point in the history
  • Loading branch information
dspoel committed Jul 15, 2015
1 parent ece8406 commit 09b6ba8
Show file tree
Hide file tree
Showing 6 changed files with 10,460 additions and 311 deletions.
10,066 changes: 9,910 additions & 156 deletions data/atomization-energies.txt

Large diffs are not rendered by default.

111 changes: 97 additions & 14 deletions include/openbabel/data.h
Original file line number Diff line number Diff line change
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 @@ -374,6 +414,49 @@ namespace OpenBabel
//! \deprecated second OBBitVec argument is ignored
bool AssignBonds(OBMol &,OBBitVec &);
};

/*! \brief
* Convenience function to convert energy units.
*
* \param[in] unit The energy unit to be converted, e.g. "kJ/mol",
* "Hartree", "Rydberg", "eV" or "electronvolt"
* \return a factor to multiply energies with.
*/
double energyToKcal(std::string unit);

/*! \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.
*/
bool extract_thermochemistry(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);

} // end namespace OpenBabel

Expand Down
Loading

0 comments on commit 09b6ba8

Please sign in to comment.