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

HeterodimerDissociationReaction.cpp

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

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