Closed kaizu closed 5 years ago
This requires for users to give the dimension of Species like:
with species_attributes():
A | B | C | {'dimension': 2}
with reaction_rules():
A + B > C | k
https://github.com/ecell/ecell4/pull/56 would fix this problem.
from ecell4 import *
from ecell4_base.core import Quantity_Integer, Quantity_Real
with species_attributes():
A | B | C | {}
D | {'location': 'M'}
M | {'dimension': 2, 'structure': True}
with reaction_rules():
A + B > C | Quantity_Real(0.01, 'um**3/item/s')
A + M > D | Quantity_Real(1.0, 'um/s')
A > B | Quantity_Real(1.0, 'item/s') * A / (Quantity_Integer(120, 'item') + A)
m = get_model()
from ecell4.extra.unit_checker import check_units
check_units(m) # Nothing would occur
Here is the MinDE model:
with species_attributes():
Cytoplasm | {'dimension': Q_(3, 'dimensionless'), 'structure': True}
Membrane | {'dimension': Q_(2, 'dimensionless'), 'location': 'Cytoplasm', 'structure': True}
MinDatp | MinDadp | {'D': Q_(16.0, 'um**2/s'), 'location': 'Cytoplasm'}
MinEE_C | {'D': Q_(10.0, 'um**2/s'), 'location': 'Cytoplasm'}
MinD | MinEE_M | MinDEE | MinDEED | {'D': Q_(0.02, 'um**2/s'), 'location': 'Membrane'}
with reaction_rules():
Membrane + MinDatp > MinD | Q_(0.022, 'um/s')
MinD + MinDatp > MinD + MinD | Q_(0.03, 'um**3/item/s')
MinD + MinEE_C > MinDEE | Q_(0.5, 'um**3/item/s')
MinDEE > MinEE_M + MinDadp | Q_(1.0, '1/s')
MinDadp > MinDatp | Q_(5.0, '1/s')
MinDEE + MinD > MinDEED | Q_(5e-15, 'm**2/item/s') # 5000 um**3/s
MinDEED > MinDEE + MinDadp | Q_(1.0, '1/s')
MinEE_M > MinEE_C | Q_(0.83, '1/s')
The unit system expects all reactions happens in volume now. The second order reaction on surface should have a rate with unit
[1/(substance/length**2)/sec]
rather than[1/(substance/length**3)/sec]
.