BlueBrain / nmodl

Code Generation Framework For NEURON MODeling Language
https://bluebrain.github.io/nmodl/
Apache License 2.0
48 stars 15 forks source link

Localize kinetic reaction rates. #1232

Closed 1uc closed 3 months ago

1uc commented 3 months ago

If assignments and reaction equations are interspersed the ODE might use incorrect reaction rates. Example:

rate = 42.0
~ a <-> b (1.0*rate, 2.0*rate)
rate = 43.0
~ c <-> d (3.0*rate, 4.0*rate)

was equivalent to:

rate = 42.0
rate = 43.0
~ a <-> b (1.0*rate, 2.0*rate)
~ c <-> d (3.0*rate, 4.0*rate)

This PR solves the issue by localizing the rates, i.e. it'll produce:

LOCAL kf0_, kb0_, kf1_, kb1_
rate = 42.0
kf0_ = 1.0*rate
kb0_ = 2.0*rate
~ a <-> b (kf0_, kb0_)
rate = 43.0
kf1_ = 3.0*rate
kb1_ = 4.0*rate
~ c <-> d (kf1_, kb1_)

Which can then be safely shuffled into:

LOCAL kf0_, kb0_, kf1_, kb1_
rate = 42.0
kf0_ = 1.0*rate
kb0_ = 2.0*rate

rate = 43.0
kf1_ = 3.0*rate
kb1_ = 4.0*rate

~ a <-> b (kf0_, kb0_)
~ c <-> d (kf1_, kb1_)

and from there transformed as usual.

bbpbuildbot commented 3 months ago

Logfiles from GitLab pipeline #203571 (:white_check_mark:) have been uploaded here!

Status and direct links:

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 96.20253% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 86.65%. Comparing base (98e6df2) to head (8483416). Report is 1 commits behind head on master.

:exclamation: Current head 8483416 differs from pull request most recent head b8ebe7f. Consider uploading reports for the commit b8ebe7f to get more accurate results

Files Patch % Lines
src/visitors/kinetic_block_visitor.cpp 96.20% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1232 +/- ## ========================================== + Coverage 86.59% 86.65% +0.05% ========================================== Files 176 176 Lines 13053 13132 +79 ========================================== + Hits 11303 11379 +76 - Misses 1750 1753 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bbpbuildbot commented 3 months ago

Logfiles from GitLab pipeline #203730 (:white_check_mark:) have been uploaded here!

Status and direct links:

bbpbuildbot commented 3 months ago

Logfiles from GitLab pipeline #203809 (:white_check_mark:) have been uploaded here!

Status and direct links:

bbpbuildbot commented 3 months ago

Logfiles from GitLab pipeline #203899 (:white_check_mark:) have been uploaded here!

Status and direct links: