BlueBrain / nmodl

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

Fix (NON)LINEAR block with explicit SOLVEFOR #1326

Closed JCGoran closed 2 weeks ago

JCGoran commented 2 weeks ago

The (NON)LINEAR block in NMODL was not accounting for the SOLVEFOR variables, which means that something like the following would fail (when used with sympy --analytic):

STATE {
    x
    y
    z
}
LINEAR lin SOLVEFOR x, y {
    ~ 3 * x = v - y
    ~ x = z * y - 5
}

because the SOLVEFOR variables were not accounted for, only the STATE ones, which caused the solver to think this was a nonlinear system due to the presence of the z * y term in the second equation (i.e. the solver would try to solve the system for all STATE variables instead of just the ones specified in SOLVEFOR).

codecov[bot] commented 2 weeks ago

Codecov Report

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

Project coverage is 85.37%. Comparing base (5ff221d) to head (df4a608).

Files Patch % Lines
src/visitors/sympy_solver_visitor.cpp 84.21% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1326 +/- ## ========================================== - Coverage 85.37% 85.37% -0.01% ========================================== Files 178 178 Lines 13440 13458 +18 ========================================== + Hits 11475 11490 +15 - Misses 1965 1968 +3 ```

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

bbpbuildbot commented 2 weeks ago

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

Status and direct links:

JCGoran commented 2 weeks ago

It seems that, according to the docs, you can also use SOLVEFOR in KINETIC, which I believe requires modifying some other visitor (which one?): https://github.com/neuronsimulator/nrn/blob/386212697752a52a083b7611a07ab4030d9cb3f0/src/nmodl/simultan.cpp#L372-L389

bbpbuildbot commented 2 weeks ago

Logfiles from GitLab pipeline #217825 (:no_entry:) have been uploaded here!

Status and direct links: