Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

CODATA 2018 constants. Copy of processed nrn nrnunits.lib.in#47

Closed
nrnhines wants to merge 1 commit into
masterfrom
nrnunit-codata2018
Closed

CODATA 2018 constants. Copy of processed nrn nrnunits.lib.in#47
nrnhines wants to merge 1 commit into
masterfrom
nrnunit-codata2018

Conversation

@nrnhines

Copy link
Copy Markdown
Contributor

Partially responds to neuronsimulator/nrn#521

@pramodk

pramodk commented Oct 17, 2020

Copy link
Copy Markdown
Collaborator

@nrnhines : just to be sure I understand : this PR is constants to new value, right?

  • If so, are we saying if neuron master is using default new values, coreneuron should use the same. Seems fine.
  • But we should add then option in CoreNEURON cmake to allow use of legacy constants? (e.g. in BBP simulations I don't know if there will be switch right away)

@nrnhines

Copy link
Copy Markdown
Contributor Author

I was thinking that CoreNEURON would exclusively use the new values. This makes sense only if NEURON can serve as the
validator. I.e. NEURON and CoreNEURON produce same results for default NEURON (nrnunit_use_legacy() returns 0). And NEURON produces the original results (nrnunit_use_legacy() returns 1). The user would judge whether legacy and modern results compare acceptably well. Any result differences would presumably be due to

note that FARADAY and R in eion.c affect calculation of ghk and nernst.
FARADAY
Modern           96485.332 (the double precision value is e-mole where e=1.602176634e-19 and mole=6.02214076e+23)
Legacy nmodl     96485.309
Legacy eion.c    96485.309

R (gas constant)
Modern          8.3144626 (the double precision value is k-mole where k=1.380649e-23 and mole=6.02214076e+23)
Legacy nmodl    8.3144598
Legacy eion.c   8.3134

If CoreNEURON needs to validate against itself (eg model too large to run with NEURON) then my approach needs to be rethought. The simplest rethinking is to give the CoreNEURON the same code as NEURON had prior to the dynam-units merge. I.e nmodl and mod2c need a copy of nrnunits.lib.in and a compile option inherited from CoreNEURON cmake options such as
-DCORENEURON_ENABLE_LEGACY=... analogous to what NEURON used to have (along with some #if in eion.c).

I don't think it is a good idea to give CoreNEURON the dynamic units selection capability that NEURON has. That comes at the cost of replacing constant with value[legacy_or_modern] in the translated mod files and in eion.c. However I think it is reasonable to add the NEURON value of _nrnunit_use_legacy_ to the globals.dat file (or direct transfer) generated by NEURON and check the value for consistency when consumed by CoreNEURON.

@pramodk

pramodk commented Oct 21, 2020

Copy link
Copy Markdown
Collaborator

If CoreNEURON needs to validate against itself (eg model too large to run with NEURON) then my approach needs to be rethought. The simplest rethinking is to give the CoreNEURON the same code as NEURON had prior to the dynam-units merge. I.e nmodl and mod2c need a copy of nrnunits.lib.in and a compile option inherited from CoreNEURON cmake options such as
-DCORENEURON_ENABLE_LEGACY=... analogous to what NEURON used to have (along with some #if in eion.c).

Discussed over Skype call. We will add -DCORENEURON_ENABLE_LEGACY_UNIT=ON option to CoreNEURON CMake which will allow to turn on/off legacy unit values.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants