Skip to content

Commit

Permalink
NEURON v9.0 compatibility fixes (migration to C++)
Browse files Browse the repository at this point in the history
 * mod files fixes for upcoming 9.0
 * izhi2007.mod is somewhat unrelated but fixes the incompatibility
   introduced in previous neuron versions. see /pull/2/
  • Loading branch information
pramodk committed May 23, 2022
1 parent cd59865 commit 6743ee9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 3 additions & 7 deletions izhi2007.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ ASSIGNED {
:t0 : Previous time
factor : Voltage factor used for calculating the current
eventflag : For diagnostic information
}


: State variables
STATE {
V (mV) : Membrane voltage
u (mV) : Slow current/recovery variable
V : Membrane voltage
u : Slow current/recovery variable
gAMPA : AMPA conductance
gNMDA : NMDA conductance
gGABAA : GABAA conductance
Expand All @@ -93,6 +88,7 @@ STATE {
I : Total current
delta : Time step
t0 : Previous time

}


Expand Down
7 changes: 6 additions & 1 deletion nsloc.mod
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ FUNCTION invl(mean (ms)) (ms) {
}
}
VERBATIM
#ifndef NRN_VERSION_GTEQ_8_2_0
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
#define RANDCAST
#else
#define RANDCAST (Rand*)
#endif
ENDVERBATIM

FUNCTION erand() {
Expand All @@ -91,7 +96,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.negexp(1)
*/
_lerand = nrn_random_pick(_p_donotuse);
_lerand = nrn_random_pick(RANDCAST _p_donotuse);
}else{
/* only can be used in main thread */
if (_nt != nrn_threads) {
Expand Down
13 changes: 6 additions & 7 deletions vecevent.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NET_RECEIVE (w) {

DESTRUCTOR {
VERBATIM
void* vv = (void*)(_p_ptr);
IvocVect* vv = (IvocVect*)(_p_ptr);
if (vv) {
hoc_obj_unref(*vector_pobj(vv));
}
Expand All @@ -41,10 +41,10 @@ ENDVERBATIM

PROCEDURE element() {
VERBATIM
{ void* vv; int i, size; double* px;
{ int i, size; double* px;
i = (int)index;
if (i >= 0) {
vv = (void*)(_p_ptr);
IvocVect* vv = (IvocVect*)(_p_ptr);
if (vv) {
size = vector_capacity(vv);
px = vector_vec(vv);
Expand All @@ -64,16 +64,15 @@ ENDVERBATIM

PROCEDURE play() {
VERBATIM
void** pv;
void* ptmp = NULL;
IvocVect* ptmp = (IvocVect*) NULL;
if (ifarg(1)) {
ptmp = vector_arg(1);
hoc_obj_ref(*vector_pobj(ptmp));
}
pv = (void**)(&_p_ptr);
IvocVect** pv = (IvocVect**)(&_p_ptr);
if (*pv) {
hoc_obj_unref(*vector_pobj(*pv));
}
*pv = ptmp;
ENDVERBATIM
}
}

0 comments on commit 6743ee9

Please sign in to comment.