Open Babel: kinetics.h Source File

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# kinetics.h

Go to the documentation of this file.

    00001 /**********************************************************************
    00002 Copyright (C) 2005 by Chris Morley
    00003
    00004 This file is part of the Open Babel project.
    00005 For more information, see <http://openbabel.org/>
    00006
    00007 This program is free software; you can redistribute it and/or modify
    00008 it under the terms of the GNU General Public License as published by
    00009 the Free Software Foundation version 2 of the License.
    00010
    00011 This program is distributed in the hope that it will be useful,
    00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014 GNU General Public License for more details.
    00015 ***********************************************************************/
    00016 #ifndef OB_KINETICS_H
    00017 #define OB_KINETICS_H
    00018
    00019 #include <openbabel/generic.h>
    00020
    00021 namespace OpenBabel
    00022 {
    00023
    00024 const unsigned RateData = 55555;
    00025 const unsigned ThermoData = 55556;
    00026
    00029
    00036 class OBRateData : public OBGenericData
    00037 {
    00038 protected:
    00039   double Rates[3];
    00040   double LoRates[3];
    00041   double TroeParams[4];
    00042   std::map<std::string,double> Efficiencies;
    00043 public:
    00044   virtual OBGenericData* Clone(OBBase* parent) const{return new OBRateData(*this);}
    00045   enum rate_type {A, n, E};
    00046   enum reaction_type {ARRHENIUS=55555, LINDERMANN, TROE, SRI, THREEBODY};
    00047   reaction_type ReactionType;
    00048   OBRateData():OBGenericData("Rate data", RateData)
    00049   {
    00050     Rates[0]=Rates[1]=Rates[2]=0;
    00051     LoRates[0]=LoRates[1]=LoRates[2]=0;
    00052     TroeParams[0]=TroeParams[1]=TroeParams[2]=TroeParams[3]=0;
    00053     ReactionType = ARRHENIUS;
    00054   }
    00055
    00056   double GetRate(rate_type n) const
    00057   {
    00058     return Rates[n];
    00059   }
    00060
    00061   void SetRate(rate_type n, const double val)
    00062   {
    00063     if(n<3)
    00064       Rates[n] = val;
    00065   }
    00066
    00067   double GetLoRate(rate_type n) const
    00068   {
    00069     return LoRates[n];
    00070   }
    00071
    00072   void SetLoRate(rate_type n, const double val)
    00073   {
    00074     if(n<3)
    00075       LoRates[n] = val;
    00076   }
    00077
    00078   double GetTroeParam(int n) const
    00079   {
    00080     return TroeParams[n];
    00081   }
    00082
    00083   void SetTroeParams(int n, const double val)
    00084   {
    00085     if(n<4)
    00086       TroeParams[n] = val;
    00087   }
    00088
    00089   void SetEfficiency(std::string id, double Eff)
    00090   {
    00091     Efficiencies[id] = Eff;
    00092   }
    00093
    00094   double GetEfficiency(std::string id)
    00095   {
    00096     return Efficiencies[id]; //will be 0 if not found
    00097   }
    00098
    00099   bool GetNextEff(std::string& id, double& Eff)
    00100   {
    00101     //Supply id empty to begin, then id is the*last* id
    00102     std::map<std::string, double>::iterator itr;
    00103     if(id.empty())
    00104       itr = Efficiencies.begin();
    00105     else
    00106     {
    00107       itr = Efficiencies.find(id);
    00108       if(itr!=Efficiencies.end())
    00109         ++itr;
    00110     }
    00111     if(itr==Efficiencies.end())
    00112       return false;
    00113     id    = itr->first;
    00114     Eff = itr->second;
    00115     return true;
    00116   }
    00117 };
    00118
    00119 //******************************************************************************
    00122
    00134 class OBNasaThermoData : public OBGenericData
    00135 {
    00136 protected:
    00137   double Coeffs[14];
    00138   double LoT, MidT, HiT;
    00139   char phase;
    00140 public:
    00141   OBNasaThermoData(): LoT(300),MidT(1000),HiT(3000),phase('G')
    00142   {     _type = ThermoData;     _attr = "Nasa thermo data";}
    00143
    00144   virtual OBGenericData* Clone(OBBase* parent) const{return new OBNasaThermoData(*this);}
    00145
    00146   double GetCoeff(unsigned n) const
    00147   {
    00148     return Coeffs[n];
    00149   }
    00150
    00151   void SetCoeff(unsigned n, const double val)
    00152   {
    00153     if(n<14)
    00154       Coeffs[n] = val;
    00155   }
    00156   double GetLoT() const {return LoT;}
    00157   double GetMidT() const {return MidT;}
    00158   double GetHiT() const {return HiT;}
    00159   void SetLoT(double val){LoT=val;}
    00160   void SetMidT(double val){MidT=val;}
    00161   void SetHiT(double val){HiT=val;}
    00162
    00163   char GetPhase() const {return phase;}
    00164   void SetPhase(char ph){phase=ph;}
    00165 };
    00166
    00167 } //namespace OpenBabel
    00168
    00169 #endif //OB_KINETICS_H
    00170

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

This file is part of the documentation for Open Babel, version 2.3.

Documentation copyright © 1998-2007, the Open Babel Developers.
Open Babel is hosted by:
Generated on Mon Oct 25 2010 11:55:10 by 1.7.2.