Loading...
Searching...
No Matches
kinetics.h
Go to the documentation of this file.
/**********************************************************************
Copyright (C) 2005 by Chris Morley
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_KINETICS_H
#define OB_KINETICS_H
#include <openbabel/generic.h>
namespace OpenBabel
{
const unsigned RateData = 55555;
const unsigned ThermoData = 55556;
class OBRateData : public OBGenericData
{
protected:
double Rates[3];
double LoRates[3];
double TroeParams[4];
std::map<std::string,double> Efficiencies;
public:
virtual OBGenericData* Clone(OBBase* parent) const{return new OBRateData(*this);}
enum rate_type {A, n, E};
enum reaction_type {ARRHENIUS=55555, LINDERMANN, TROE, SRI, THREEBODY};
reaction_type ReactionType;
OBRateData():OBGenericData("Rate data", RateData)
{
Rates[0]=Rates[1]=Rates[2]=0;
LoRates[0]=LoRates[1]=LoRates[2]=0;
TroeParams[0]=TroeParams[1]=TroeParams[2]=TroeParams[3]=0;
ReactionType = ARRHENIUS;
}
double GetRate(rate_type n) const
{
return Rates[n];
}
void SetRate(rate_type n, const double val)
{
if(n<3)
Rates[n] = val;
}
double GetLoRate(rate_type n) const
{
return LoRates[n];
}
void SetLoRate(rate_type n, const double val)
{
if(n<3)
LoRates[n] = val;
}
double GetTroeParam(int n) const
{
return TroeParams[n];
}
void SetTroeParams(int n, const double val)
{
if(n<4)
TroeParams[n] = val;
}
void SetEfficiency(std::string id, double Eff)
{
Efficiencies[id] = Eff;
}
double GetEfficiency(std::string id)
{
return Efficiencies[id]; //will be 0 if not found
}
bool GetNextEff(std::string& id, double& Eff)
{
//Supply id empty to begin, then id is the*last* id
std::map<std::string, double>::iterator itr;
if(id.empty())
itr = Efficiencies.begin();
else
{
itr = Efficiencies.find(id);
if(itr!=Efficiencies.end())
++itr;
}
if(itr==Efficiencies.end())
return false;
id = itr->first;
Eff = itr->second;
return true;
}
};
//******************************************************************************
class OBNasaThermoData : public OBGenericData
{
protected:
double Coeffs[14];
double LoT, MidT, HiT;
char phase;
public:
OBNasaThermoData(): LoT(300),MidT(1000),HiT(3000),phase('G')
{ _type = ThermoData; _attr = "Nasa thermo data";}
virtual OBGenericData* Clone(OBBase* parent) const{return new OBNasaThermoData(*this);}
double GetCoeff(unsigned n) const
{
return Coeffs[n];
}
void SetCoeff(unsigned n, const double val)
{
if(n<14)
Coeffs[n] = val;
}
double GetLoT() const {return LoT;}
double GetMidT() const {return MidT;}
double GetHiT() const {return HiT;}
void SetLoT(double val){LoT=val;}
void SetMidT(double val){MidT=val;}
void SetHiT(double val){HiT=val;}
char GetPhase() const {return phase;}
void SetPhase(char ph){phase=ph;}
};
} //namespace OpenBabel
#endif //OB_KINETICS_H
OpenBabel::OBBase
Base Class.
Definition base.h:240
OpenBabel::OBGenericData::_type
unsigned int _type
attribute type – declared for each subclass
Definition base.h:192
OpenBabel::OBGenericData::OBGenericData
OBGenericData(const std::string attr="undefined", const unsigned int type=OBGenericDataType::UndefinedData, const DataOrigin source=any)
Definition generic.cpp:166
OpenBabel::OBGenericData::_attr
std::string _attr
attribute tag (e.g., "UnitCell", "Comment" or "Author")
Definition base.h:191
OpenBabel::OBNasaThermoData::phase
char phase
Definition kinetics.h:139
OpenBabel::OBNasaThermoData::SetHiT
void SetHiT(double val)
Definition kinetics.h:161
OpenBabel::OBNasaThermoData::MidT
double MidT
Definition kinetics.h:138
OpenBabel::OBNasaThermoData::GetHiT
double GetHiT() const
Definition kinetics.h:158
OpenBabel::OBNasaThermoData::SetPhase
void SetPhase(char ph)
Definition kinetics.h:164
OpenBabel::OBNasaThermoData::GetMidT
double GetMidT() const
Definition kinetics.h:157
OpenBabel::OBNasaThermoData::GetLoT
double GetLoT() const
Definition kinetics.h:156
OpenBabel::OBNasaThermoData::SetMidT
void SetMidT(double val)
Definition kinetics.h:160
OpenBabel::OBNasaThermoData::OBNasaThermoData
OBNasaThermoData()
Definition kinetics.h:141
OpenBabel::OBNasaThermoData::SetLoT
void SetLoT(double val)
Definition kinetics.h:159
OpenBabel::OBNasaThermoData::SetCoeff
void SetCoeff(unsigned n, const double val)
Definition kinetics.h:151
OpenBabel::OBNasaThermoData::LoT
double LoT
Definition kinetics.h:138
OpenBabel::OBNasaThermoData::HiT
double HiT
Definition kinetics.h:138
OpenBabel::OBNasaThermoData::Clone
virtual OBGenericData * Clone(OBBase *parent) const
Definition kinetics.h:144
OpenBabel::OBNasaThermoData::GetPhase
char GetPhase() const
Definition kinetics.h:163
OpenBabel::OBNasaThermoData::GetCoeff
double GetCoeff(unsigned n) const
Definition kinetics.h:146
OpenBabel::OBNasaThermoData::Coeffs
double Coeffs[14]
Definition kinetics.h:137
OpenBabel::OBRateData::GetRate
double GetRate(rate_type n) const
Definition kinetics.h:56
OpenBabel::OBRateData::reaction_type
reaction_type
Definition kinetics.h:46
OpenBabel::OBRateData::LINDERMANN
@ LINDERMANN
Definition kinetics.h:46
OpenBabel::OBRateData::THREEBODY
@ THREEBODY
Definition kinetics.h:46
OpenBabel::OBRateData::SRI
@ SRI
Definition kinetics.h:46
OpenBabel::OBRateData::TROE
@ TROE
Definition kinetics.h:46
OpenBabel::OBRateData::ARRHENIUS
@ ARRHENIUS
Definition kinetics.h:46
OpenBabel::OBRateData::ReactionType
reaction_type ReactionType
Definition kinetics.h:47
OpenBabel::OBRateData::LoRates
double LoRates[3]
Definition kinetics.h:40
OpenBabel::OBRateData::rate_type
rate_type
Definition kinetics.h:45
OpenBabel::OBRateData::A
@ A
Definition kinetics.h:45
OpenBabel::OBRateData::E
@ E
Definition kinetics.h:45
OpenBabel::OBRateData::n
@ n
Definition kinetics.h:45
OpenBabel::OBRateData::GetTroeParam
double GetTroeParam(int n) const
Definition kinetics.h:78
OpenBabel::OBRateData::OBRateData
OBRateData()
Definition kinetics.h:48
OpenBabel::OBRateData::SetEfficiency
void SetEfficiency(std::string id, double Eff)
Definition kinetics.h:89
OpenBabel::OBRateData::SetLoRate
void SetLoRate(rate_type n, const double val)
Definition kinetics.h:72
OpenBabel::OBRateData::SetRate
void SetRate(rate_type n, const double val)
Definition kinetics.h:61
OpenBabel::OBRateData::Efficiencies
std::map< std::string, double > Efficiencies
Definition kinetics.h:42
OpenBabel::OBRateData::GetLoRate
double GetLoRate(rate_type n) const
Definition kinetics.h:67
OpenBabel::OBRateData::GetEfficiency
double GetEfficiency(std::string id)
Definition kinetics.h:94
OpenBabel::OBRateData::Rates
double Rates[3]
Definition kinetics.h:39
OpenBabel::OBRateData::SetTroeParams
void SetTroeParams(int n, const double val)
Definition kinetics.h:83
OpenBabel::OBRateData::TroeParams
double TroeParams[4]
Definition kinetics.h:41
OpenBabel::OBRateData::GetNextEff
bool GetNextEff(std::string &id, double &Eff)
Definition kinetics.h:99
OpenBabel::OBRateData::Clone
virtual OBGenericData * Clone(OBBase *parent) const
Definition kinetics.h:44
generic.h
Handle generic data classes. Custom data for atoms, bonds, etc.
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
OpenBabel::ThermoData
const unsigned ThermoData
Definition kinetics.h:25
OpenBabel::RateData
const unsigned RateData
Definition kinetics.h:24