From: Rainer M. <ra...@tb...> - 2006-06-13 14:53:16
|
Andrew > [S(0)] = S(0)/C(0) > > not > > [S(0)] = S(0)/C(t) Let's say S doesn't change over time for some reason. It might even have an ODE, e.g. dS/dt = ( k * S(t) * activeEnzyme(t) ) / C(t) but during integration activeEnzyme never appears, i.e. its concentrations stays 0. Thus dS/dt is always 0. Then in SOSlib the initialConcentration would not change and [S(t)] = [S(0)] = S(0) / C(0) while it actually should be [S(t)] = S(0) / C(t) This is not represented in SOSlib. Stefand and Luki pointed out that the problem might be even more fundamental and that we cannot represent variable compartments at all. if S is a function of time and of volume C, S(t,C(t)), then dS/dt = dS/dt + dS/dC * dC/dt where the d on the right hand side represent the partial differential (as in PDEs). Maybe on Friday, when Stefan is here, we can formulate the problem in more general terms. Rainer On Tue, 13 Jun 2006, Andrew Finney wrote: > Rainer > > You wrote: > >> What cvode does is to add the concentration increase ds to >> the initial >> concentration: >> >> s(t) = s(0) + ds >> >> if the volume is doubled during that time e.g. by a rate >> rule, ds should >> correctly include the changing volume because its part of the ODE. >> >> However, s(0)=1 has never been corrected for the changing volume! >> >> If the ODE ds/dt was 0 during this time, e.g. because of a missing >> activator of the reaction, s(t) would still change to 0.5, >> because the >> volume has doubled. >> >> This is not reflected in SOSlib! > > Either I'm missing something big here or... > > An initial concentration is an >initial< concentration > > at any time concentration > > [S] = S/C > > [S(t)] = S(t)/C(t) > > therefore > > [S(0)] = S(0)/C(0) > > not > > [S(0)] = S(0)/C(t) > > How can S(0) ever vary as the volume varies over time? > S(0) is a value at only one point in time. > > yours Andrew > >> -----Original Message----- >> From: Rainer Machne [mailto:ra...@tb...] >> Sent: 13 June 2006 15:09 >> To: Andrew Finney >> Cc: SOSlib Development >> Subject: RE: [SOSlib-devel] variable compartment bug[Scanned] >> >> Andrew >> >> >> I have added a corrected and more clear version of the example file. >> >> >>> All you need to do is ensure that the initialAmount values >> are used to >>> calculate the initialConcentration values again by dividing by the >>> volume. Have we implemented that? >> >> Yes, the internal SBML ode model only contains >> initialConcentrations; initialAmounts from the input model >> have all been converted by dividing by compartment size. >> >> >>> if S1 is in a compartment with volume C then >>> >>> d[S1]/dt = (f1() + f2() + ... fn()) / C >>> >>> f1..fn are the reaction rates which are >>> expressions that have units substance/time >>> >>> f1...fn are functions of the concentrations of the >>> species [S1]..[Sn] >>> >>> I thought that's what we'd implemented. >> >> Yes, that is what we have. >> >> >>> Why do you need two sets of values? >> >> Ok, I'll try to explain in more detail. >> >> I change the notation to >> S ... amount of molecule S >> s ... concentration, [S] = S/v >> v ... volume >> >> >> Imagine we start with initialConcentration s(0) = 1, >> and integrate from 0 to time 1. >> >> What cvode does is to add the concentration increase ds to >> the initial >> concentration: >> >> s(t) = s(0) + ds >> >> if the volume is doubled during that time e.g. by a rate >> rule, ds should >> correctly include the changing volume because its part of the ODE. >> >> However, s(0)=1 has never been corrected for the changing volume! >> >> If the ODE ds/dt was 0 during this time, e.g. because of a missing >> activator of the reaction, s(t) would still change to 0.5, >> because the >> volume has doubled. >> >> This is not reflected in SOSlib! >> >> To the example XML: >> >>> Note the initial volume of the compartment is not specified >> in the xml. >> >> Sorry, I tried the model with old version which still had the >> `missing >> parameter bug' from last week. >> See the attached corrected file. >> >> The compartment volume increases to 11 because of its rate rule >> d(volume)/dt = + 0.1 >> >> Substance s1 starts with concentration 1 and is totally >> consumed by the >> irreversible reaction >> >> S1 -> S2; kineticLaw = k+S1 >> >> which moves all molecules to S2. >> >> Substance S2 would have a final concentration of 1, if the >> compartment >> still had volume 1, but not for a final volume of 11. >> >> The final concentration should be 1/11. >> >> The totalConcentration in the example file should also >> decrease to 1/11. >> >> >> SOSlib and the ODE division by volume only corrects the change of >> concentration but not the initial concentration, or generally >> spoken, the >> concentration of the last time step, which also has decreased. >> >> The only solution i can think of, is to define ODEs in >> substance/time and >> do the division independently of the ODE system. >> >> Rainer >> >> >> >> >> >> >> >> >> >> >> On Tue, 13 Jun 2006, Andrew Finney wrote: >> >>> Rainer >>> >>> Slow down!! >>> >>> I don't actually understand the argument: >>> why can't you have the ODEs as ODEs of concentrations: >>> >>> if S1 is in a compartment with volume C then >>> >>> d[S1]/dt = (f1() + f2() + ... fn()) / C >>> >>> f1..fn are the reaction rates which are >>> expressions that have units substance/time >>> >>> f1...fn are functions of the concentrations of the >>> species [S1]..[Sn] >>> >>> I thought that's what we'd implemented. >>> >>> Why do you need two sets of values? >>> >>> I would strongly urge we go for the approach is having >>> one set of values and carefully converting the units as is >> appropriate. >>> >>> fundamentally what's the problem? >>> >>> In the SBML you sent the only fly in the ointment >>> is that the initial value for the species is >>> expressed in substance units via the initialAmount >> attribute rather than >>> the initialConcentration >>> attribute which is in concentration units. >>> >>> All you need to do is ensure that the initialAmount >>> values are used to calculate the initialConcentration >> values again by >>> dividing by the volume. Have >>> we implemented that? >>> >>> Note the initial volume of the compartment is not specified >> in the xml. >>> >>> yours Andrew >>> >>>> -----Original Message----- >>>> From: sbm...@li... >>>> [mailto:sbm...@li...] On >>>> Behalf Of Rainer Machne >>>> Sent: 13 June 2006 11:42 >>>> To: SOSlib Development >>>> Subject: [SOSlib-devel] variable compartment bug[Scanned] >>>> >>>> Folks >>>> >>>> Lukas has identified another serious bug! >>>> >>>> SOSlib doesn't support variable compartments. >>>> >>>> We initialize sundials with ODEs for concentrations d[A]/dt, >>>> and sundials calculates [A] + (d[A]/dt)*h, where h is a small >>>> time step and [A] is the initial condition or the current value. >>>> >>>> If we have a variable, e.g time-dependent compartment, then >>>> d[A]/dt will change with changing compartment because the >>>> compartment size is part of the right hand side. >>>> >>>> However, not only d[A]/dt is dependent on the volume, but >>>> also [A], i.e. >>>> the current value in data->value! >>>> >>>> The attached example file exemplifies this. >>>> >>>> So we actually should use an ODE system in amount/time >>>> instead of concentration/time, and have a second data->value >>>> array for concentrations to be used in formula evaluation. >>>> >>>> Didn't we discuss this once? I remember that I had started to >>>> do this (ODEs in amount/time), but then it got more >>>> complicated then I thought and something else came up. >>>> >>>> Can you think of any problems we will run into? Andrew, how >>>> about the compiling version? >>>> >>>> Rainer >>>> >>> >> > |