00001 /* 00002 * header file for general chemistry data and functions 00003 * Victor Kress 00004 * Seattle, 7/4/04 00005 * $Id: Chem.h,v 1.7 2007/07/23 19:55:50 ghiorso Exp $ 00006 */ 00007 #ifndef CHEM_H 00008 #define CHEM_H 00009 00010 #include "PhaseExceptions.h" 00011 00013 struct Stoich { 00015 int nele; 00017 int *ele; 00019 double *stoich; 00020 }; 00022 struct EleProp { 00024 char *symbol; 00026 double aw; 00028 char *name; 00029 }; 00031 struct OxProp { 00033 char *formula; 00035 int cation; 00037 double ncat; 00039 double nO; 00041 double mw; 00042 }; 00043 00049 class Chem { 00050 public: 00051 // constructor/destructor/////////////////////////// 00053 Chem(void); 00055 virtual ~Chem(); 00056 00057 // data //////////////////////////////////////////// 00059 static const int nele = 106; 00061 static const EleProp ele[]; 00063 static const int nox = 19; 00065 static const OxProp ox[]; 00066 00067 // methods /////////////////////////////////////////// 00069 static void parseFormula(char *formula,double *elarray); 00071 static double mwt(double *elarray); 00073 static double mwt(Stoich *); 00077 static void elToOx(double *elarray,double *oxarray); 00081 static void oxToEl(double *oxarray,double *elarray) throw(PhaseError *); 00083 static void oxMolToWt(double *oxarray); 00085 static void oxWtToMol(double *oxarray); 00086 private: 00088 static void parseFormulaToken(char *token,int len,double mult, 00089 double *elarray) throw(PhaseError *); 00090 }; 00091 #endif