@@ -128,39 +128,39 @@ class MichaelisMentenBase : public DynamicReactionModelBase
128
128
virtual bool requiresWorkspace () const CADET_NOEXCEPT { return true ; }
129
129
virtual unsigned int workspaceSize (unsigned int nComp, unsigned int totalNumBoundStates, unsigned int const * nBoundStates) const CADET_NOEXCEPT
130
130
{
131
- return _paramHandler.cacheSize (_stoichiometryBulk .columns (), nComp, totalNumBoundStates) +
132
- std::max (_stoichiometryBulk .columns () * sizeof (active),
131
+ return _paramHandler.cacheSize (_stoichiometry .columns (), nComp, totalNumBoundStates) +
132
+ std::max (_stoichiometry .columns () * sizeof (active),
133
133
2 * (_nComp + totalNumBoundStates) * sizeof (double ));
134
134
}
135
135
136
136
virtual bool configureModelDiscretization (IParameterProvider& paramProvider, unsigned int nComp, unsigned int const * nBound, unsigned int const * boundOffset)
137
137
{
138
138
DynamicReactionModelBase::configureModelDiscretization (paramProvider, nComp, nBound, boundOffset);
139
139
140
- if (paramProvider.exists (" MM_STOICHIOMETRY_BULK " ))
140
+ if (paramProvider.exists (" MM_STOICHIOMETRY " ))
141
141
{
142
- const std::size_t numElements = paramProvider.numElements (" MM_STOICHIOMETRY_BULK " );
142
+ const std::size_t numElements = paramProvider.numElements (" MM_STOICHIOMETRY " );
143
143
if (numElements % nComp != 0 )
144
- throw InvalidParameterException (" Size of field MM_STOICHIOMETRY_BULK must be a positive multiple of NCOMP (" + std::to_string (nComp) + " )" );
144
+ throw InvalidParameterException (" Size of field MM_STOICHIOMETRY must be a positive multiple of NCOMP (" + std::to_string (nComp) + " )" );
145
145
146
146
const unsigned int nReactions = numElements / nComp;
147
147
148
- _stoichiometryBulk .resize (nComp, nReactions);
148
+ _stoichiometry .resize (nComp, nReactions);
149
149
_idxSubstrate.resize (nReactions);
150
150
}
151
151
152
152
return true ;
153
153
}
154
- virtual unsigned int numReactions () const CADET_NOEXCEPT { return _stoichiometryBulk .columns (); }
155
- virtual unsigned int numReactionsLiquid () const CADET_NOEXCEPT { return _stoichiometryBulk .columns (); }
154
+ virtual unsigned int numReactions () const CADET_NOEXCEPT { return _stoichiometry .columns (); }
155
+ virtual unsigned int numReactionsLiquid () const CADET_NOEXCEPT { return _stoichiometry .columns (); }
156
156
virtual unsigned int numReactionsCombined () const CADET_NOEXCEPT { return 0 ; }
157
157
158
158
CADET_DYNAMICREACTIONMODEL_BOILERPLATE
159
159
160
160
protected:
161
161
ParamHandler_t _paramHandler; // !< Handles parameters and their dependence on external functions
162
162
163
- linalg::ActiveDenseMatrix _stoichiometryBulk ;
163
+ linalg::ActiveDenseMatrix _stoichiometry ;
164
164
std::vector<std::vector<int >> _idxSubstrate; // !< Indices of substrate components for each reaction [reaction][substrate indices]
165
165
std::vector<std::vector<std::unordered_set<int >>> _idxCompInhibitors; // !< Indices of competitive inhibitors [reaction][substrate][inhibitor indices]
166
166
std::vector<std::vector<std::unordered_set<int >>> _idxUncompInhibitors; // !< Indices of uncompetitive inhibitors [reaction][substrate][inhibitor indices]
@@ -188,48 +188,48 @@ class MichaelisMentenBase : public DynamicReactionModelBase
188
188
189
189
virtual bool configureImpl (IParameterProvider& paramProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx)
190
190
{
191
- _paramHandler.configure (paramProvider, _stoichiometryBulk .columns (), _nComp, _nBoundStates);
191
+ _paramHandler.configure (paramProvider, _stoichiometry .columns (), _nComp, _nBoundStates);
192
192
_paramHandler.registerParameters (_parameters, unitOpIdx, parTypeIdx, _nComp, _nBoundStates);
193
193
_oldInterface = false ;
194
194
195
195
// handle old interface
196
196
// - kmm is the number of reactions
197
197
// - kI refers to the non competative inhibition konstants
198
- if ((_stoichiometryBulk .columns () > 0 ) && (_paramHandler.kMM ().size () == _stoichiometryBulk .columns ()) || (paramProvider.exists (" MM_KI" )))
198
+ if ((_stoichiometry .columns () > 0 ) && (_paramHandler.kMM ().size () == _stoichiometry .columns ()) || (paramProvider.exists (" MM_KI" )))
199
199
{
200
200
_oldInterface = true ;
201
201
LOG (Warning) << " MM_KI is only is only supported for backwards compatibility, but the implementation of Michaelis Menten kinetics has changed, please refer to the documentation for CADET version >= 5.2.0" ;
202
202
}
203
203
204
204
// Parameter validations
205
- if ((_stoichiometryBulk .columns () > 0 ) && ((_paramHandler.vMax ().size () < _stoichiometryBulk .columns ())))
205
+ if ((_stoichiometry .columns () > 0 ) && ((_paramHandler.vMax ().size () < _stoichiometry .columns ())))
206
206
throw InvalidParameterException (" MM_VMAX have to have the size (number of reactions)" );
207
207
208
- if (_oldInterface && (_stoichiometryBulk .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometryBulk .columns ()))
208
+ if (_oldInterface && (_stoichiometry .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometry .columns ()))
209
209
throw InvalidParameterException (" MM_KMM have to have the size (number of reactions)" );
210
210
211
- if (!_oldInterface && (_stoichiometryBulk .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometryBulk .columns () * _nComp))
211
+ if (!_oldInterface && (_stoichiometry .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometry .columns () * _nComp))
212
212
throw InvalidParameterException (" MM_KMM must have the size (number of reactions) x (number of components)" );
213
213
214
214
// kInhibitComp and kInhibitUnComp are 3D parameters with size (number of reactions) x (number of substrates) x (number of components)
215
- if (paramProvider.exists (" MM_STOICHIOMETRY_BULK " ))
215
+ if (paramProvider.exists (" MM_STOICHIOMETRY " ))
216
216
{
217
- const std::vector<double > s = paramProvider.getDoubleArray (" MM_STOICHIOMETRY_BULK " );
218
- std::vector<double > KIC (_stoichiometryBulk .columns () * _nComp * _nComp);
219
- std::vector<double > KIUC (_stoichiometryBulk .columns () * _nComp * _nComp);
217
+ const std::vector<double > s = paramProvider.getDoubleArray (" MM_STOICHIOMETRY " );
218
+ std::vector<double > KIC (_stoichiometry .columns () * _nComp * _nComp);
219
+ std::vector<double > KIUC (_stoichiometry .columns () * _nComp * _nComp);
220
220
bool hasCompetiveInhibition = false ;
221
221
222
222
if (paramProvider.exists (" MM_KI_C" ))
223
223
{
224
224
KIC = paramProvider.getDoubleArray (" MM_KI_C" );
225
- if (KIC.size () != _stoichiometryBulk .columns () * _nComp * _nComp)
225
+ if (KIC.size () != _stoichiometry .columns () * _nComp * _nComp)
226
226
throw InvalidParameterException (" MM_KI_C must have the size (number of reactions) x (number of components) x (number of components)" );
227
227
}
228
228
229
229
if (paramProvider.exists (" MM_KI_UC" ))
230
230
{
231
231
KIUC = paramProvider.getDoubleArray (" MM_KI_UC" );
232
- if (KIUC.size () != _stoichiometryBulk .columns () * _nComp * _nComp)
232
+ if (KIUC.size () != _stoichiometry .columns () * _nComp * _nComp)
233
233
throw InvalidParameterException (" MM_KI_UC must have the size (number of reactions) x (number of components) x (number of components)" );
234
234
}
235
235
if (paramProvider.exists (" MM_KI" ))
@@ -239,14 +239,14 @@ class MichaelisMentenBase : public DynamicReactionModelBase
239
239
}
240
240
241
241
242
- if (s.size () != _stoichiometryBulk .elements ())
243
- throw InvalidParameterException (" MM_STOICHIOMETRY_BULK size mismatch: Expected " +
244
- std::to_string (_stoichiometryBulk .elements ()) + " elements but got " + std::to_string (s.size ()));
242
+ if (s.size () != _stoichiometry .elements ())
243
+ throw InvalidParameterException (" MM_STOICHIOMETRY size mismatch: Expected " +
244
+ std::to_string (_stoichiometry .elements ()) + " elements but got " + std::to_string (s.size ()));
245
245
246
- std::copy (s.begin (), s.end (), _stoichiometryBulk .data ());
246
+ std::copy (s.begin (), s.end (), _stoichiometry .data ());
247
247
248
248
// Identify substrates (negative entries in stoichiometry matrix)
249
- const unsigned int nReactions = static_cast <unsigned int >(_stoichiometryBulk .columns ());
249
+ const unsigned int nReactions = static_cast <unsigned int >(_stoichiometry .columns ());
250
250
_idxSubstrate.clear ();
251
251
_idxCompInhibitors.resize (nReactions);
252
252
_idxUncompInhibitors.resize (nReactions);
@@ -256,7 +256,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
256
256
std::vector<int > idxSubstrateReaction_r;
257
257
for (unsigned int c = 0 ; c < _nComp; ++c)
258
258
{
259
- if (_stoichiometryBulk .native (c, r) < 0.0 )
259
+ if (_stoichiometry .native (c, r) < 0.0 )
260
260
idxSubstrateReaction_r.push_back (static_cast <int >(c));
261
261
}
262
262
@@ -300,7 +300,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
300
300
}
301
301
}
302
302
303
- registerCompRowMatrix (_parameters, unitOpIdx, parTypeIdx, " MM_STOICHIOMETRY_BULK " , _stoichiometryBulk );
303
+ registerCompRowMatrix (_parameters, unitOpIdx, parTypeIdx, " MM_STOICHIOMETRY " , _stoichiometry );
304
304
return true ;
305
305
}
306
306
@@ -312,9 +312,9 @@ class MichaelisMentenBase : public DynamicReactionModelBase
312
312
313
313
// Calculate fluxes
314
314
typedef typename DoubleActivePromoter<StateType, ParamType>::type flux_t ;
315
- BufferedArray<flux_t > fluxes = workSpace.array <flux_t >(_stoichiometryBulk .columns ());
315
+ BufferedArray<flux_t > fluxes = workSpace.array <flux_t >(_stoichiometry .columns ());
316
316
317
- for (unsigned int r = 0 ; r < static_cast <unsigned int >(_stoichiometryBulk .columns ()); ++r)
317
+ for (unsigned int r = 0 ; r < static_cast <unsigned int >(_stoichiometry .columns ()); ++r)
318
318
{
319
319
unsigned int nSub = _idxSubstrate[r].size ();
320
320
flux_t vProd = 1.0 ;
@@ -376,7 +376,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
376
376
}
377
377
378
378
// Add reaction terms to residual
379
- _stoichiometryBulk .multiplyVector (static_cast <flux_t *>(fluxes), factor, res);
379
+ _stoichiometry .multiplyVector (static_cast <flux_t *>(fluxes), factor, res);
380
380
381
381
return 0 ;
382
382
}
@@ -400,7 +400,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
400
400
{
401
401
typename ParamHandler_t::ParamsHandle const p = _paramHandler.update (t, secIdx, colPos, _nComp, _nBoundStates, workSpace);
402
402
403
- for (unsigned int r = 0 ; r < static_cast <unsigned int >(_stoichiometryBulk .columns ()); ++r)
403
+ for (unsigned int r = 0 ; r < static_cast <unsigned int >(_stoichiometry .columns ()); ++r)
404
404
{
405
405
unsigned int nSub = _idxSubstrate[r].size ();
406
406
@@ -583,7 +583,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
583
583
RowIterator curJac = jac;
584
584
for (unsigned int row = 0 ; row < _nComp; ++row, ++curJac)
585
585
{
586
- const double colFactor = static_cast <double >(_stoichiometryBulk .native (row, r)) * factor;
586
+ const double colFactor = static_cast <double >(_stoichiometry .native (row, r)) * factor;
587
587
curJac[static_cast <int >(comp) - static_cast <int >(row)] += colFactor * dvdy;
588
588
}
589
589
}
0 commit comments