DiODeProject / MuMoT

Multiscale Modelling Tool - mathematical modelling without the maths
https://mumot.readthedocs.io/
GNU General Public License v3.0
21 stars 5 forks source link

Constant reactants are added among the _rates only after substitution #78

Closed joefresna closed 6 years ago

joefresna commented 6 years ago

I don't think that constant reactant should be added to the MuMoTmodel._rates list. Although, in case this is necessary, it should be consistent before and after a substitute()

Shouldn't constant reactants be treated in the same way of other reactants?

jarmarshall commented 6 years ago

Please provide an example or description of why this functionality is problematic, and how a problem arises from using substitute()

joefresna commented 6 years ago
%%model
$
U -> \alpha : \gamma_1
(G) -> U : p
$

model1 = mmt.parseModel(In[2])
model2 = model1.substitute('p = q')
print(model1._rates)
print(model2._rates)

{gamma_{1}, p}
{gamma_{1}, G, q}

issue78.ipynb.zip

jarmarshall commented 6 years ago

OK, but why is this a problem? Where is _rates being used that this would cause a problem?

Arguably the constant reactants should function like rates and be shown as such, since they are parameters of the model

joefresna commented 6 years ago

it's a problem because:

jarmarshall commented 6 years ago

Not sure this is a huge issue, can tidy up later but; showRates() functions correctly for both models.

Take a look at existing views for how to handle constant reactant widgets - these should already be handled by the base class, and, I believe, should be ordered as constant reactants first, in alphabetical order, then rates in alphabetical order. Check you're not reinventing the wheel!

Not sure how integer vs float for constant reactants; I think they need to be floats >= 0 ... what do you think @tbose1 ?

joefresna commented 6 years ago

constant rate widget is not shown in model1 but only in model2

should this value be considered as a proportion of the system size?

tbose1 commented 6 years ago

When deriving the ODEs via Master equation and system size expansion they absorb the volume and will be expressed as fractions just as time-dependent reactants (in the book by van Kampen it seems to be the same). If you apply showODEs_vKE() to the Brusselator, for example, then the constant reactant is expressed as concentration. It is still shown as '(constant reactant)' on the slider - this needs to be changed I think.

jarmarshall commented 6 years ago

@joefresna OK that sounds like a problem and not what I expected @tbose1 I don't fully follow what happens / is recommended so suggest we discuss in person

jarmarshall commented 6 years ago

@jarmarshall to fix this, and make constant reactant slider labels have format \Phi_(X)