From 00978a597581c94c488ef190055571687e8e2d66 Mon Sep 17 00:00:00 2001 From: JCGoran Date: Fri, 10 May 2024 14:26:23 +0200 Subject: [PATCH] Update references for working hh.mod (#13) * Update references for working hh.mod --------- Co-authored-by: Luc Grosheintz --- cnexp_array/neuron/leonhard.cpp | 13 +++++++++++++ cnexp_scalar/neuron/leonhard.cpp | 10 +++++++++- func_proc/neuron/func_proc.cpp | 10 +++++++++- func_proc_pnt/neuron/func_proc_pnt.cpp | 9 ++++++++- global_breakpoint/neuron/leonhard.cpp | 10 +++++++++- hodgkin_huxley/neuron/hodhux.cpp | 19 +++++++++++++++++++ net_receive/neuron/snapsyn.cpp | 10 +++++++++- nonspecific_current/neuron/leonhard.cpp | 10 +++++++++- parameter/neuron/neuron_variables.cpp | 10 +++++++++- parameter/neuron/test_parameter.cpp | 6 +++++- point_process/neuron/test_pp.cpp | 6 +++++- 11 files changed, 104 insertions(+), 9 deletions(-) diff --git a/cnexp_array/neuron/leonhard.cpp b/cnexp_array/neuron/leonhard.cpp index 9f9282c..ebcdc97 100644 --- a/cnexp_array/neuron/leonhard.cpp +++ b/cnexp_array/neuron/leonhard.cpp @@ -187,7 +187,14 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; inst.x[id] = 42.0; (inst.s+id*2)[static_cast(0)] = 0.1; (inst.s+id*2)[static_cast(1)] = -1.0; @@ -203,7 +210,13 @@ namespace neuron { auto inst = make_instance_leonhard(_lmr); auto node_data = make_node_data_leonhard(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; inst.x[id] = inst.x[id] + (1.0 - exp(_nt->_dt * ((((inst.s+id*2)[static_cast(0)] + (inst.s+id*2)[static_cast(1)]) * ((inst.z+id*3)[static_cast(0)] * (inst.z+id*3)[static_cast(1)] * (inst.z+id*3)[static_cast(2)])) * (1.0)))) * ( -(0.0) / (((((inst.s+id*2)[static_cast(0)] + (inst.s+id*2)[static_cast(1)])) * (((((inst.z+id*3)[static_cast(0)]) * ((inst.z+id*3)[static_cast(1)])) * ((inst.z+id*3)[static_cast(2)])))) * (1.0)) - inst.x[id]); } } diff --git a/cnexp_scalar/neuron/leonhard.cpp b/cnexp_scalar/neuron/leonhard.cpp index 7b5820d..1d03d33 100644 --- a/cnexp_scalar/neuron/leonhard.cpp +++ b/cnexp_scalar/neuron/leonhard.cpp @@ -181,7 +181,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; inst.x[id] = 42.0; } } @@ -195,6 +199,10 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; inst.x[id] = inst.x[id] + (1.0 - exp(_nt->_dt * ( -1.0))) * ( -(0.0) / ( -1.0) - inst.x[id]); } } diff --git a/func_proc/neuron/func_proc.cpp b/func_proc/neuron/func_proc.cpp index d6a7fcc..0a022e8 100644 --- a/func_proc/neuron/func_proc.cpp +++ b/func_proc/neuron/func_proc.cpp @@ -331,6 +331,7 @@ namespace neuron { inline int set_x_42_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { int ret_set_x_42 = 0; + auto v = inst.v_unused[id]; set_x_a_test_func_proc(_ml, inst, id, _ppvar, _thread, _nt, 42.0); return ret_set_x_42; } @@ -338,6 +339,7 @@ namespace neuron { inline int set_x_a_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { int ret_set_x_a = 0; + auto v = inst.v_unused[id]; inst.x[id] = a; return ret_set_x_a; } @@ -345,6 +347,7 @@ namespace neuron { inline int set_a_x_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { int ret_set_a_x = 0; + auto v = inst.v_unused[id]; double a; a = inst.x[id]; return ret_set_a_x; @@ -353,6 +356,7 @@ namespace neuron { inline double x_plus_a_test_func_proc(_nrn_mechanism_cache_range* _ml, test_func_proc_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { double ret_x_plus_a = 0.0; + auto v = inst.v_unused[id]; ret_x_plus_a = inst.x[id] + a; return ret_x_plus_a; } @@ -366,7 +370,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; set_a_x_test_func_proc(_ml, inst, id, _ppvar, _thread, _nt); } } diff --git a/func_proc_pnt/neuron/func_proc_pnt.cpp b/func_proc_pnt/neuron/func_proc_pnt.cpp index 6570453..82798bc 100644 --- a/func_proc_pnt/neuron/func_proc_pnt.cpp +++ b/func_proc_pnt/neuron/func_proc_pnt.cpp @@ -265,6 +265,7 @@ namespace neuron { inline int set_x_42_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, test_func_proc_pnt_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { int ret_set_x_42 = 0; + auto v = inst.v_unused[id]; inst.x[id] = 42.0; return ret_set_x_42; } @@ -272,6 +273,7 @@ namespace neuron { inline int set_x_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, test_func_proc_pnt_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { int ret_set_x_a = 0; + auto v = inst.v_unused[id]; inst.x[id] = a; return ret_set_x_a; } @@ -279,6 +281,7 @@ namespace neuron { inline double x_plus_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, test_func_proc_pnt_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { double ret_x_plus_a = 0.0; + auto v = inst.v_unused[id]; ret_x_plus_a = inst.x[id] + a; return ret_x_plus_a; } @@ -292,7 +295,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; } } diff --git a/global_breakpoint/neuron/leonhard.cpp b/global_breakpoint/neuron/leonhard.cpp index 148b5b7..bbbd7b0 100644 --- a/global_breakpoint/neuron/leonhard.cpp +++ b/global_breakpoint/neuron/leonhard.cpp @@ -182,7 +182,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; inst.x[id] = 42.0; } } @@ -196,6 +200,10 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; inst.x[id] = inst.global->c; } } diff --git a/hodgkin_huxley/neuron/hodhux.cpp b/hodgkin_huxley/neuron/hodhux.cpp index c72da85..05b2831 100644 --- a/hodgkin_huxley/neuron/hodhux.cpp +++ b/hodgkin_huxley/neuron/hodhux.cpp @@ -212,10 +212,12 @@ namespace neuron { Prop * na_prop = need_memb(na_sym); _ppvar[0] = _nrn_mechanism_get_param_handle(na_prop, 0); _ppvar[1] = _nrn_mechanism_get_param_handle(na_prop, 3); + _ppvar[2] = _nrn_mechanism_get_param_handle(na_prop, 4); Symbol * k_sym = hoc_lookup("k_ion"); Prop * k_prop = need_memb(k_sym); _ppvar[3] = _nrn_mechanism_get_param_handle(k_prop, 0); _ppvar[4] = _nrn_mechanism_get_param_handle(k_prop, 3); + _ppvar[5] = _nrn_mechanism_get_param_handle(k_prop, 4); } @@ -377,6 +379,7 @@ namespace neuron { inline int states_hodhux(_nrn_mechanism_cache_range* _ml, hodhux_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { int ret_states = 0; + auto v = inst.v_unused[id]; rates_hodhux(_ml, inst, id, _ppvar, _thread, _nt, v); inst.m[id] = inst.m[id] + inst.mexp[id] * (inst.minf[id] - inst.m[id]); inst.h[id] = inst.h[id] + inst.hexp[id] * (inst.hinf[id] - inst.h[id]); @@ -411,6 +414,7 @@ namespace neuron { inline double vtrap_hodhux(_nrn_mechanism_cache_range* _ml, hodhux_Instance& inst, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double x, double y) { double ret_vtrap = 0.0; + auto v = inst.v_unused[id]; if (fabs(x / y) < 1e-6) { ret_vtrap = y * (1.0 - x / y / 2.0); } else { @@ -425,7 +429,14 @@ namespace neuron { auto inst = make_instance_hodhux(_lmr); auto node_data = make_node_data_hodhux(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; inst.ena[id] = (*inst.ion_ena[id]); inst.ek[id] = (*inst.ion_ek[id]); rates_hodhux(_ml, inst, id, _ppvar, _thread, _nt, v); @@ -454,6 +465,8 @@ namespace neuron { auto inst = make_instance_hodhux(_lmr); auto node_data = make_node_data_hodhux(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { int node_id = node_data.nodeindices[id]; double v = node_data.node_voltages[node_id]; @@ -481,7 +494,13 @@ namespace neuron { auto inst = make_instance_hodhux(_lmr); auto node_data = make_node_data_hodhux(*_nt, *_ml_arg); auto nodecount = _ml_arg->nodecount; + auto* const _ml = &_lmr; + auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; inst.ena[id] = (*inst.ion_ena[id]); inst.ek[id] = (*inst.ion_ek[id]); rates_hodhux(_ml, inst, id, _ppvar, _thread, _nt, v); diff --git a/net_receive/neuron/snapsyn.cpp b/net_receive/neuron/snapsyn.cpp index dae42b8..f355835 100644 --- a/net_receive/neuron/snapsyn.cpp +++ b/net_receive/neuron/snapsyn.cpp @@ -210,7 +210,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; inst.g[id] = 0.0; } } @@ -257,6 +261,10 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; } } diff --git a/nonspecific_current/neuron/leonhard.cpp b/nonspecific_current/neuron/leonhard.cpp index 1a00f09..df3cc28 100644 --- a/nonspecific_current/neuron/leonhard.cpp +++ b/nonspecific_current/neuron/leonhard.cpp @@ -181,7 +181,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; } } @@ -224,6 +228,10 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; } } diff --git a/parameter/neuron/neuron_variables.cpp b/parameter/neuron/neuron_variables.cpp index 56187f6..708cd16 100644 --- a/parameter/neuron/neuron_variables.cpp +++ b/parameter/neuron/neuron_variables.cpp @@ -180,7 +180,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; } } @@ -193,6 +197,10 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; inst.range_celsius[id] = *(inst.celsius); } } diff --git a/parameter/neuron/test_parameter.cpp b/parameter/neuron/test_parameter.cpp index 6a56379..0c88202 100644 --- a/parameter/neuron/test_parameter.cpp +++ b/parameter/neuron/test_parameter.cpp @@ -201,7 +201,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; } } diff --git a/point_process/neuron/test_pp.cpp b/point_process/neuron/test_pp.cpp index 713b846..11b0f76 100644 --- a/point_process/neuron/test_pp.cpp +++ b/point_process/neuron/test_pp.cpp @@ -197,7 +197,11 @@ namespace neuron { auto* const _ml = &_lmr; auto* _thread = _ml_arg->_thread; for (int id = 0; id < nodecount; id++) { - auto& _ppvar = _ml_arg->pdata[id]; + + int node_id = node_data.nodeindices[id]; + auto* _ppvar = _ml_arg->pdata[id]; + auto v = node_data.node_voltages[node_id]; + inst.v_unused[id] = v; } }