diff --git a/cnexp_array/coreneuron/leonhard.cpp b/cnexp_array/coreneuron/leonhard.cpp index c24bb7f..f14bfcd 100644 --- a/cnexp_array/coreneuron/leonhard.cpp +++ b/cnexp_array/coreneuron/leonhard.cpp @@ -100,7 +100,7 @@ namespace coreneuron { static inline int float_variables_size() { - return 7; + return 11; } diff --git a/cnexp_array/neuron/leonhard.cpp b/cnexp_array/neuron/leonhard.cpp index 066c96a..9f9282c 100644 --- a/cnexp_array/neuron/leonhard.cpp +++ b/cnexp_array/neuron/leonhard.cpp @@ -250,7 +250,7 @@ namespace neuron { _nrn_mechanism_field{"g_unused"} /* 6 */ ); - hoc_register_prop_size(mech_type, 7, 0); + hoc_register_prop_size(mech_type, 11, 0); hoc_register_var(hoc_scalar_double, hoc_vector_double, hoc_intfunc); hoc_register_npy_direct(mech_type, npy_direct_func_proc); } diff --git a/nonspecific_current/coreneuron/leonhard.cpp b/nonspecific_current/coreneuron/leonhard.cpp index d3c8242..3dea0d9 100644 --- a/nonspecific_current/coreneuron/leonhard.cpp +++ b/nonspecific_current/coreneuron/leonhard.cpp @@ -37,6 +37,7 @@ namespace coreneuron { static const char *mechanism_info[] = { "7.7.0", "leonhard", + "c_leonhard", 0, "il_leonhard", 0, @@ -60,6 +61,7 @@ namespace coreneuron { /** all mechanism instance variables and global variables */ struct leonhard_Instance { + const double* c{}; double* il{}; double* v_unused{}; double* g_unused{}; @@ -90,7 +92,7 @@ namespace coreneuron { static inline int float_variables_size() { - return 3; + return 4; } @@ -165,9 +167,10 @@ namespace coreneuron { assert(ml->global_variables_size == sizeof(leonhard_Store)); int pnodecount = ml->_nodecount_padded; Datum* indexes = ml->pdata; - inst->il = ml->data+0*pnodecount; - inst->v_unused = ml->data+1*pnodecount; - inst->g_unused = ml->data+2*pnodecount; + inst->c = ml->data+0*pnodecount; + inst->il = ml->data+1*pnodecount; + inst->v_unused = ml->data+2*pnodecount; + inst->g_unused = ml->data+3*pnodecount; } @@ -236,7 +239,7 @@ namespace coreneuron { inline double nrn_current_leonhard(int id, int pnodecount, leonhard_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v) { double current = 0.0; - inst->il[id] = 0.005 * (v - 1.5); + inst->il[id] = inst->c[id] * (v - 1.5); current += inst->il[id]; return current; } diff --git a/nonspecific_current/neuron/leonhard.cpp b/nonspecific_current/neuron/leonhard.cpp index 732dd52..1a00f09 100644 --- a/nonspecific_current/neuron/leonhard.cpp +++ b/nonspecific_current/neuron/leonhard.cpp @@ -24,7 +24,7 @@ NMODL Compiler : VERSION #define NRN_VECTORIZED 1 static constexpr auto number_of_datum_variables = 0; -static constexpr auto number_of_floating_point_variables = 3; +static constexpr auto number_of_floating_point_variables = 4; namespace { template @@ -54,6 +54,7 @@ namespace neuron { static const char *mechanism_info[] = { "7.7.0", "leonhard", + "c_leonhard", 0, "il_leonhard", 0, @@ -84,6 +85,7 @@ namespace neuron { /** all mechanism instance variables and global variables */ struct leonhard_Instance { + double* c{}; double* il{}; double* v_unused{}; double* g_unused{}; @@ -104,7 +106,8 @@ namespace neuron { return leonhard_Instance { _ml.template fpfield_ptr<0>(), _ml.template fpfield_ptr<1>(), - _ml.template fpfield_ptr<2>() + _ml.template fpfield_ptr<2>(), + _ml.template fpfield_ptr<3>() }; } @@ -126,8 +129,9 @@ namespace neuron { _nrn_mechanism_cache_instance _ml_real{_prop}; auto* const _ml = &_ml_real; size_t const _iml{}; - assert(_nrn_mechanism_get_num_vars(_prop) == 3); + assert(_nrn_mechanism_get_num_vars(_prop) == 4); /*initialize range parameters*/ + _ml->template fpfield<0>(_iml) = 0.005; /* c */ } @@ -184,7 +188,7 @@ namespace neuron { inline double nrn_current_leonhard(size_t id, leonhard_Instance& inst, leonhard_NodeData& node_data, double v) { double current = 0.0; - inst.il[id] = 0.005 * (v - 1.5); + inst.il[id] = inst.c[id] * (v - 1.5); current += inst.il[id]; return current; } @@ -252,12 +256,13 @@ namespace neuron { mech_type = nrn_get_mechtype(mechanism_info[1]); _nrn_mechanism_register_data_fields(mech_type, - _nrn_mechanism_field{"il"} /* 0 */, - _nrn_mechanism_field{"v_unused"} /* 1 */, - _nrn_mechanism_field{"g_unused"} /* 2 */ + _nrn_mechanism_field{"c"} /* 0 */, + _nrn_mechanism_field{"il"} /* 1 */, + _nrn_mechanism_field{"v_unused"} /* 2 */, + _nrn_mechanism_field{"g_unused"} /* 3 */ ); - hoc_register_prop_size(mech_type, 3, 0); + hoc_register_prop_size(mech_type, 4, 0); hoc_register_var(hoc_scalar_double, hoc_vector_double, hoc_intfunc); hoc_register_npy_direct(mech_type, npy_direct_func_proc); }