Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TrimerDissociation.cpp

Go to the documentation of this file.
00001 // TrimerDissociation.cpp: implementation of the TrimerDissociation class.
00002 //
00004 
00005 #include "TrimerDissociation.h"
00006 
00008 // Construction/Destruction
00010 
00011 CTrimerDissociation::CTrimerDissociation(Chemical *Trimer, Chemical *A, Chemical *B, Chemical *C, RateConstant *k_d, std::string reactionName)
00012 :Reaction(reactionName)
00013 {
00014         // stoichiometry
00015         this->Trimer = chemicals.size();
00016         chemicals.push_back(Trimer);
00017         numberOfEachChemicalChangedByReaction.push_back(-1);
00018 
00019         this->A = chemicals.size();
00020         chemicals.push_back(A);
00021         numberOfEachChemicalChangedByReaction.push_back(+1);
00022 
00023         this->B = chemicals.size();
00024         chemicals.push_back(B);
00025         numberOfEachChemicalChangedByReaction.push_back(+1);
00026 
00027         this->C = chemicals.size();
00028         chemicals.push_back(C);
00029         numberOfEachChemicalChangedByReaction.push_back(+1);
00030 
00031         // rates
00032         this->k_d = rateConstants.size();
00033         rateConstants.push_back(k_d);
00034 
00035         // put enough dummy chemicalJacobian elements on the vector 
00036         // - they are recomputed every time you ask for the chemicalJacobian
00037         chemicalJacobian.push_back(new JElement(-1,-1));
00038 
00039         this->SetTeXForm();
00040 
00041 
00042 }
00043 
00044 CTrimerDissociation::~CTrimerDissociation()
00045 {
00046 
00047 }
00048 
00049 double CTrimerDissociation::GetRate() const
00050 {
00051         return rateConstants[k_d]->GetValue()*chemicals[Trimer]->GetAmount();
00052 }
00053 
00054 void CTrimerDissociation::SetTeXForm()
00055 {
00056         strstream stream;
00057         // TeX form of the reaction
00058         stream << rateConstants[k_d]->GetTeXName().c_str();
00059         stream << "\\left [" << chemicals[Trimer]->GetTeXName().c_str();
00060         stream << "\\right ]";
00061         // add a NULL
00062         //int namesize = (chemicals[Generator]->GetName()).length();
00063         //stream << (chemicals[Generator]->GetName())[namesize];
00064         stream << ends;
00065         // set the TeX string equal to what's in the stream
00066         m_sTeXForm = stream.str();
00067         // free up the string
00068         stream.rdbuf()->freeze(0);
00069 }
00070 
00071 std::vector<Reaction::JElement *> *CTrimerDissociation::GetChemicalJacobian()
00072 {
00073         chemicalJacobian[0]->SetWithRespectTo(chemicals[Trimer]->GetChemicalNumber());
00074         chemicalJacobian[0]->SetJValue(rateConstants[k_d]->GetValue());
00075         
00076         return &chemicalJacobian;
00077 }

Generated on Mon Nov 3 09:38:19 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002