@@ -128,39 +128,39 @@ class MichaelisMentenBase : public DynamicReactionModelBase
128128 virtual bool requiresWorkspace () const CADET_NOEXCEPT { return true ; }
129129 virtual unsigned int workspaceSize (unsigned int nComp, unsigned int totalNumBoundStates, unsigned int const * nBoundStates) const CADET_NOEXCEPT
130130 {
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),
133133 2 * (_nComp + totalNumBoundStates) * sizeof (double ));
134134 }
135135
136136 virtual bool configureModelDiscretization (IParameterProvider& paramProvider, unsigned int nComp, unsigned int const * nBound, unsigned int const * boundOffset)
137137 {
138138 DynamicReactionModelBase::configureModelDiscretization (paramProvider, nComp, nBound, boundOffset);
139139
140- if (paramProvider.exists (" MM_STOICHIOMETRY_BULK " ))
140+ if (paramProvider.exists (" MM_STOICHIOMETRY " ))
141141 {
142- const std::size_t numElements = paramProvider.numElements (" MM_STOICHIOMETRY_BULK " );
142+ const std::size_t numElements = paramProvider.numElements (" MM_STOICHIOMETRY " );
143143 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) + " )" );
145145
146146 const unsigned int nReactions = numElements / nComp;
147147
148- _stoichiometryBulk .resize (nComp, nReactions);
148+ _stoichiometry .resize (nComp, nReactions);
149149 _idxSubstrate.resize (nReactions);
150150 }
151151
152152 return true ;
153153 }
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 (); }
156156 virtual unsigned int numReactionsCombined () const CADET_NOEXCEPT { return 0 ; }
157157
158158 CADET_DYNAMICREACTIONMODEL_BOILERPLATE
159159
160160protected:
161161 ParamHandler_t _paramHandler; // !< Handles parameters and their dependence on external functions
162162
163- linalg::ActiveDenseMatrix _stoichiometryBulk ;
163+ linalg::ActiveDenseMatrix _stoichiometry ;
164164 std::vector<std::vector<int >> _idxSubstrate; // !< Indices of substrate components for each reaction [reaction][substrate indices]
165165 std::vector<std::vector<std::unordered_set<int >>> _idxCompInhibitors; // !< Indices of competitive inhibitors [reaction][substrate][inhibitor indices]
166166 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
188188
189189 virtual bool configureImpl (IParameterProvider& paramProvider, UnitOpIdx unitOpIdx, ParticleTypeIdx parTypeIdx)
190190 {
191- _paramHandler.configure (paramProvider, _stoichiometryBulk .columns (), _nComp, _nBoundStates);
191+ _paramHandler.configure (paramProvider, _stoichiometry .columns (), _nComp, _nBoundStates);
192192 _paramHandler.registerParameters (_parameters, unitOpIdx, parTypeIdx, _nComp, _nBoundStates);
193193 _oldInterface = false ;
194194
195195 // handle old interface
196196 // - kmm is the number of reactions
197197 // - 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" )))
199199 {
200200 _oldInterface = true ;
201201 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" ;
202202 }
203203
204204 // Parameter validations
205- if ((_stoichiometryBulk .columns () > 0 ) && ((_paramHandler.vMax ().size () < _stoichiometryBulk .columns ())))
205+ if ((_stoichiometry .columns () > 0 ) && ((_paramHandler.vMax ().size () < _stoichiometry .columns ())))
206206 throw InvalidParameterException (" MM_VMAX have to have the size (number of reactions)" );
207207
208- if (_oldInterface && (_stoichiometryBulk .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometryBulk .columns ()))
208+ if (_oldInterface && (_stoichiometry .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometry .columns ()))
209209 throw InvalidParameterException (" MM_KMM have to have the size (number of reactions)" );
210210
211- if (!_oldInterface && (_stoichiometryBulk .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometryBulk .columns () * _nComp))
211+ if (!_oldInterface && (_stoichiometry .columns () > 0 ) && (_paramHandler.kMM ().size () < _stoichiometry .columns () * _nComp))
212212 throw InvalidParameterException (" MM_KMM must have the size (number of reactions) x (number of components)" );
213213
214214 // 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 " ))
216216 {
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);
220220 bool hasCompetiveInhibition = false ;
221221
222222 if (paramProvider.exists (" MM_KI_C" ))
223223 {
224224 KIC = paramProvider.getDoubleArray (" MM_KI_C" );
225- if (KIC.size () != _stoichiometryBulk .columns () * _nComp * _nComp)
225+ if (KIC.size () != _stoichiometry .columns () * _nComp * _nComp)
226226 throw InvalidParameterException (" MM_KI_C must have the size (number of reactions) x (number of components) x (number of components)" );
227227 }
228228
229229 if (paramProvider.exists (" MM_KI_UC" ))
230230 {
231231 KIUC = paramProvider.getDoubleArray (" MM_KI_UC" );
232- if (KIUC.size () != _stoichiometryBulk .columns () * _nComp * _nComp)
232+ if (KIUC.size () != _stoichiometry .columns () * _nComp * _nComp)
233233 throw InvalidParameterException (" MM_KI_UC must have the size (number of reactions) x (number of components) x (number of components)" );
234234 }
235235 if (paramProvider.exists (" MM_KI" ))
@@ -239,14 +239,14 @@ class MichaelisMentenBase : public DynamicReactionModelBase
239239 }
240240
241241
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 ()));
245245
246- std::copy (s.begin (), s.end (), _stoichiometryBulk .data ());
246+ std::copy (s.begin (), s.end (), _stoichiometry .data ());
247247
248248 // 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 ());
250250 _idxSubstrate.clear ();
251251 _idxCompInhibitors.resize (nReactions);
252252 _idxUncompInhibitors.resize (nReactions);
@@ -256,7 +256,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
256256 std::vector<int > idxSubstrateReaction_r;
257257 for (unsigned int c = 0 ; c < _nComp; ++c)
258258 {
259- if (_stoichiometryBulk .native (c, r) < 0.0 )
259+ if (_stoichiometry .native (c, r) < 0.0 )
260260 idxSubstrateReaction_r.push_back (static_cast <int >(c));
261261 }
262262
@@ -300,7 +300,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
300300 }
301301 }
302302
303- registerCompRowMatrix (_parameters, unitOpIdx, parTypeIdx, " MM_STOICHIOMETRY_BULK " , _stoichiometryBulk );
303+ registerCompRowMatrix (_parameters, unitOpIdx, parTypeIdx, " MM_STOICHIOMETRY " , _stoichiometry );
304304 return true ;
305305 }
306306
@@ -312,9 +312,9 @@ class MichaelisMentenBase : public DynamicReactionModelBase
312312
313313 // Calculate fluxes
314314 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 ());
316316
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)
318318 {
319319 unsigned int nSub = _idxSubstrate[r].size ();
320320 flux_t vProd = 1.0 ;
@@ -376,7 +376,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
376376 }
377377
378378 // 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);
380380
381381 return 0 ;
382382 }
@@ -400,7 +400,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
400400 {
401401 typename ParamHandler_t::ParamsHandle const p = _paramHandler.update (t, secIdx, colPos, _nComp, _nBoundStates, workSpace);
402402
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)
404404 {
405405 unsigned int nSub = _idxSubstrate[r].size ();
406406
@@ -583,7 +583,7 @@ class MichaelisMentenBase : public DynamicReactionModelBase
583583 RowIterator curJac = jac;
584584 for (unsigned int row = 0 ; row < _nComp; ++row, ++curJac)
585585 {
586- const double colFactor = static_cast <double >(_stoichiometryBulk .native (row, r)) * factor;
586+ const double colFactor = static_cast <double >(_stoichiometry .native (row, r)) * factor;
587587 curJac[static_cast <int >(comp) - static_cast <int >(row)] += colFactor * dvdy;
588588 }
589589 }
0 commit comments