Skip to content

Commit

Permalink
Merge branch 'master' into olupton/python-overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
olupton authored Apr 20, 2023
2 parents c414dc6 + a5a15c2 commit 464b5e1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion external/mod2c
2 changes: 1 addition & 1 deletion src/modlunit/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ void nrnunit_dynamic_str(char (&buf)[NRN_BUFSIZE], const char* name, char* u1, c
#if (defined(LegacyFR) && LegacyFR == 1)
Sprintf(buf, "static double %s = %g;\n", name, unit_mag());
#else
Sprintf(buf, "static double %s = %.12g;\n", name, unit_mag());
Sprintf(buf, "static double %s = %a;\n", name, unit_mag());
#endif
unit_pop();

Expand Down
1 change: 1 addition & 0 deletions test/pynrn/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test_mod_legacy():
assert ut.e * ut.avogadro == ut.faraday
assert abs(ut.faraday - h.FARADAY) < 1e-10
assert ut.gasconst == h.R
assert ut.gasconst_exact == 8.313424
assert ut.k * ut.avogadro == ut.gasconst
assert abs(ut.planck - ut.hbar * 2.0 * h.PI) < 1e-49
assert ut.avogadro == h.Avogadro_constant
Expand Down
5 changes: 4 additions & 1 deletion test/pynrn/unitstest.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NEURON {
POINT_PROCESS UnitsTest
RANGE mole, e, faraday, planck, hbar, gasconst, avogadro, k
RANGE mole, e, faraday, planck, hbar, gasconst, gasconst_exact, avogadro, k
RANGE erev, ghk
USEION na READ ena WRITE ina
}
Expand All @@ -15,6 +15,7 @@ UNITS {
h = (planck) (joule-sec)
hb = (hbar) (joule-sec)
R = (k-mole) (joule/degC)
Rexact = 8.313424 (joule/degC)
boltzmann = (k) (joule/degC)

(avogadro) = (mole)
Expand All @@ -28,6 +29,7 @@ ASSIGNED {
planck (joule-sec)
hbar (joule-sec)
gasconst (joule/degC)
gasconst_exact (joule/degC)
avogadro (1)
k (joule/degC)
erev (mV)
Expand All @@ -43,6 +45,7 @@ INITIAL {
planck = h
hbar = hb
gasconst = R
gasconst_exact = Rexact
avogadro = avo
k = boltzmann
erev = ena
Expand Down

0 comments on commit 464b5e1

Please sign in to comment.