MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CplxEnzBase.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #include "header.h"
11 #include "ElementValueFinfo.h"
12 #include "lookupVolumeFromMesh.h"
13 #include "EnzBase.h"
14 #include "CplxEnzBase.h"
15 
18  "enzOut",
19  "Sends out increment of molecules on product each timestep"
20  );
21  return &enzOut;
22 }
23 
26  "cplxOut",
27  "Sends out increment of molecules on product each timestep"
28  );
29  return &cplxOut;
30 }
31 
33 {
34  static const Finfo* f1 = EnzBase::initCinfo()->findFinfo( "enzDest" );
35  static const DestFinfo* f2 = dynamic_cast< const DestFinfo* >( f1 );
36  static DestFinfo* enzDest = const_cast< DestFinfo* >( f2 );
37  assert( f1 );
38  assert( f2 );
39  return enzDest;
40 }
41 
42 /*
43 static DestFinfo* enzDest =
44  dynamic_cast< DestFinfo* >(
45  const_cast< Finfo* >(
46  EnzBase::initCinfo()->findFinfo( "enzDest" ) ) );
47  */
48 
50 {
52  // Field Definitions
55  "k1",
56  "Forward reaction from enz + sub to complex, in # units."
57  "This parameter is subordinate to the Km. This means that"
58  "when Km is changed, this changes. It also means that when"
59  "k2 or k3 (aka kcat) are changed, we assume that Km remains"
60  "fixed, and as a result k1 must change. It is only when"
61  "k1 is assigned directly that we assume that the user knows"
62  "what they are doing, and we adjust Km accordingly."
63  "k1 is also subordinate to the 'ratio' field, since setting "
64  "the ratio reassigns k2."
65  "Should you wish to assign the elementary rates k1, k2, k3,"
66  "of an enzyme directly, always assign k1 last.",
69  );
70 
72  "k2",
73  "Reverse reaction from complex to enz + sub",
76  );
77 
79  "k3",
80  "Forward rate constant from complex to product + enz",
83  );
84 
86  "ratio",
87  "Ratio of k2/k3",
90  );
91 
93  "concK1",
94  "K1 expressed in concentration (1/millimolar.sec) units"
95  "This parameter is subordinate to the Km. This means that"
96  "when Km is changed, this changes. It also means that when"
97  "k2 or k3 (aka kcat) are changed, we assume that Km remains"
98  "fixed, and as a result concK1 must change. It is only when"
99  "concK1 is assigned directly that we assume that the user knows"
100  "what they are doing, and we adjust Km accordingly."
101  "concK1 is also subordinate to the 'ratio' field, since"
102  "setting the ratio reassigns k2."
103  "Should you wish to assign the elementary rates concK1, k2, k3,"
104  "of an enzyme directly, always assign concK1 last.",
107  );
108 
110  // MsgDest Definitions: most are inherited from EnzBase.
112  static DestFinfo cplxDest( "cplxDest",
113  "Handles # of molecules of enz-sub complex",
115 
117  // Shared Msg Definitions
119  static Finfo* enzShared[] = {
120  enzOut(), enzDest()
121  };
122  static Finfo* cplxShared[] = {
123  cplxOut(), &cplxDest
124  };
125 
126  static SharedFinfo enz( "enz",
127  "Connects to enzyme pool",
128  enzShared, sizeof( enzShared ) / sizeof( const Finfo* )
129  );
130  static SharedFinfo cplx( "cplx",
131  "Connects to enz-sub complex pool",
132  cplxShared, sizeof( cplxShared ) / sizeof( const Finfo* )
133  );
134 
135  static Finfo* cplxEnzFinfos[] = {
136  &k1, // Value
137  &k2, // Value
138  &k3, // Value
139  &ratio, // Value
140  &concK1, // Value
141  &enz, // SharedFinfo
142  &cplx, // SharedFinfo
143  };
144 
145  static string doc[] =
146  {
147  "Name", "CplxEnzBase",
148  "Author", "Upi Bhalla",
149  "Description:",
150  "Base class for mass-action enzymes in which there is an "
151  " explicit pool for the enzyme-substrate complex. "
152  "It models the reaction: "
153  "E + S <===> E.S ----> E + P"
154  };
155 
156  static ZeroSizeDinfo< int > dinfo;
157  static Cinfo cplxEnzCinfo (
158  "CplxEnzBase",
160  cplxEnzFinfos,
161  sizeof( cplxEnzFinfos ) / sizeof ( Finfo* ),
162  &dinfo,
163  doc,
164  sizeof( doc )/sizeof( string )
165  );
166 
167  return &cplxEnzCinfo;
168 }
169 
171 
173 // Enz internal functions
176 { ; }
178 { ; }
179 
181 // MsgDest Definitions
183 
184 void CplxEnzBase::cplx( double n )
185 {
186  vCplx( n );
187 }
188 
189 void CplxEnzBase::vCplx( double n )
190 {;}
191 
193 // Field Definitions
195 
196 void CplxEnzBase::setK1( const Eref& e, double v )
197 {
198  vSetK1( e, v );
199 }
200 
201 double CplxEnzBase::getK1( const Eref& e ) const
202 {
203  return vGetK1( e );
204 }
205 
206 void CplxEnzBase::setK2( const Eref& e, double v )
207 {
208  vSetK2( e, v );
209 }
210 
211 double CplxEnzBase::getK2( const Eref& e ) const
212 {
213  return vGetK2( e );
214 }
215 
217 // Scaled field terms.
218 // We assume that when we set these, the k1, k2 and k3 vary as needed
219 // to preserve the other field terms. So when we set Km, then kcat
220 // and ratio remain unchanged.
222 
223 void CplxEnzBase::setRatio( const Eref& e, double v )
224 {
225  vSetRatio( e, v );
226 }
227 
228 double CplxEnzBase::getRatio( const Eref& e ) const
229 {
230  return vGetRatio( e );
231 }
232 
233 void CplxEnzBase::setConcK1( const Eref& e, double v )
234 {
235  vSetConcK1( e, v );
236 }
237 
238 double CplxEnzBase::getConcK1( const Eref& e ) const
239 {
240  return vGetConcK1( e );
241 }
242 
244 // Zombie conversion routine.
246 
247 
254 void CplxEnzBase::zombify( Element* orig, const Cinfo* zClass, Id solver )
255 {
256  if ( orig->cinfo() == zClass )
257  return;
258  unsigned int start = orig->localDataStart();
259  unsigned int num = orig->numLocalData();
260  if ( num == 0 )
261  return;
262  vector< double > concK1( num, 0.0 );
263  vector< double > k2( num, 0.0 );
264  vector< double > kcat( num, 0.0 );
265  for ( unsigned int i = 0; i < num; ++i ) {
266  Eref er( orig, i + start );
267  const CplxEnzBase* ceb =
268  reinterpret_cast< const CplxEnzBase* >( er.data() );
269  concK1[ i ] = ceb->getConcK1( er );
270  k2[ i ] = ceb->getK2( er );
271  kcat[ i ] = ceb->getKcat( er );
272  }
273  orig->zombieSwap( zClass );
274  for ( unsigned int i = 0; i < num; ++i ) {
275  Eref er( orig, i + start );
276  CplxEnzBase* ceb = reinterpret_cast< CplxEnzBase* >( er.data() );
277  ceb->setSolver( solver, orig->id() );
278  ceb->setKcat( er, kcat[i] );
279  ceb->setK2( er, k2[i] );
280  ceb->setConcK1( er, concK1[i] );
281  }
282 }
virtual double vGetConcK1(const Eref &e) const =0
char * data() const
Definition: Eref.cpp:41
virtual double vGetK2(const Eref &e) const =0
double getK2(const Eref &e) const
void setK1(const Eref &e, double v)
virtual void zombieSwap(const Cinfo *zCinfo)
virtual func, this base version must be called by all derived classes
Definition: Element.cpp:159
DestFinfo * enzDest()
Definition: CplxEnzBase.cpp:32
static void zombify(Element *original, const Cinfo *zClass, Id solver)
Id id() const
Definition: Element.cpp:71
virtual double vGetK1(const Eref &e) const =0
virtual void vSetConcK1(const Eref &e, double v)=0
void enz(double n)
Definition: EnzBase.cpp:187
void setK2(const Eref &e, double v)
void setConcK1(const Eref &e, double v)
virtual void vSetRatio(const Eref &e, double v)=0
virtual double vGetRatio(const Eref &e) const =0
double getK1(const Eref &e) const
double getConcK1(const Eref &e) const
Definition: OpFunc.h:27
Definition: Eref.h:26
const Cinfo * cinfo() const
Definition: Element.cpp:66
virtual void vSetK1(const Eref &e, double v)=0
virtual unsigned int localDataStart() const =0
Returns index of first data entry on this node.
void cplx(double n)
virtual unsigned int numLocalData() const =0
Returns number of local data entries on this node.
virtual ~CplxEnzBase()
double getKcat(const Eref &e) const
Definition: EnzBase.cpp:256
static SrcFinfo2< double, double > * enzOut()
Definition: CplxEnzBase.cpp:16
Definition: Id.h:17
virtual void vSetK2(const Eref &e, double v)=0
static SrcFinfo2< double, double > * cplxOut()
Definition: CplxEnzBase.cpp:24
double getRatio(const Eref &e) const
void setKcat(const Eref &e, double v)
Definition: EnzBase.cpp:251
static const Cinfo * cplxEnzCinfo
Definition: Cinfo.h:18
static const Cinfo * initCinfo()
Definition: EnzBase.cpp:33
void setRatio(const Eref &e, double v)
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
static const Cinfo * initCinfo()
Definition: CplxEnzBase.cpp:49
Definition: Finfo.h:12
virtual void vCplx(double n)
virtual void setSolver(Id solver, Id orig)
Assign solver info.
Definition: EnzBase.cpp:319