MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Enz.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 #include "Enz.h"
16 
17 #define EPSILON 1e-15
19 {
21  // Field Definitions: all inherited
24  // MsgDest Definitions
26  static DestFinfo setKmK1Dest( "setKmK1",
27  "Low-level function used when you wish to explicitly set "
28  "Km and k1, without doing any of the volume calculations."
29  "Needed by ReadKkit and other situations where the numbers "
30  "must be set before all the messaging is in place."
31  "Not relevant for zombie enzymes.",
33  );
35  // Shared Msg Definitions
37  static Dinfo< Enz > dinfo;
38  static Finfo* enzFinfos[] = {
39  &setKmK1Dest, // DestFinfo
40  };
41 
42  static Cinfo enzCinfo (
43  "Enz",
45  enzFinfos,
46  sizeof( enzFinfos ) / sizeof ( Finfo* ),
47  &dinfo
48  );
49 
50  return &enzCinfo;
51 }
53 
54 static const Cinfo* enzCinfo = Enz::initCinfo();
56  dynamic_cast< const SrcFinfo2< double, double >* >(
57  enzCinfo->findFinfo( "subOut" ) );
58 
60  dynamic_cast< const SrcFinfo2< double, double >* >(
61  enzCinfo->findFinfo( "prdOut" ) );
62 
64  dynamic_cast< const SrcFinfo2< double, double >* >(
65  enzCinfo->findFinfo( "enzOut" ) );
66 
68  dynamic_cast< const SrcFinfo2< double, double >* >(
69  enzCinfo->findFinfo( "cplxOut" ) );
70 
71 
73 // Enz internal functions
76  : Km_(5.0e-3), k1_( 0.1 ), k2_( 0.4 ), k3_( 0.1 )
77 {
78  ;
79 }
80 
82 {;}
83 
85 // MsgDest Definitions
87 
88 void Enz::setKmK1( double Km, double k1 )
89 {
90  r1_ = k1_ = k1;
91  Km_ = Km;
92 }
93 
94 void Enz::vSub( double n )
95 {
96  r1_ *= n;
97 }
98 
99 void Enz::vEnz( double n )
100 {
101  r1_ *= n;
102 }
103 
104 void Enz::vCplx( double n )
105 {
106  r2_ = k2_ * n;
107  r3_ = k3_ * n;
108 }
109 
110 void Enz::vProcess( const Eref& e, ProcPtr p )
111 {
112  subOut->send( e, r2_, r1_ );
113  prdOut->send( e, r3_, 0 );
114  enzOut->send( e, r3_ + r2_, r1_ );
115  cplxOut->send( e, r1_, r3_ + r2_ );
116 
117  // cout << " proc: " << r1_ << ", " << r2_ << ", " << r3_ << endl;
118 
119  r1_ = k1_;
120 }
121 
122 void Enz::vReinit( const Eref& e, ProcPtr p )
123 {
124  r1_ = k1_;
125 }
126 
127 void Enz::vRemesh( const Eref& e )
128 {
129  setKm( e, Km_ );
130 }
131 
133 // Field Definitions
135 
136 void Enz::vSetK1( const Eref& e, double v )
137 {
138  r1_ = k1_ = v;
139  double volScale = convertConcToNumRateUsingMesh( e, enzOut, 1 );
140  Km_ = ( k2_ + k3_ ) / ( k1_ * volScale );
141 }
142 
143 double Enz::vGetK1( const Eref& e ) const
144 {
145  Enz* temp = const_cast< Enz* >( this );
146  temp->vSetKm( e, Km_ );
147  return k1_;
148 }
149 
150 void Enz::vSetK2( const Eref& e, double v )
151 {
152  k2_ = v; // Assume this overrides the default ratio.
153  vSetKm( e, Km_ ); // Update k1_ here as well.
154 }
155 
156 double Enz::vGetK2( const Eref& e ) const
157 {
158  return k2_;
159 }
160 
161 void Enz::vSetKcat( const Eref& e, double v )
162 {
163  double ratio = 4.0;
164  if ( v < EPSILON )
165  v = EPSILON;
166  if (k3_ > EPSILON)
167  ratio = k2_ / k3_;
168  k3_ = v;
169  k2_ = v * ratio;
170  vSetKm( e, Km_ ); // Update k1_ here as well.
171 }
172 
173 double Enz::vGetKcat( const Eref& e ) const
174 {
175  return k3_;
176 }
177 
179 // Scaled field terms.
180 // We assume that when we set these, the k1, k2 and k3 vary as needed
181 // to preserve the other field terms. So when we set Km, then kcat
182 // and ratio remain unchanged.
184 
185 void Enz::vSetKm( const Eref& e, double v )
186 {
187  Km_ = v;
188  double volScale =
189  convertConcToNumRateUsingMesh( e, enzOut, 1 );
190  k1_ = ( k2_ + k3_ ) / ( v * volScale );
191 }
192 
193 double Enz::vGetKm( const Eref& e ) const
194 {
195  return Km_;
196 }
197 
198 void Enz::vSetNumKm( const Eref& e, double v )
199 {
200  double volScale = convertConcToNumRateUsingMesh( e, enzOut, 1 );
201  k1_ = ( k2_ + k3_ ) / v;
202  Km_ = v / volScale;
203 }
204 
205 double Enz::vGetNumKm( const Eref& e ) const
206 {
207  double volScale = convertConcToNumRateUsingMesh( e, enzOut, 1 );
208  return Km_ * volScale;
209 }
210 
211 void Enz::vSetRatio( const Eref& e, double v )
212 {
213  k2_ = v * k3_;
214  double volScale =
215  convertConcToNumRateUsingMesh( e, enzOut, 1 );
216 
217  k1_ = ( k2_ + k3_ ) / ( Km_ * volScale );
218 }
219 
220 double Enz::vGetRatio( const Eref& e ) const
221 {
222  return k2_ / k3_;
223 }
224 
225 void Enz::vSetConcK1( const Eref& e, double v )
226 {
227  if ( v < EPSILON ) {
228  cout << "Enz::vSetConcK1: Warning: value " << v << " too small\n";
229  return;
230  }
231  double volScale = convertConcToNumRateUsingMesh( e, enzOut, 1 );
232  r1_ = k1_ = v * volScale;
233  Km_ = ( k2_ + k3_ ) / ( v );
234 }
235 
236 double Enz::vGetConcK1( const Eref& e ) const
237 {
238  if ( Km_ < EPSILON ) {
239  cout << "Enz::vGetConcK1: Warning: Km_ too small\n";
240  return 1.0;
241  }
242  return ( k2_ + k3_ ) / Km_;
243 }
double r1_
in time
Definition: Enz.h:66
double vGetConcK1(const Eref &e) const
Definition: Enz.cpp:236
static const SrcFinfo2< double, double > * subOut
Definition: Enz.cpp:55
void vSub(double n)
Definition: Enz.cpp:94
~Enz()
Definition: Enz.cpp:81
void vSetKcat(const Eref &e, double v)
Definition: Enz.cpp:161
double vGetK1(const Eref &e) const
Definition: Enz.cpp:143
double vGetKm(const Eref &e) const
Definition: Enz.cpp:193
void setKmK1(double Km, double k1)
Definition: Enz.cpp:88
double vGetKcat(const Eref &e) const
Definition: Enz.cpp:173
void vSetRatio(const Eref &e, double v)
Definition: Enz.cpp:211
static const SrcFinfo2< double, double > * prdOut
Definition: Enz.cpp:59
Definition: Dinfo.h:60
double vGetNumKm(const Eref &e) const
Definition: Enz.cpp:205
double Km_
Definition: Enz.h:62
void vRemesh(const Eref &e)
Definition: Enz.cpp:127
static const SrcFinfo2< double, double > * cplxOut
Definition: Enz.cpp:67
double vGetK2(const Eref &e) const
Definition: Enz.cpp:156
static const Cinfo * enzCinfo
Definition: Enz.cpp:54
Definition: OpFunc.h:40
void vSetK1(const Eref &e, double v)
Definition: Enz.cpp:136
double r3_
Definition: Enz.h:68
Enz()
Definition: Enz.cpp:75
void send(const Eref &e, const T1 &arg1, const T2 &arg2) const
Definition: SrcFinfo.h:228
void setKm(const Eref &e, double v)
Definition: EnzBase.cpp:230
void vCplx(double n)
Definition: Enz.cpp:104
Definition: Eref.h:26
static const Cinfo * initCinfo()
Definition: Enz.cpp:18
void vSetNumKm(const Eref &e, double v)
Definition: Enz.cpp:198
void vProcess(const Eref &e, ProcPtr p)
Definition: Enz.cpp:110
void vReinit(const Eref &e, ProcPtr p)
Definition: Enz.cpp:122
double convertConcToNumRateUsingMesh(const Eref &e, const SrcFinfo *pools, bool doPartialConversion)
static const SrcFinfo2< double, double > * enzOut
Definition: Enz.cpp:63
Definition: Enz.h:13
double r2_
Definition: Enz.h:67
double k2_
in # and time units
Definition: Enz.h:64
double k3_
in time
Definition: Enz.h:65
void vSetConcK1(const Eref &e, double v)
Definition: Enz.cpp:225
#define EPSILON
Definition: Enz.cpp:17
void vSetKm(const Eref &e, double v)
Definition: Enz.cpp:185
double k1_
Km in concentration units: millimolar.
Definition: Enz.h:63
double vGetRatio(const Eref &e) const
Definition: Enz.cpp:220
Definition: Cinfo.h:18
void vEnz(double n)
Definition: Enz.cpp:99
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
static const Cinfo * initCinfo()
Definition: CplxEnzBase.cpp:49
Definition: Finfo.h:12
void vSetK2(const Eref &e, double v)
Definition: Enz.cpp:150