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

HeterodimerizationReaction.cpp

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

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