-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Description
Context
The integrate2c function is used for solving ODEs when the method is set to cnexp
.
Overview of the issue
The following code (ODE taken from this model):
from neuron.nmodl.ode import integrate2c
integrate2c("dop' = -vmax/((km/dop)+1)", "dt", {"vmax", "km"})
returns:
'dop = km*LambertW(dop*exp((dop - dt*vmax)/km)/km)'
which contains the Lambert W function, that has no implementation in C/C++, and hence compilation of the resulting output file with a C++ compiler fails.
Expected result/behavior
We have a couple of options here:
- modify the model which uses this ODE to use the
derivimplicit
solver instead of thecnexp
one. Note that this only solves the problem for that model - the
integrate2c
function also has a section that uses the Pade approximant to evaluate the RHS numerically, so we can use that. Not sure whether there is any impact on the accuracy though, so we can probably provide a warning-level notification to the user about this - give up on this ODE and throw an error informing the user they should select another method for solving this particular ODE
UPDATE: NOCMODL converts the cnexp
solver into derivimplicit
:
Could not translate using cnexp method; using derivimplicit
so we should match the behavior.
Minimal working example - MWE
- build NEURON with
NRN_ENABLE_NMODL=ON
. Note that you may need to use this branch of NEURON - obtain the model linked above
- run
nrnivmodl dop.mod