/** @class Molecule @brief A class that embodies the properites of a Molecule such as its weight. @date $Date$ @version $Rev$ @author - Lance Deaver @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @see Molecule.h @bug None known @todo Maybe convert this to a base class and have derived molecules $Id$ */ #include "Molecule.h" //#include "Tips2003.h" #include "Hitran2004.h" #include Molecule::Molecule(const int hitranID, const int isotope) : _id(hitranID), _isotope(isotope) { using namespace HITRAN_2004; assert(hitranID >0 && hitranID <= maxMolecules); assert(isotope >=0 && isotope <= moleculeData[hitranID-1].numberOfIsotopes); } Molecule::~Molecule() { } int Molecule::Id() const { return _id; } int Molecule::Isotope() const { return _isotope; } std::string Molecule::Name() const { using namespace HITRAN_2004; return std::string(moleculeData[_id-1].name); } std::string Molecule::Chemical() const { using namespace HITRAN_2004; return std::string(moleculeData[_id-1].commonFormula); } int Molecule::NumberOfIsotopes() const { using namespace HITRAN_2004; return moleculeData[_id-1].numberOfIsotopes; } double Molecule::Weight() const { using namespace HITRAN_2004; return (_isotope==0)? moleculeData[_id-1].wt[0]: moleculeData[_id-1].wt[_isotope-1]; } double Molecule::Weight(const int isotope) const { using namespace HITRAN_2004; assert(isotope >0 && isotope <= moleculeData[_id-1].numberOfIsotopes); return moleculeData[_id-1].wt[isotope-1]; } double Molecule::Abundance() const { using namespace HITRAN_2004; return (_isotope==0)? moleculeData[_id-1].abundance[0] : moleculeData[_id-1].abundance[_isotope-1]; } double Molecule::Abundance(const int isotope) const { using namespace HITRAN_2004; assert(isotope >0 && isotope <= moleculeData[_id-1].numberOfIsotopes); return moleculeData[_id-1].abundance[isotope-1]; } int Molecule::Isotopologue() const { using namespace HITRAN_2004; return (_isotope==0)? moleculeData[_id-1].isotopologue[0] : moleculeData[_id-1].isotopologue[_isotope-1]; } int Molecule::Isotopologue(const int isotope) const { using namespace HITRAN_2004; assert(isotope >0 && isotope <= moleculeData[_id-1].numberOfIsotopes); return moleculeData[_id-1].isotopologue[isotope-1]; } std::string Molecule::Formula() const { using namespace HITRAN_2004; return (_isotope==0)? std::string(moleculeData[_id-1].commonFormula): std::string(moleculeData[_id-1].formula[_isotope-1]); } std::string Molecule::Formula(const int isotope) const { using namespace HITRAN_2004; assert(isotope >0 && isotope <= moleculeData[_id-1].numberOfIsotopes); return std::string(moleculeData[_id-1].formula[isotope-1]); } /* double Molecule::TotalInternalPartitionSums(const double cellTemp) const { double QT; using namespace TIPS_2003; assert( !(_id == 34 || _id == 39) ); // Atomic Oxygen and Methanol not available assert(cellTemp >= 70. && cellTemp <= 3000. ); if(_isotope ==0) { atob( &cellTemp, &QT, Tdat, ( (tipsData[_id].qoft) +(0)*npts ), &npts); } else { atob( &cellTemp, &QT, Tdat, ( (tipsData[_id].qoft) +(_isotope-1)*npts ), &npts); } return QT; } double Molecule::TotalInternalPartitionSums(const double cellTemp, const int isotope) const { double QT; using namespace TIPS_2003; assert( !(_id == 34 || _id == 39) ); // Atomic Oxygen and Methanol not available assert(cellTemp >= 70. && cellTemp <= 3000. ); assert(isotope > 0 && isotope <= tipsData[_id].numIsotopes); atob( &cellTemp, &QT, Tdat, ( (tipsData[_id].qoft) +(isotope-1)*npts ), &npts); return QT; } double Molecule::TIPSAdjustment(const double cellTemp) const { using namespace HITRAN_2004; return (_isotope==0) ? moleculeData[_id-1].tips296[0] / TotalInternalPartitionSums(cellTemp) : moleculeData[_id-1].tips296[_isotope-1] / TotalInternalPartitionSums(cellTemp); } double Molecule::TIPSAdjustment(const double cellTemp,const int isotope) const { using namespace HITRAN_2004; assert(isotope >0 && isotope <= moleculeData[_id-1].numberOfIsotopes); return moleculeData[_id-1].tips296[isotope-1] / TotalInternalPartitionSums(cellTemp,isotope); } double Molecule::Degeneracy() const { using namespace TIPS_2003; assert( !(_id == 34 || _id == 39) ); // Atomic Oxygen and Methanol not available return (_isotope==0) ? *( (tipsData[_id].degen)+(0) ): *( (tipsData[_id].degen)+(_isotope-1) ); } double Molecule::Degeneracy(const int isotope) const { using namespace TIPS_2003; assert( !(_id == 34 || _id == 39) ); // Atomic Oxygen and Methanol not available assert(isotope > 0 && isotope <= tipsData[_id].numIsotopes); return *( (tipsData[_id].degen)+(isotope-1) ); } */ void Molecule::SetIsotope(const int isotope) { using namespace HITRAN_2004; assert(isotope >=0 && isotope <= moleculeData[_id-1].numberOfIsotopes); _isotope=isotope; }