Skip to content

Commit 4d7eed3

Browse files
pramodkolupton
andauthored
Avoid errors with STATE variables without DERIVATE block (#2)
* NEURON 9.0 compatibility. * Avoid errors with STATE variables without DERIVATE block * Convert STATE variables to ASSIGN and revert previous change * update readme Co-authored-by: Olli Lupton <[email protected]>
1 parent cd59865 commit 4d7eed3

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

README.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,17 @@
9191
For any questions or further assistance please contact:
9292
salvadordura at gmail.com
9393

94+
95+
------------------------------------------------------------------------------------------------------
96+
Changelog
97+
-------------------------------------------------------------------------------------------------------
98+
99+
2022-05:
100+
* Updated MOD files to compile with upcoming 9.0 neuron release
101+
with migration to C++.
102+
* izhi2007.mod is updated in order to compile with current neuron
103+
releases where STATE variables without ODEs or SOLVE block gives an error.
104+
See discussion in https://github.com/ModelDBRepository/194897/pull/2
105+
94106
</pre></html>
95107

izhi2007.mod

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ ASSIGNED {
7878
:t0 : Previous time
7979
factor : Voltage factor used for calculating the current
8080
eventflag : For diagnostic information
81-
}
8281

82+
: State variables without ODEs / SOLVE block and hence converted
83+
: to ASSIGN. See https://github.com/ModelDBRepository/194897/pull/2
8384

84-
: State variables
85-
STATE {
86-
V (mV) : Membrane voltage
87-
u (mV) : Slow current/recovery variable
85+
V : Membrane voltage
86+
u : Slow current/recovery variable
8887
gAMPA : AMPA conductance
8988
gNMDA : NMDA conductance
9089
gGABAA : GABAA conductance
@@ -125,7 +124,6 @@ PROCEDURE useverbose() { : Create user-accessible function
125124
}
126125

127126

128-
129127
: Define neuron dynamics
130128
BREAKPOINT {
131129
delta = t-t0 : Find time difference

nsloc.mod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,13 @@ FUNCTION invl(mean (ms)) (ms) {
7979
}
8080
}
8181
VERBATIM
82+
#ifndef NRN_VERSION_GTEQ_8_2_0
8283
double nrn_random_pick(void* r);
8384
void* nrn_random_arg(int argpos);
85+
#define RANDCAST
86+
#else
87+
#define RANDCAST (Rand*)
88+
#endif
8489
ENDVERBATIM
8590

8691
FUNCTION erand() {
@@ -91,7 +96,7 @@ VERBATIM
9196
: each instance. However, the corresponding hoc Random
9297
: distribution MUST be set to Random.negexp(1)
9398
*/
94-
_lerand = nrn_random_pick(_p_donotuse);
99+
_lerand = nrn_random_pick(RANDCAST _p_donotuse);
95100
}else{
96101
/* only can be used in main thread */
97102
if (_nt != nrn_threads) {

vecevent.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ NET_RECEIVE (w) {
3232

3333
DESTRUCTOR {
3434
VERBATIM
35-
void* vv = (void*)(_p_ptr);
36-
if (vv) {
35+
IvocVect* vv = (IvocVect*)(_p_ptr);
36+
if (vv) {
3737
hoc_obj_unref(*vector_pobj(vv));
3838
}
3939
ENDVERBATIM
@@ -46,8 +46,8 @@ VERBATIM
4646
if (i >= 0) {
4747
vv = (void*)(_p_ptr);
4848
if (vv) {
49-
size = vector_capacity(vv);
50-
px = vector_vec(vv);
49+
size = vector_capacity((IvocVect*)vv);
50+
px = vector_vec((IvocVect*)vv);
5151
if (i < size) {
5252
etime = px[i];
5353
index += 1.;
@@ -65,15 +65,15 @@ ENDVERBATIM
6565
PROCEDURE play() {
6666
VERBATIM
6767
void** pv;
68-
void* ptmp = NULL;
68+
IvocVect* ptmp = NULL;
6969
if (ifarg(1)) {
7070
ptmp = vector_arg(1);
7171
hoc_obj_ref(*vector_pobj(ptmp));
7272
}
7373
pv = (void**)(&_p_ptr);
7474
if (*pv) {
75-
hoc_obj_unref(*vector_pobj(*pv));
75+
hoc_obj_unref(*vector_pobj((IvocVect*)*pv));
7676
}
7777
*pv = ptmp;
7878
ENDVERBATIM
79-
}
79+
}

0 commit comments

Comments
 (0)