Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
#include "header.h"
#include "ElementValueFinfo.h"
#include "lookupVolumeFromMesh.h"
#include "EnzBase.h"
#include "CplxEnzBase.h"
#include "Enz.h"
#define EPSILON 1e-15
const Cinfo* Enz::initCinfo()
{
//////////////////////////////////////////////////////////////
// Field Definitions: all inherited
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// MsgDest Definitions
//////////////////////////////////////////////////////////////
static DestFinfo setKmK1Dest( "setKmK1",
"Low-level function used when you wish to explicitly set "
"Km and k1, without doing any of the volume calculations."
"Needed by ReadKkit and other situations where the numbers "
"must be set before all the messaging is in place."
"Not relevant for zombie enzymes.",
new OpFunc2< Enz, double, double >( &Enz::setKmK1 )
);
//////////////////////////////////////////////////////////////
// Shared Msg Definitions
//////////////////////////////////////////////////////////////
static Dinfo< Enz > dinfo;
static Finfo* enzFinfos[] = {
&setKmK1Dest, // DestFinfo
};
static Cinfo enzCinfo (
"Enz",
CplxEnzBase::initCinfo(),
enzFinfos,
sizeof( enzFinfos ) / sizeof ( Finfo* ),
&dinfo
);
return &enzCinfo;
}
//////////////////////////////////////////////////////////////
static const Cinfo* enzCinfo = Enz::initCinfo();
static const SrcFinfo2< double, double >* subOut =
dynamic_cast< const SrcFinfo2< double, double >* >(
enzCinfo->findFinfo( "subOut" ) );
static const SrcFinfo2< double, double >* prdOut =
dynamic_cast< const SrcFinfo2< double, double >* >(
enzCinfo->findFinfo( "prdOut" ) );
static const SrcFinfo2< double, double >* enzOut =
dynamic_cast< const SrcFinfo2< double, double >* >(
enzCinfo->findFinfo( "enzOut" ) );
static const SrcFinfo2< double, double >* cplxOut =
dynamic_cast< const SrcFinfo2< double, double >* >(
enzCinfo->findFinfo( "cplxOut" ) );
//////////////////////////////////////////////////////////////
// Enz internal functions
//////////////////////////////////////////////////////////////
Enz::Enz( )
: Km_(5.0e-3), k1_( 0.1 ), k2_( 0.4 ), k3_( 0.1 )
{
;
}
Enz::~Enz()
{;}
//////////////////////////////////////////////////////////////
// MsgDest Definitions
//////////////////////////////////////////////////////////////
void Enz::setKmK1( double Km, double k1 )
{
r1_ = k1_ = k1;
Km_ = Km;
}
void Enz::vSub( double n )
{
r1_ *= n;
}
void Enz::vEnz( double n )
{
r1_ *= n;
}
void Enz::vCplx( double n )
{
r2_ = k2_ * n;
r3_ = k3_ * n;
}
void Enz::vProcess( const Eref& e, ProcPtr p )
{
subOut->send( e, r2_, r1_ );
prdOut->send( e, r3_, 0 );
enzOut->send( e, r3_ + r2_, r1_ );
cplxOut->send( e, r1_, r3_ + r2_ );
// cout << " proc: " << r1_ << ", " << r2_ << ", " << r3_ << endl;
r1_ = k1_;
}
void Enz::vReinit( const Eref& e, ProcPtr p )
{
r1_ = k1_;
}
void Enz::vRemesh( const Eref& e )
{
setKm( e, Km_ );
}
//////////////////////////////////////////////////////////////
// Field Definitions
//////////////////////////////////////////////////////////////
void Enz::vSetK1( const Eref& e, double v )
{
r1_ = k1_ = v;
double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
Km_ = ( k2_ + k3_ ) / ( k1_ * volScale );
}
double Enz::vGetK1( const Eref& e ) const
{
Enz* temp = const_cast< Enz* >( this );
temp->vSetKm( e, Km_ );
return k1_;
}
void Enz::vSetK2( const Eref& e, double v )
{
k2_ = v; // Assume this overrides the default ratio.
vSetKm( e, Km_ ); // Update k1_ here as well.
}
double Enz::vGetK2( const Eref& e ) const
{
return k2_;
}
void Enz::vSetKcat( const Eref& e, double v )
{
double ratio = k2_ / k3_;
k3_ = v;
k2_ = v * ratio;
vSetKm( e, Km_ ); // Update k1_ here as well.
}
double Enz::vGetKcat( const Eref& e ) const
{
return k3_;
}
//////////////////////////////////////////////////////////////
// Scaled field terms.
// We assume that when we set these, the k1, k2 and k3 vary as needed
// to preserve the other field terms. So when we set Km, then kcat
// and ratio remain unchanged.
//////////////////////////////////////////////////////////////
void Enz::vSetKm( const Eref& e, double v )
{
Km_ = v;
double volScale =
convertConcToNumRateUsingMesh( e, subOut, 1 );
k1_ = ( k2_ + k3_ ) / ( v * volScale );
}
double Enz::vGetKm( const Eref& e ) const
{
return Km_;
}
void Enz::vSetNumKm( const Eref& e, double v )
{
double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
k1_ = ( k2_ + k3_ ) / v;
Km_ = v / volScale;
}
double Enz::vGetNumKm( const Eref& e ) const
{
double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
return Km_ * volScale;
}
void Enz::vSetRatio( const Eref& e, double v )
{
k2_ = v * k3_;
double volScale =
convertConcToNumRateUsingMesh( e, subOut, 1 );
k1_ = ( k2_ + k3_ ) / ( Km_ * volScale );
}
double Enz::vGetRatio( const Eref& e ) const
{
return k2_ / k3_;
}
void Enz::vSetConcK1( const Eref& e, double v )
{
if ( v < EPSILON ) {
cout << "Enz::vSetConcK1: Warning: value " << v << " too small\n";
return;
}
double volScale = convertConcToNumRateUsingMesh( e, subOut, 1 );
r1_ = k1_ = v * volScale;
Km_ = ( k2_ + k3_ ) / ( v );
}
double Enz::vGetConcK1( const Eref& e ) const
{
if ( Km_ < EPSILON ) {
cout << "Enz::vGetConcK1: Warning: Km_ too small\n";
return 1.0;
}
return ( k2_ + k3_ ) / Km_;
}