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

HomodimerizationReaction.cpp

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

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