From: Rainer M. <ra...@tb...> - 2006-06-20 14:33:39
|
> However, this might still only be correct, if compartments are determined by > assignment rules. > If they are determined by rate rules, then the replacement S1 -> S1/V would > also be required for constructing the jacobi matrix. I just realized that it needs generally be done for constructing the jacobi because the jacoby should of course also be e.g. (dS1/dt)/dS2 and not (dS1/dt)/d[S2]. r On Tue, 20 Jun 2006, Rainer Machne wrote: > stefan > > >>> divide k by V(0) and the whole kinetic law again by V^2 for 2nd order >>> reactions >> >> yes. >> and that's exactly the same what you are planning, >> if you want to use conc ans subst in parallel. >> only the point of conversion differs. > > not really. i wasn't planning any conversion of the math, > except for: > > current ODE: d[S1]/dt = f(S1, S2, ...) / V > planned ODE: d S1 /dt = f(S1, S2, ...) > > then we have two data->value arrays, let's say > > data->odeValues = S1, S2, S3, etc. > and > data->concValues = [S1], [S2], [S3] etc. > > > The first array `odeValues' corresponds to the SUNDIALS values in NVector y. > The second array `concValues' will be used in evaluateAST, for evaluation the > math. > > > This would be equivalent of course, with just replacing all [S1] in all math > expressions with S1/volume, and only using one array data->odeValues > > While the latter approach might be easier to implement it has a probably the > not so small drawback, that for each species in each math expression the > evaluation needs one more operation, i.e. the division, while this division > could be done only once for each species whenever data->odeValues is updated > (i.e. e.g. in the SOSlib/SUNDIALS funciton f). > > However, this might still only be correct, if compartments are determined by > assignment rules. > If they are determined by rate rules, then the replacement S1 -> S1/V would > also be required for constructing the jacobi matrix. > >> of course you have to check if the species in your kinetic law have >> dimension >> conc or substance! >> sbml allows the usage of both, doesn't it? > > See section 4.6.4 here > http://sbml.org/specifications/sbml-level-2/version-1/html/sbml-level-2.html#SECTION00046000000000000000 > > " > The units of the species are of the form substance/size units > > ... > > The units of the species are used in the following ways: > > ... > * The species identifier has these units when it appears as a numerical > quantity in a mathematical formula expressed in MathML (discussed in Section > 3.6.3). > " > > So i guess, the units of species in math expressions are always in > concentrations! > > Rainer > > > > > >> >> i mean, every species is in a well-defined compartment, isn't it? >> so you can use the formula [S]=S/V whenever you want... >> >> i would eliminate conc as early as possile, but that's a matter of > taste. > > > > On Tue, 20 Jun 2006, Stefan Mueller wrote: > >> hi rainer! >> >>> stefan >>> >>>>> Currently the ODE would be: >>>>> >>>>> d[S1]/dt = k1 * [S1] / V1 >>>> >>>> this is not valid for variable compartments. >>> >>> i said that it's invalid for variable compartments some lines below: >>>>> which is only valid for constant compartments V1 and V2. >>>> >>>> please don't use it for comparison! >>> >>> it's not used for comparison, but it is the current implementation in >>> SOSlib! >> >> i said this just to avoid any additional misunderstanding. >> the whole topic seems to be quite confusing... >> >>>>> At least for the second ODE, depending in two different volumes, >>>>> the conversion to ODEs depending on substance instead of concentration >>>>> is not as simple as >>>>> >>>>>> dS1/dt = k * [S1] * [S2] / V(0) * V = k/V(0) * S1 * S2 / V >>>> >>>> why dou you refer to this law for a reaction of order 2? >>> >>> sorry, at first i wanted to make the second reaction in V2 of 2nd order, >>> e.g., >>> >>> in V2: >>> S2 + S3 -> P: k2*[S2]*[S3] >>> >>>>> as your example before, >>>>> but for S2 I get: >>>>> >>>>> dS2/dt = k1/V1(0) * S1/V1 * V2 - k2/V2(0) * S2 >>>>> >>>>> Right? >>>> >>>> no! >>>> dS2/dt = k1/V1(0) * S1 - k2/V2(0) * S2 >>>> it's as simple as that! >>>> (since dS2/dt = -dS1/dt as far as reaction S1->S2 is concerned.) >>>> that's the advantage of kinetic laws (and consequently odes) for >>>> substances! >>> >>> of course! sorry, i got quite confused obviously. >>> >>> and for the above second order reaction in V2 it would be: >>> >>> dS2/dt = k1/V1(0) * S1 - k2/V2(0) * S1 * S3 / V2 >>> >>> Right this time? >> >> yes :) >> >>>>> Thus I would really have to check the type of reaction and edit a lot of >>>>> kinetic laws before constructing the ODEs. >>>> >>>> the above example shows that this is not necessary. >>>> maybe there are other examples... >>> >>> so you say, we could convert kinetic laws that don't explicitly contain >>> the volume by simply differentiating these three cases and >>> >>>>>> order 1: >>>>>> S1->junk: k*[S1] >>>>>> dS1/dt = k * [S1] / V(0) * V = k/V(0) * S1 >>> >>> divide k by V(0) for 1st order reactions >>> >>>>>> order 2: >>>>>> S1+S2->bla: k*[S1]*[S2] >>>>>> dS1/dt = k * [S1] * [S2] / V(0) * V = k/V(0) * S1 * S2 / V >>> >>> divide k by V(0) and the whole kinetic law again by V^2 for 2nd order >>> reactions >>> >>>>>> order 3: >>>>>> S1+S2+S3->wow: k*[S1]*[S2]*[S3] >>>>>> dS1/dt = k * [S1] * [S2] * [S3] / V(0) * V = k/V(0) * S1 * S2 * S3 / >>> >>> V^2 >>> >>> divide k by V(0) and the whole kinetic law again by V^2 for 2nd order >>> reactions >> >> yes. >> and that's exactly the same what you are planning, >> if you want to use conc ans subst in parallel. >> only the point of conversion differs. >> >> i mean, every species is in a well-defined compartment, isn't it? >> so you can use the formula [S]=S/V whenever you want... >> >> i would eliminate conc as early as possile, but that's a matter of taste. >> >>> but there are also enzymatic reactions, with in often quite complex >>> kinetic laws. we would really have to do unit checking, recognizing the >>> implemented reaction mechanisms etc. >> >> of course you have to check if the species in your kinetic law have >> dimension >> conc or substance! >> sbml allows the usage of both, doesn't it? >> >>> also, we don't really know in which compartment reactions happen, but >>> could just try to get this information from the reactants' compartments. >> >> this does not matter, for 2 reasons: >> >> 1. if the kinetic law is specified correctly (including the compartment >> size), >> e.g. A+B->C: k*V*[A]*[B], >> the the compartment size is considered automatically. >> >> 2. the conversion [S]=S/V does not depend on reactions, but only on species >> (and their compartments). >> >>> so i guess, it would be much easier to >>> >>> a) use ODEs for substances but dependent on concentrations, here the only >>> thing we need to do is to leave out the compartment division at the end of >>> Species_odeFromReactions and have a double bookkeeping of amounts and >>> concentrations >> >> to my taste, double book keeping is dangerous and produces overhead. >> >>> and >>> >>> b) just ignore WRONG models that have a variable compartment but don't >>> have the compartment explicitly in their kinetic laws >>> (or check for such cases and issue an error); >>> >>> isn't it an issue of correct model writing rather then correct model >>> solving? >> >> i agree. >> >>> However, another problem might be that to calculate in amounts rather then >>> in concentrations also changes the use of absolute errors and maybe >>> also the general the performance of the integrator, i guess. ?? >> >> abs errors might change, but that's not an issue. >> rel errors should stay the same. >> (in one-compartment models everything is just multiplied by the volume.) >> >>> maybe we will have to really implement both in parallel, >> >> i hope not :) >> >>> * ODEs for concentrations/time if no variable compartments are in the >>> model >>> * ODEs for ammounts/time if any compartment is variable >>> >>> ? >>> >>> Rainer >> >> maybe we discuss the next round via telephone :) >> >> cheers, s >> >> >>>>> Thus I think it just doesn't work with kinetic laws that don't >>>>> include the compartment explicitly! >>>> >>>> i don't know exactly what you mean. >>>> of course kinetic laws with explicit compartment are "nicer", >>>> but you can always transform any kinetic law to a "nice" one... >>>> >>>>> But if they include the compartment we can write ODEs for substances but >>>>> have concentrations in the right hand side of the ODEs. We then just >>>>> need to a second array for the concentrations, as discussed before. >>>> >>>> if we still use concentrations is a separate problem, >>>> independent of which we discussed until now. >>>> it's a matter of taste, if we eliminate the concentrations from the >>>> kinetic laws and get a (possibly nonlinear) dependence on the >>>> compartments OR if we keep concentrations and always have linear >>>> dependence on the comp. >>>> >>>>> Rainer >>>> >>>> cheers, >>>> stefan. >>>> >>>>> On Mon, 19 Jun 2006, Stefan Mueller wrote: >>>>>> let me summarize: >>>>>> kinetic laws have units substance/time, >>>>>> and they depend on concentrations or substances. >>>>>> >>>>>> we SHOULD write down odes for substances, >>>>>> and we COULD eliminate concs completely. >>>>>> (of course, we would have to convert initial concs to substances.) >>>>>> >>>>>> in any case, odes for substances depend on the compartment size >>>>>> (linearly or according to the order of the reaction): >>>>>> >>>>>> order 1: >>>>>> S1->junk: k*[S1] >>>>>> dS1/dt = k * [S1] / V(0) * V = k/V(0) * S1 >>>>>> >>>>>> order 2: >>>>>> S1+S2->bla: k*[S1]*[S2] >>>>>> dS1/dt = k * [S1] * [S2] / V(0) * V = k/V(0) * S1 * S2 / V >>>>>> >>>>>> order 3: >>>>>> S1+S2+S3->wow: k*[S1]*[S2]*[S3] >>>>>> dS1/dt = k * [S1] * [S2] * [S3] / V(0) * V = k/V(0) * S1 * S2 * S3 / >>>>>> V^2 >>>>>> >>>>>> ... >>>>>> >>>>>> if the kinetic laws included the compartment explicitly (which is >>>>>> desirable), we would have the following situation: >>>>>> >>>>>> order 1: >>>>>> S1->junk: r*[S1]*V >>>>>> dS1/dt = r * [S1] * V= r * S1 >>>>>> >>>>>> order 2: >>>>>> S1+S2->bla: r*[S1]*[S2]*V >>>>>> dS1/dt = r * [S1] * [S2] * V= r * S1 * S2 / V >>>>>> >>>>>> order 3: >>>>>> S1+S2+S3->wow: r*[S1]*[S2]*[S3]*V >>>>>> dS1/dt = r * [S1] * [S2] * [S3] * V = r * S1 * S2 * S3 / V^2 >>>>>> >>>>>> as stated earlier, odes for substances have got another advantage. for >>>>>> the compartment size we could use either a rate rule or an assignment >>>>>> rule: dV/dt = f(t, V, ...) >>>>>> or >>>>>> V= f(t, V, ...) >>>>>> >>>>>> cheers, >>>>>> stefan. >>>>>> >>>>>> Am Montag 19 Juni 2006 11:17 schrieb Stefan Mueller: >>>>>>> andrew: >>>>>>> >>>>>>> for the SBML system >>>>>>> S1 in C >>>>>>> S1->junk : k * [S1] >>>>>>> dC/dt = 1 >>>>>>> >>>>>>> the right math is: >>>>>>> dS1/dt = k * [S1] / C(0) * C >>>>>>> dC/dt = 1 >>>>>>> with initial cond: >>>>>>> S1(0) = [S1](0) * C(0) >>>>>>> C(0) >>>>>>> >>>>>>> notation: >>>>>>> S1 ... substance >>>>>>> [S1] ... conc >>>>>>> >>>>>>> the "proposed solution" (who proposed this?) has the right units, >>>>>>> but is wrong otherwise... :) >>>>>>> >>>>>>> as rainer and me already discussed, everything would be much clearer, >>>>>>> if the kinetic law included the compartment explicitly: >>>>>>> S1 in C >>>>>>> S1->junk : C * r * [S1] >>>>>>> dC/dt = 1 >>>>>>> >>>>>>> with: >>>>>>> r ... the "real" chemical rate constant. >>>>>>> >>>>>>> rainer: >>>>>>> >>>>>>> chemists always knew that rate constants are not constant with respect >>>>>>> to pH, T, ... as a physicist i have to be fair! :) >>>>>>> >>>>>>> to conclude: the math is not really tricky. >>>>>>> odes for substances are better suited to handle both multiple and >>>>>>> variable compartments. of course, we have to take care of many >>>>>>> implementation details... >>>>>>> >>>>>>> cheers, >>>>>>> stefan. >>>>>> >>>>>> _______________________________________________ >>>>>> sbmlsolver-devel mailing list >>>>>> sbm...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel >>>>> >>>>> _______________________________________________ >>>>> sbmlsolver-devel mailing list >>>>> sbm...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel >>>> >>>> _______________________________________________ >>>> sbmlsolver-devel mailing list >>>> sbm...@li... >>>> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel >>> >>> _______________________________________________ >>> sbmlsolver-devel mailing list >>> sbm...@li... >>> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel >> >> >> _______________________________________________ >> sbmlsolver-devel mailing list >> sbm...@li... >> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel >> > |