diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9bac605 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1770667721, + "narHash": "sha256-vz7gbwsMH9iQxywSIfZAQ4V9m+N+Z9v5+F3XdN8Zn8g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "47617cf6e75b32d7bcacc8539e6ba379afda99d9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/x86_64/.libs/libnrnmech.so b/x86_64/.libs/libnrnmech.so new file mode 100644 index 0000000..9e7ce03 Binary files /dev/null and b/x86_64/.libs/libnrnmech.so differ diff --git a/x86_64/Ca.c b/x86_64/Ca.c new file mode 100644 index 0000000..38655b9 --- /dev/null +++ b/x86_64/Ca.c @@ -0,0 +1,587 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Ca +#define _nrn_initial _nrn_initial__Ca +#define nrn_cur _nrn_cur__Ca +#define _nrn_current _nrn_current__Ca +#define nrn_jacob _nrn_jacob__Ca +#define nrn_state _nrn_state__Ca +#define _net_receive _net_receive__Ca +#define rates rates__Ca +#define states states__Ca + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gCabar _p[0] +#define gCabar_columnindex 0 +#define ica _p[1] +#define ica_columnindex 1 +#define gCa _p[2] +#define gCa_columnindex 2 +#define m _p[3] +#define m_columnindex 3 +#define h _p[4] +#define h_columnindex 4 +#define eca _p[5] +#define eca_columnindex 5 +#define mInf _p[6] +#define mInf_columnindex 6 +#define mTau _p[7] +#define mTau_columnindex 7 +#define mAlpha _p[8] +#define mAlpha_columnindex 8 +#define mBeta _p[9] +#define mBeta_columnindex 9 +#define hInf _p[10] +#define hInf_columnindex 10 +#define hTau _p[11] +#define hTau_columnindex 11 +#define hAlpha _p[12] +#define hAlpha_columnindex 12 +#define hBeta _p[13] +#define hBeta_columnindex 13 +#define Dm _p[14] +#define Dm_columnindex 14 +#define Dh _p[15] +#define Dh_columnindex 15 +#define v _p[16] +#define v_columnindex 16 +#define _g _p[17] +#define _g_columnindex 17 +#define _ion_eca *_ppvar[0]._pval +#define _ion_ica *_ppvar[1]._pval +#define _ion_dicadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Ca", _hoc_setdata, + "rates_Ca", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gCabar_Ca", "S/cm2", + "ica_Ca", "mA/cm2", + "gCa_Ca", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Ca", + "gCabar_Ca", + 0, + "ica_Ca", + "gCa_Ca", + 0, + "m_Ca", + "h_Ca", + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 18, _prop); + /*initialize range parameters*/ + gCabar = 1e-05; + _prop->param = _p; + _prop->param_size = 18; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* eca */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dicadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Ca_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 18, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Ca /mnt/c/neuron/neurenv/mech/Ca.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + if ( ( v == - 27.0 ) ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.055 * ( - 27.0 - v ) ) / ( exp ( ( - 27.0 - v ) / 3.8 ) - 1.0 ) ; + mBeta = ( 0.94 * exp ( ( - 75.0 - v ) / 17.0 ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = 1.0 / ( mAlpha + mBeta ) ; + hAlpha = ( 0.000457 * exp ( ( - 13.0 - v ) / 50.0 ) ) ; + hBeta = ( 0.0065 / ( exp ( ( - v - 15.0 ) / 28.0 ) + 1.0 ) ) ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + hTau = 1.0 / ( hAlpha + hBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + eca = _ion_eca; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gCa = gCabar * m * m * h ; + ica = gCa * ( v - eca ) ; + } + _current += ica; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + eca = _ion_eca; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dica; + _dica = ica; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dicadv += (_dica - ica)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ica += ica ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + eca = _ion_eca; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Ca.mod"; +static const char* nmodl_file_text = + ":Comment :\n" + ":Reference : : Reuveni, Friedman, Amitai, and Gutnick, J.Neurosci. 1993\n" + "\n" + "NEURON {\n" + " SUFFIX Ca\n" + " USEION ca READ eca WRITE ica\n" + " RANGE gCabar, gCa, ica \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gCabar = 0.00001 (S/cm2) \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " eca (mV)\n" + " ica (mA/cm2)\n" + " gCa (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gCa = gCabar*m*m*h\n" + " ica = gCa*(v-eca)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " if((v == -27) ){ \n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.055*(-27-v))/(exp((-27-v)/3.8) - 1) \n" + " mBeta = (0.94*exp((-75-v)/17))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = 1/(mAlpha + mBeta)\n" + " hAlpha = (0.000457*exp((-13-v)/50))\n" + " hBeta = (0.0065/(exp((-v-15)/28)+1))\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " hTau = 1/(hAlpha + hBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Ca.o b/x86_64/Ca.o new file mode 100644 index 0000000..e54abfe Binary files /dev/null and b/x86_64/Ca.o differ diff --git a/x86_64/CaDynamics_E2.c b/x86_64/CaDynamics_E2.c new file mode 100644 index 0000000..16d6ed8 --- /dev/null +++ b/x86_64/CaDynamics_E2.c @@ -0,0 +1,485 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__CaDynamics_E2 +#define _nrn_initial _nrn_initial__CaDynamics_E2 +#define nrn_cur _nrn_cur__CaDynamics_E2 +#define _nrn_current _nrn_current__CaDynamics_E2 +#define nrn_jacob _nrn_jacob__CaDynamics_E2 +#define nrn_state _nrn_state__CaDynamics_E2 +#define _net_receive _net_receive__CaDynamics_E2 +#define states states__CaDynamics_E2 + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gamma _p[0] +#define gamma_columnindex 0 +#define decay _p[1] +#define decay_columnindex 1 +#define depth _p[2] +#define depth_columnindex 2 +#define minCai _p[3] +#define minCai_columnindex 3 +#define ica _p[4] +#define ica_columnindex 4 +#define cai _p[5] +#define cai_columnindex 5 +#define Dcai _p[6] +#define Dcai_columnindex 6 +#define v _p[7] +#define v_columnindex 7 +#define _g _p[8] +#define _g_columnindex 8 +#define _ion_ica *_ppvar[0]._pval +#define _ion_cai *_ppvar[1]._pval +#define _style_ca *((int*)_ppvar[2]._pvoid) + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_CaDynamics_E2", _hoc_setdata, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "decay_CaDynamics_E2", "ms", + "depth_CaDynamics_E2", "um", + "minCai_CaDynamics_E2", "mM", + 0,0 +}; + static double cai0 = 0; + static double delta_t = 0.01; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"CaDynamics_E2", + "gamma_CaDynamics_E2", + "decay_CaDynamics_E2", + "depth_CaDynamics_E2", + "minCai_CaDynamics_E2", + 0, + 0, + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 9, _prop); + /*initialize range parameters*/ + gamma = 0.001734; + decay = 103.091; + depth = 0.1; + minCai = 0.0001; + _prop->param = _p; + _prop->param_size = 9; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_check_conc_write(_prop, prop_ion, 1); + nrn_promote(prop_ion, 3, 0); + _ppvar[0]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[1]._pval = &prop_ion->param[1]; /* cai */ + _ppvar[2]._pvoid = (void*)(&(prop_ion->dparam[0]._i)); /* iontype for ca */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _CaDynamics_E2_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 9, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "#ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + nrn_writes_conc(_mechtype, 0); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 CaDynamics_E2 /mnt/c/neuron/neurenv/mech/CaDynamics_E2.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } + +#define FARADAY _nrnunit_FARADAY[_nrnunit_use_legacy_] +static double _nrnunit_FARADAY[2] = {0x1.78e555060882cp+16, 96485.3}; /* 96485.3321233100141 */ +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + Dcai = - ( 10000.0 ) * ( ica * gamma / ( 2.0 * FARADAY * depth ) ) - ( cai - minCai ) / decay ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + Dcai = Dcai / (1. - dt*( ( - ( ( 1.0 ) ) / decay ) )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + cai = cai + (1. - exp(dt*(( - ( ( 1.0 ) ) / decay ))))*(- ( ( - ( 10000.0 ) )*( ( ( ( ica )*( gamma ) ) / ( 2.0 * FARADAY * depth ) ) ) - ( ( ( - minCai ) ) ) / decay ) / ( ( - ( ( 1.0 ) ) / decay ) ) - cai) ; + } + return 0; +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ica = _ion_ica; + cai = _ion_cai; + _ode_spec1 (_p, _ppvar, _thread, _nt); + _ion_cai = cai; + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + _pv[0] = &(_ion_cai); + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ica = _ion_ica; + cai = _ion_cai; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 1); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ica = _ion_ica; + cai = _ion_cai; + initmodel(_p, _ppvar, _thread, _nt); + _ion_cai = cai; + nrn_wrote_conc(_ca_sym, (&(_ion_cai)) - 1, _style_ca); +} +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ica = _ion_ica; + cai = _ion_cai; + { states(_p, _ppvar, _thread, _nt); + } { + } + _ion_cai = cai; +}} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = cai_columnindex; _dlist1[0] = Dcai_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/CaDynamics_E2.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ": Dynamics that track inside calcium concentration\n" + ": modified from Destexhe et al. 1994\n" + "\n" + "NEURON {\n" + " SUFFIX CaDynamics_E2\n" + " USEION ca READ ica WRITE cai\n" + " RANGE decay, gamma, minCai, depth\n" + "}\n" + "\n" + "UNITS {\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + " FARADAY = (faraday) (coulombs)\n" + " (molar) = (1/liter)\n" + " (mM) = (millimolar)\n" + " (um) = (micron)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gamma = 0.001734 : percent of free calcium (not buffered)\n" + " decay = 103.091390 (ms) : rate of removal of calcium\n" + " depth = 0.1 (um) : depth of shell\n" + " minCai = 1e-4 (mM)\n" + "}\n" + "\n" + "ASSIGNED {ica (mA/cm2)}\n" + "\n" + "STATE {\n" + " cai (mM)\n" + " }\n" + "\n" + "BREAKPOINT { SOLVE states METHOD cnexp }\n" + "\n" + "DERIVATIVE states {\n" + " cai' = -(10000)*(ica*gamma/(2*FARADAY*depth)) - (cai - minCai)/decay\n" + "}\n" + ; +#endif diff --git a/x86_64/CaDynamics_E2.o b/x86_64/CaDynamics_E2.o new file mode 100644 index 0000000..10de07b Binary files /dev/null and b/x86_64/CaDynamics_E2.o differ diff --git a/x86_64/CaDynamics_E2_soma.c b/x86_64/CaDynamics_E2_soma.c new file mode 100644 index 0000000..a411337 --- /dev/null +++ b/x86_64/CaDynamics_E2_soma.c @@ -0,0 +1,485 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__CaDynamics_E2_soma +#define _nrn_initial _nrn_initial__CaDynamics_E2_soma +#define nrn_cur _nrn_cur__CaDynamics_E2_soma +#define _nrn_current _nrn_current__CaDynamics_E2_soma +#define nrn_jacob _nrn_jacob__CaDynamics_E2_soma +#define nrn_state _nrn_state__CaDynamics_E2_soma +#define _net_receive _net_receive__CaDynamics_E2_soma +#define states states__CaDynamics_E2_soma + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gamma _p[0] +#define gamma_columnindex 0 +#define decay _p[1] +#define decay_columnindex 1 +#define depth _p[2] +#define depth_columnindex 2 +#define minCai _p[3] +#define minCai_columnindex 3 +#define ica _p[4] +#define ica_columnindex 4 +#define cai _p[5] +#define cai_columnindex 5 +#define Dcai _p[6] +#define Dcai_columnindex 6 +#define v _p[7] +#define v_columnindex 7 +#define _g _p[8] +#define _g_columnindex 8 +#define _ion_ica *_ppvar[0]._pval +#define _ion_cai *_ppvar[1]._pval +#define _style_ca *((int*)_ppvar[2]._pvoid) + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_CaDynamics_E2_soma", _hoc_setdata, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "decay_CaDynamics_E2_soma", "ms", + "depth_CaDynamics_E2_soma", "um", + "minCai_CaDynamics_E2_soma", "mM", + 0,0 +}; + static double cai0 = 0; + static double delta_t = 0.01; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"CaDynamics_E2_soma", + "gamma_CaDynamics_E2_soma", + "decay_CaDynamics_E2_soma", + "depth_CaDynamics_E2_soma", + "minCai_CaDynamics_E2_soma", + 0, + 0, + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 9, _prop); + /*initialize range parameters*/ + gamma = 0.000996; + decay = 873.499; + depth = 0.1; + minCai = 0.0001; + _prop->param = _p; + _prop->param_size = 9; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_check_conc_write(_prop, prop_ion, 1); + nrn_promote(prop_ion, 3, 0); + _ppvar[0]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[1]._pval = &prop_ion->param[1]; /* cai */ + _ppvar[2]._pvoid = (void*)(&(prop_ion->dparam[0]._i)); /* iontype for ca */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _CaDynamics_E2_soma_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 9, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "#ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + nrn_writes_conc(_mechtype, 0); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 CaDynamics_E2_soma /mnt/c/neuron/neurenv/mech/CaDynamics_E2_soma.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } + +#define FARADAY _nrnunit_FARADAY[_nrnunit_use_legacy_] +static double _nrnunit_FARADAY[2] = {0x1.78e555060882cp+16, 96485.3}; /* 96485.3321233100141 */ +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + Dcai = - ( 10000.0 ) * ( ica * gamma / ( 2.0 * FARADAY * depth ) ) - ( cai - minCai ) / decay ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + Dcai = Dcai / (1. - dt*( ( - ( ( 1.0 ) ) / decay ) )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + cai = cai + (1. - exp(dt*(( - ( ( 1.0 ) ) / decay ))))*(- ( ( - ( 10000.0 ) )*( ( ( ( ica )*( gamma ) ) / ( 2.0 * FARADAY * depth ) ) ) - ( ( ( - minCai ) ) ) / decay ) / ( ( - ( ( 1.0 ) ) / decay ) ) - cai) ; + } + return 0; +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ica = _ion_ica; + cai = _ion_cai; + _ode_spec1 (_p, _ppvar, _thread, _nt); + _ion_cai = cai; + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + _pv[0] = &(_ion_cai); + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ica = _ion_ica; + cai = _ion_cai; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 1); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ica = _ion_ica; + cai = _ion_cai; + initmodel(_p, _ppvar, _thread, _nt); + _ion_cai = cai; + nrn_wrote_conc(_ca_sym, (&(_ion_cai)) - 1, _style_ca); +} +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ica = _ion_ica; + cai = _ion_cai; + { states(_p, _ppvar, _thread, _nt); + } { + } + _ion_cai = cai; +}} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = cai_columnindex; _dlist1[0] = Dcai_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/CaDynamics_E2_soma.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ": Dynamics that track inside calcium concentration\n" + ": modified from Destexhe et al. 1994\n" + "\n" + "NEURON {\n" + " SUFFIX CaDynamics_E2_soma\n" + " USEION ca READ ica WRITE cai\n" + " RANGE decay, gamma, minCai, depth\n" + "}\n" + "\n" + "UNITS {\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + " FARADAY = (faraday) (coulombs)\n" + " (molar) = (1/liter)\n" + " (mM) = (millimolar)\n" + " (um) = (micron)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gamma = 0.000996 : percent of free calcium (not buffered)\n" + " decay = 873.498863 (ms) : rate of removal of calcium\n" + " depth = 0.1 (um) : depth of shell\n" + " minCai = 1e-4 (mM)\n" + "}\n" + "\n" + "ASSIGNED {ica (mA/cm2)}\n" + "\n" + "STATE {\n" + " cai (mM)\n" + " }\n" + "\n" + "BREAKPOINT { SOLVE states METHOD cnexp }\n" + "\n" + "DERIVATIVE states {\n" + " cai' = -(10000)*(ica*gamma/(2*FARADAY*depth)) - (cai - minCai)/decay\n" + "}\n" + ; +#endif diff --git a/x86_64/CaDynamics_E2_soma.o b/x86_64/CaDynamics_E2_soma.o new file mode 100644 index 0000000..2492bad Binary files /dev/null and b/x86_64/CaDynamics_E2_soma.o differ diff --git a/x86_64/Ca_HVA.c b/x86_64/Ca_HVA.c new file mode 100644 index 0000000..6a4f912 --- /dev/null +++ b/x86_64/Ca_HVA.c @@ -0,0 +1,585 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Ca_HVA +#define _nrn_initial _nrn_initial__Ca_HVA +#define nrn_cur _nrn_cur__Ca_HVA +#define _nrn_current _nrn_current__Ca_HVA +#define nrn_jacob _nrn_jacob__Ca_HVA +#define nrn_state _nrn_state__Ca_HVA +#define _net_receive _net_receive__Ca_HVA +#define rates rates__Ca_HVA +#define states states__Ca_HVA + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gCa_HVAbar _p[0] +#define gCa_HVAbar_columnindex 0 +#define ica _p[1] +#define ica_columnindex 1 +#define m _p[2] +#define m_columnindex 2 +#define h _p[3] +#define h_columnindex 3 +#define eca _p[4] +#define eca_columnindex 4 +#define gCa _p[5] +#define gCa_columnindex 5 +#define mInf _p[6] +#define mInf_columnindex 6 +#define mTau _p[7] +#define mTau_columnindex 7 +#define mAlpha _p[8] +#define mAlpha_columnindex 8 +#define mBeta _p[9] +#define mBeta_columnindex 9 +#define hInf _p[10] +#define hInf_columnindex 10 +#define hTau _p[11] +#define hTau_columnindex 11 +#define hAlpha _p[12] +#define hAlpha_columnindex 12 +#define hBeta _p[13] +#define hBeta_columnindex 13 +#define Dm _p[14] +#define Dm_columnindex 14 +#define Dh _p[15] +#define Dh_columnindex 15 +#define v _p[16] +#define v_columnindex 16 +#define _g _p[17] +#define _g_columnindex 17 +#define _ion_eca *_ppvar[0]._pval +#define _ion_ica *_ppvar[1]._pval +#define _ion_dicadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Ca_HVA", _hoc_setdata, + "rates_Ca_HVA", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gCa_HVAbar_Ca_HVA", "S/cm2", + "ica_Ca_HVA", "mA/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Ca_HVA", + "gCa_HVAbar_Ca_HVA", + 0, + "ica_Ca_HVA", + 0, + "m_Ca_HVA", + "h_Ca_HVA", + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 18, _prop); + /*initialize range parameters*/ + gCa_HVAbar = 0.000684; + _prop->param = _p; + _prop->param_size = 18; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* eca */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dicadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Ca_HVA_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 18, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Ca_HVA /mnt/c/neuron/neurenv/mech/Ca_HVA.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + if ( ( v == - 27.0 ) ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.055 * ( - 27.0 - v ) ) / ( exp ( ( - 27.0 - v ) / 3.8 ) - 1.0 ) ; + mBeta = ( 0.94 * exp ( ( - 75.0 - v ) / 17.0 ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = 1.0 / ( mAlpha + mBeta ) ; + hAlpha = ( 0.000457 * exp ( ( - 13.0 - v ) / 50.0 ) ) ; + hBeta = ( 0.0065 / ( exp ( ( - v - 15.0 ) / 28.0 ) + 1.0 ) ) ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + hTau = 1.0 / ( hAlpha + hBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + eca = _ion_eca; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gCa = gCa_HVAbar * m * m * h ; + ica = gCa * ( v - eca ) ; + } + _current += ica; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + eca = _ion_eca; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dica; + _dica = ica; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dicadv += (_dica - ica)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ica += ica ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + eca = _ion_eca; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Ca_HVA.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Reuveni, Friedman, Amitai, and Gutnick, J.Neurosci. 1993\n" + "\n" + "NEURON {\n" + " SUFFIX Ca_HVA\n" + " USEION ca READ eca WRITE ica\n" + " RANGE gCa_HVAbar, gCa_HVA, ica \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gCa_HVAbar = 0.000684 (S/cm2) \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " eca (mV)\n" + " ica (mA/cm2)\n" + " gCa (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gCa = gCa_HVAbar*m*m*h\n" + " ica = gCa*(v-eca)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " if((v == -27) ){ \n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.055*(-27-v))/(exp((-27-v)/3.8) - 1) \n" + " mBeta = (0.94*exp((-75-v)/17))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = 1/(mAlpha + mBeta)\n" + " hAlpha = (0.000457*exp((-13-v)/50))\n" + " hBeta = (0.0065/(exp((-v-15)/28)+1))\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " hTau = 1/(hAlpha + hBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Ca_HVA.o b/x86_64/Ca_HVA.o new file mode 100644 index 0000000..1367b99 Binary files /dev/null and b/x86_64/Ca_HVA.o differ diff --git a/x86_64/Ca_HVA_soma.c b/x86_64/Ca_HVA_soma.c new file mode 100644 index 0000000..52c087c --- /dev/null +++ b/x86_64/Ca_HVA_soma.c @@ -0,0 +1,585 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Ca_HVA_soma +#define _nrn_initial _nrn_initial__Ca_HVA_soma +#define nrn_cur _nrn_cur__Ca_HVA_soma +#define _nrn_current _nrn_current__Ca_HVA_soma +#define nrn_jacob _nrn_jacob__Ca_HVA_soma +#define nrn_state _nrn_state__Ca_HVA_soma +#define _net_receive _net_receive__Ca_HVA_soma +#define rates rates__Ca_HVA_soma +#define states states__Ca_HVA_soma + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gCa_HVAbar _p[0] +#define gCa_HVAbar_columnindex 0 +#define ica _p[1] +#define ica_columnindex 1 +#define m _p[2] +#define m_columnindex 2 +#define h _p[3] +#define h_columnindex 3 +#define eca _p[4] +#define eca_columnindex 4 +#define gCa _p[5] +#define gCa_columnindex 5 +#define mInf _p[6] +#define mInf_columnindex 6 +#define mTau _p[7] +#define mTau_columnindex 7 +#define mAlpha _p[8] +#define mAlpha_columnindex 8 +#define mBeta _p[9] +#define mBeta_columnindex 9 +#define hInf _p[10] +#define hInf_columnindex 10 +#define hTau _p[11] +#define hTau_columnindex 11 +#define hAlpha _p[12] +#define hAlpha_columnindex 12 +#define hBeta _p[13] +#define hBeta_columnindex 13 +#define Dm _p[14] +#define Dm_columnindex 14 +#define Dh _p[15] +#define Dh_columnindex 15 +#define v _p[16] +#define v_columnindex 16 +#define _g _p[17] +#define _g_columnindex 17 +#define _ion_eca *_ppvar[0]._pval +#define _ion_ica *_ppvar[1]._pval +#define _ion_dicadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Ca_HVA_soma", _hoc_setdata, + "rates_Ca_HVA_soma", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gCa_HVAbar_Ca_HVA_soma", "S/cm2", + "ica_Ca_HVA_soma", "mA/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Ca_HVA_soma", + "gCa_HVAbar_Ca_HVA_soma", + 0, + "ica_Ca_HVA_soma", + 0, + "m_Ca_HVA_soma", + "h_Ca_HVA_soma", + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 18, _prop); + /*initialize range parameters*/ + gCa_HVAbar = 0.000459; + _prop->param = _p; + _prop->param_size = 18; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* eca */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dicadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Ca_HVA_soma_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 18, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Ca_HVA_soma /mnt/c/neuron/neurenv/mech/Ca_HVA_soma.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + if ( ( v == - 27.0 ) ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.055 * ( - 27.0 - v ) ) / ( exp ( ( - 27.0 - v ) / 3.8 ) - 1.0 ) ; + mBeta = ( 0.94 * exp ( ( - 75.0 - v ) / 17.0 ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = 1.0 / ( mAlpha + mBeta ) ; + hAlpha = ( 0.000457 * exp ( ( - 13.0 - v ) / 50.0 ) ) ; + hBeta = ( 0.0065 / ( exp ( ( - v - 15.0 ) / 28.0 ) + 1.0 ) ) ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + hTau = 1.0 / ( hAlpha + hBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + eca = _ion_eca; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gCa = gCa_HVAbar * m * m * h ; + ica = gCa * ( v - eca ) ; + } + _current += ica; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + eca = _ion_eca; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dica; + _dica = ica; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dicadv += (_dica - ica)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ica += ica ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + eca = _ion_eca; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Ca_HVA_soma.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Reuveni, Friedman, Amitai, and Gutnick, J.Neurosci. 1993\n" + "\n" + "NEURON {\n" + " SUFFIX Ca_HVA_soma\n" + " USEION ca READ eca WRITE ica\n" + " RANGE gCa_HVAbar, gCa_HVA, ica \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gCa_HVAbar = 0.000459 (S/cm2) \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " eca (mV)\n" + " ica (mA/cm2)\n" + " gCa (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gCa = gCa_HVAbar*m*m*h\n" + " ica = gCa*(v-eca)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " if((v == -27) ){ \n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.055*(-27-v))/(exp((-27-v)/3.8) - 1) \n" + " mBeta = (0.94*exp((-75-v)/17))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = 1/(mAlpha + mBeta)\n" + " hAlpha = (0.000457*exp((-13-v)/50))\n" + " hBeta = (0.0065/(exp((-v-15)/28)+1))\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " hTau = 1/(hAlpha + hBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Ca_HVA_soma.o b/x86_64/Ca_HVA_soma.o new file mode 100644 index 0000000..ed9f136 Binary files /dev/null and b/x86_64/Ca_HVA_soma.o differ diff --git a/x86_64/Ca_LVAst.c b/x86_64/Ca_LVAst.c new file mode 100644 index 0000000..3e97271 --- /dev/null +++ b/x86_64/Ca_LVAst.c @@ -0,0 +1,578 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Ca_LVAst +#define _nrn_initial _nrn_initial__Ca_LVAst +#define nrn_cur _nrn_cur__Ca_LVAst +#define _nrn_current _nrn_current__Ca_LVAst +#define nrn_jacob _nrn_jacob__Ca_LVAst +#define nrn_state _nrn_state__Ca_LVAst +#define _net_receive _net_receive__Ca_LVAst +#define rates rates__Ca_LVAst +#define states states__Ca_LVAst + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gCa_LVAstbar _p[0] +#define gCa_LVAstbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ica _p[2] +#define ica_columnindex 2 +#define gCa_LVAst _p[3] +#define gCa_LVAst_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define eca _p[6] +#define eca_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define hInf _p[9] +#define hInf_columnindex 9 +#define hTau _p[10] +#define hTau_columnindex 10 +#define Dm _p[11] +#define Dm_columnindex 11 +#define Dh _p[12] +#define Dh_columnindex 12 +#define v _p[13] +#define v_columnindex 13 +#define _g _p[14] +#define _g_columnindex 14 +#define _ion_eca *_ppvar[0]._pval +#define _ion_ica *_ppvar[1]._pval +#define _ion_dicadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Ca_LVAst", _hoc_setdata, + "rates_Ca_LVAst", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gCa_LVAstbar_Ca_LVAst", "S/cm2", + "ica_Ca_LVAst", "mA/cm2", + "gCa_LVAst_Ca_LVAst", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Ca_LVAst", + "gCa_LVAstbar_Ca_LVAst", + "celsius_Ca_LVAst", + 0, + "ica_Ca_LVAst", + "gCa_LVAst_Ca_LVAst", + 0, + "m_Ca_LVAst", + "h_Ca_LVAst", + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 15, _prop); + /*initialize range parameters*/ + gCa_LVAstbar = 7e-06; + celsius = 35; + _prop->param = _p; + _prop->param_size = 15; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* eca */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dicadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Ca_LVAst_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 15, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Ca_LVAst /mnt/c/neuron/neurenv/mech/Ca_LVAst.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + v = v + 10.0 ; + mInf = 1.0000 / ( 1.0 + exp ( ( v - - 30.000 ) / - 6.0 ) ) ; + mTau = ( 5.0000 + 20.0000 / ( 1.0 + exp ( ( v - - 25.000 ) / 5.0 ) ) ) / _lqt ; + hInf = 1.0000 / ( 1.0 + exp ( ( v - - 80.000 ) / 6.4 ) ) ; + hTau = ( 20.0000 + 50.0000 / ( 1.0 + exp ( ( v - - 40.000 ) / 7.0 ) ) ) / _lqt ; + v = v - 10.0 ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + eca = _ion_eca; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gCa_LVAst = gCa_LVAstbar * m * m * h ; + ica = gCa_LVAst * ( v - eca ) ; + } + _current += ica; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + eca = _ion_eca; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dica; + _dica = ica; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dicadv += (_dica - ica)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ica += ica ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + eca = _ion_eca; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Ca_LVAst.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Comment : LVA ca channel. Note: mtau is an approximation from the plots\n" + ":Reference : : Avery and Johnston 1996, tau from Randall 1997\n" + ":Comment: shifted by -10 mv to correct for junction potential\n" + ":Comment: corrected rates using q10 = 2.3, target temperature 35, orginal 21\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX Ca_LVAst\n" + " USEION ca READ eca WRITE ica\n" + " RANGE gCa_LVAstbar, gCa_LVAst, ica, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gCa_LVAstbar = 0.000007 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " eca (mV)\n" + " ica (mA/cm2)\n" + " gCa_LVAst (S/cm2)\n" + " mInf\n" + " mTau\n" + " hInf\n" + " hTau\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gCa_LVAst = gCa_LVAstbar*m*m*h\n" + " ica = gCa_LVAst*(v-eca)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " v = v + 10\n" + " mInf = 1.0000/(1+ exp((v - -30.000)/-6))\n" + " mTau = (5.0000 + 20.0000/(1+exp((v - -25.000)/5)))/qt\n" + " hInf = 1.0000/(1+ exp((v - -80.000)/6.4))\n" + " hTau = (20.0000 + 50.0000/(1+exp((v - -40.000)/7)))/qt\n" + " v = v - 10\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Ca_LVAst.o b/x86_64/Ca_LVAst.o new file mode 100644 index 0000000..e44d59b Binary files /dev/null and b/x86_64/Ca_LVAst.o differ diff --git a/x86_64/Ca_LVAst_soma.c b/x86_64/Ca_LVAst_soma.c new file mode 100644 index 0000000..96fadc8 --- /dev/null +++ b/x86_64/Ca_LVAst_soma.c @@ -0,0 +1,578 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Ca_LVAst_soma +#define _nrn_initial _nrn_initial__Ca_LVAst_soma +#define nrn_cur _nrn_cur__Ca_LVAst_soma +#define _nrn_current _nrn_current__Ca_LVAst_soma +#define nrn_jacob _nrn_jacob__Ca_LVAst_soma +#define nrn_state _nrn_state__Ca_LVAst_soma +#define _net_receive _net_receive__Ca_LVAst_soma +#define rates rates__Ca_LVAst_soma +#define states states__Ca_LVAst_soma + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gCa_LVAstbar _p[0] +#define gCa_LVAstbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ica _p[2] +#define ica_columnindex 2 +#define gCa_LVAst _p[3] +#define gCa_LVAst_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define eca _p[6] +#define eca_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define hInf _p[9] +#define hInf_columnindex 9 +#define hTau _p[10] +#define hTau_columnindex 10 +#define Dm _p[11] +#define Dm_columnindex 11 +#define Dh _p[12] +#define Dh_columnindex 12 +#define v _p[13] +#define v_columnindex 13 +#define _g _p[14] +#define _g_columnindex 14 +#define _ion_eca *_ppvar[0]._pval +#define _ion_ica *_ppvar[1]._pval +#define _ion_dicadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Ca_LVAst_soma", _hoc_setdata, + "rates_Ca_LVAst_soma", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gCa_LVAstbar_Ca_LVAst_soma", "S/cm2", + "ica_Ca_LVAst_soma", "mA/cm2", + "gCa_LVAst_Ca_LVAst_soma", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Ca_LVAst_soma", + "gCa_LVAstbar_Ca_LVAst_soma", + "celsius_Ca_LVAst_soma", + 0, + "ica_Ca_LVAst_soma", + "gCa_LVAst_Ca_LVAst_soma", + 0, + "m_Ca_LVAst_soma", + "h_Ca_LVAst_soma", + 0, + 0}; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 15, _prop); + /*initialize range parameters*/ + gCa_LVAstbar = 0.005592; + celsius = 35; + _prop->param = _p; + _prop->param_size = 15; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* eca */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ica */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dicadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Ca_LVAst_soma_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("ca", -10000.); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 15, 4); + hoc_register_dparam_semantics(_mechtype, 0, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Ca_LVAst_soma /mnt/c/neuron/neurenv/mech/Ca_LVAst_soma.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + v = v + 10.0 ; + mInf = 1.0000 / ( 1.0 + exp ( ( v - - 30.000 ) / - 6.0 ) ) ; + mTau = ( 5.0000 + 20.0000 / ( 1.0 + exp ( ( v - - 25.000 ) / 5.0 ) ) ) / _lqt ; + hInf = 1.0000 / ( 1.0 + exp ( ( v - - 80.000 ) / 6.4 ) ) ; + hTau = ( 20.0000 + 50.0000 / ( 1.0 + exp ( ( v - - 40.000 ) / 7.0 ) ) ) / _lqt ; + v = v - 10.0 ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + eca = _ion_eca; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_ca_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_ca_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_ca_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + eca = _ion_eca; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gCa_LVAst = gCa_LVAstbar * m * m * h ; + ica = gCa_LVAst * ( v - eca ) ; + } + _current += ica; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + eca = _ion_eca; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dica; + _dica = ica; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dicadv += (_dica - ica)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ica += ica ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + eca = _ion_eca; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Ca_LVAst_soma.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Comment : LVA ca channel. Note: mtau is an approximation from the plots\n" + ":Reference : : Avery and Johnston 1996, tau from Randall 1997\n" + ":Comment: shifted by -10 mv to correct for junction potential\n" + ":Comment: corrected rates using q10 = 2.3, target temperature 35, orginal 21\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX Ca_LVAst_soma\n" + " USEION ca READ eca WRITE ica\n" + " RANGE gCa_LVAstbar, gCa_LVAst, ica, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gCa_LVAstbar = 0.005592 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " eca (mV)\n" + " ica (mA/cm2)\n" + " gCa_LVAst (S/cm2)\n" + " mInf\n" + " mTau\n" + " hInf\n" + " hTau\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gCa_LVAst = gCa_LVAstbar*m*m*h\n" + " ica = gCa_LVAst*(v-eca)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " v = v + 10\n" + " mInf = 1.0000/(1+ exp((v - -30.000)/-6))\n" + " mTau = (5.0000 + 20.0000/(1+exp((v - -25.000)/5)))/qt\n" + " hInf = 1.0000/(1+ exp((v - -80.000)/6.4))\n" + " hTau = (20.0000 + 50.0000/(1+exp((v - -40.000)/7)))/qt\n" + " v = v - 10\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Ca_LVAst_soma.o b/x86_64/Ca_LVAst_soma.o new file mode 100644 index 0000000..10f5d47 Binary files /dev/null and b/x86_64/Ca_LVAst_soma.o differ diff --git a/x86_64/Ih.c b/x86_64/Ih.c new file mode 100644 index 0000000..affe007 --- /dev/null +++ b/x86_64/Ih.c @@ -0,0 +1,523 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Ih +#define _nrn_initial _nrn_initial__Ih +#define nrn_cur _nrn_cur__Ih +#define _nrn_current _nrn_current__Ih +#define nrn_jacob _nrn_jacob__Ih +#define nrn_state _nrn_state__Ih +#define _net_receive _net_receive__Ih +#define rates rates__Ih +#define states states__Ih + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gIhbar _p[0] +#define gIhbar_columnindex 0 +#define ihcn _p[1] +#define ihcn_columnindex 1 +#define gIh _p[2] +#define gIh_columnindex 2 +#define m _p[3] +#define m_columnindex 3 +#define mInf _p[4] +#define mInf_columnindex 4 +#define mTau _p[5] +#define mTau_columnindex 5 +#define mAlpha _p[6] +#define mAlpha_columnindex 6 +#define mBeta _p[7] +#define mBeta_columnindex 7 +#define Dm _p[8] +#define Dm_columnindex 8 +#define v _p[9] +#define v_columnindex 9 +#define _g _p[10] +#define _g_columnindex 10 + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Ih", _hoc_setdata, + "rates_Ih", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ +#define ehcn ehcn_Ih + double ehcn = -45; + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "ehcn_Ih", "mV", + "gIhbar_Ih", "S/cm2", + "ihcn_Ih", "mA/cm2", + "gIh_Ih", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + "ehcn_Ih", &ehcn_Ih, + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[0]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Ih", + "gIhbar_Ih", + 0, + "ihcn_Ih", + "gIh_Ih", + 0, + "m_Ih", + 0, + 0}; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 11, _prop); + /*initialize range parameters*/ + gIhbar = 8e-05; + _prop->param = _p; + _prop->param_size = 11; + _ppvar = nrn_prop_datum_alloc(_mechtype, 1, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Ih_reg() { + int _vectorized = 1; + _initlists(); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 11, 1); + hoc_register_dparam_semantics(_mechtype, 0, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Ih /mnt/c/neuron/neurenv/mech/Ih.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + if ( v == - 154.9 ) { + v = v + 0.0001 ; + } + mAlpha = 0.001 * 6.43 * ( v + 154.9 ) / ( exp ( ( v + 154.9 ) / 11.9 ) - 1.0 ) ; + mBeta = 0.001 * 193.0 * exp ( v / 33.1 ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = 1.0 / ( mAlpha + mBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + _ode_matsol_instance1(_threadargs_); + }} + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + initmodel(_p, _ppvar, _thread, _nt); +} +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gIh = gIhbar * m ; + ihcn = gIh * ( v - ehcn ) ; + } + _current += ihcn; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + } + _g = (_g - _rhs)/.001; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + { states(_p, _ppvar, _thread, _nt); + }}} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Ih.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Kole,Hallermann,and Stuart, J. Neurosci. 2006\n" + "\n" + "NEURON {\n" + " SUFFIX Ih\n" + " NONSPECIFIC_CURRENT ihcn\n" + " RANGE gIhbar, gIh, ihcn \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gIhbar = 0.00008 (S/cm2) \n" + " ehcn = -45.0 (mV)\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ihcn (mA/cm2)\n" + " gIh (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gIh = gIhbar*m\n" + " ihcn = gIh*(v-ehcn)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " if(v == -154.9){\n" + " v = v + 0.0001\n" + " }\n" + " mAlpha = 0.001*6.43*(v+154.9)/(exp((v+154.9)/11.9)-1)\n" + " mBeta = 0.001*193*exp(v/33.1)\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = 1/(mAlpha + mBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Ih.o b/x86_64/Ih.o new file mode 100644 index 0000000..faac5f5 Binary files /dev/null and b/x86_64/Ih.o differ diff --git a/x86_64/Im.c b/x86_64/Im.c new file mode 100644 index 0000000..9c63456 --- /dev/null +++ b/x86_64/Im.c @@ -0,0 +1,557 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Im +#define _nrn_initial _nrn_initial__Im +#define nrn_cur _nrn_cur__Im +#define _nrn_current _nrn_current__Im +#define nrn_jacob _nrn_jacob__Im +#define nrn_state _nrn_state__Im +#define _net_receive _net_receive__Im +#define rates rates__Im +#define states states__Im + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gImbar _p[0] +#define gImbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ik _p[2] +#define ik_columnindex 2 +#define gIm _p[3] +#define gIm_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define ek _p[5] +#define ek_columnindex 5 +#define mInf _p[6] +#define mInf_columnindex 6 +#define mTau _p[7] +#define mTau_columnindex 7 +#define mAlpha _p[8] +#define mAlpha_columnindex 8 +#define mBeta _p[9] +#define mBeta_columnindex 9 +#define Dm _p[10] +#define Dm_columnindex 10 +#define v _p[11] +#define v_columnindex 11 +#define _g _p[12] +#define _g_columnindex 12 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Im", _hoc_setdata, + "rates_Im", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gImbar_Im", "S/cm2", + "ik_Im", "mA/cm2", + "gIm_Im", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Im", + "gImbar_Im", + "celsius_Im", + 0, + "ik_Im", + "gIm_Im", + 0, + "m_Im", + 0, + 0}; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 13, _prop); + /*initialize range parameters*/ + gImbar = 0.001; + celsius = 35; + _prop->param = _p; + _prop->param_size = 13; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Im_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 13, 4); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Im /mnt/c/neuron/neurenv/mech/Im.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + mAlpha = 3.3e-3 * exp ( 2.5 * 0.04 * ( v - - 35.0 ) ) ; + mBeta = 3.3e-3 * exp ( - 2.5 * 0.04 * ( v - - 35.0 ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gIm = gImbar * m ; + ik = gIm * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Im.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Adams et al. 1982 - M-currents and other potassium currents in bullfrog sympathetic neurones\n" + ":Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX Im\n" + " USEION k READ ek WRITE ik\n" + " RANGE gImbar, gIm, ik, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gImbar = 0.001000 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ek (mV)\n" + " ik (mA/cm2)\n" + " gIm (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gIm = gImbar*m\n" + " ik = gIm*(v-ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " mAlpha = 3.3e-3*exp(2.5*0.04*(v - -35))\n" + " mBeta = 3.3e-3*exp(-2.5*0.04*(v - -35))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Im.o b/x86_64/Im.o new file mode 100644 index 0000000..3705344 Binary files /dev/null and b/x86_64/Im.o differ diff --git a/x86_64/K_Pst.c b/x86_64/K_Pst.c new file mode 100644 index 0000000..a0d77cd --- /dev/null +++ b/x86_64/K_Pst.c @@ -0,0 +1,588 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__K_Pst +#define _nrn_initial _nrn_initial__K_Pst +#define nrn_cur _nrn_cur__K_Pst +#define _nrn_current _nrn_current__K_Pst +#define nrn_jacob _nrn_jacob__K_Pst +#define nrn_state _nrn_state__K_Pst +#define _net_receive _net_receive__K_Pst +#define rates rates__K_Pst +#define states states__K_Pst + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gK_Pstbar _p[0] +#define gK_Pstbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ik _p[2] +#define ik_columnindex 2 +#define gK_Pst _p[3] +#define gK_Pst_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ek _p[6] +#define ek_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define hInf _p[9] +#define hInf_columnindex 9 +#define hTau _p[10] +#define hTau_columnindex 10 +#define Dm _p[11] +#define Dm_columnindex 11 +#define Dh _p[12] +#define Dh_columnindex 12 +#define v _p[13] +#define v_columnindex 13 +#define _g _p[14] +#define _g_columnindex 14 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_K_Pst", _hoc_setdata, + "rates_K_Pst", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gK_Pstbar_K_Pst", "S/cm2", + "ik_K_Pst", "mA/cm2", + "gK_Pst_K_Pst", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"K_Pst", + "gK_Pstbar_K_Pst", + "celsius_K_Pst", + 0, + "ik_K_Pst", + "gK_Pst_K_Pst", + 0, + "m_K_Pst", + "h_K_Pst", + 0, + 0}; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 15, _prop); + /*initialize range parameters*/ + gK_Pstbar = 0.957198; + celsius = 35; + _prop->param = _p; + _prop->param_size = 15; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _K_Pst_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 15, 4); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 K_Pst /mnt/c/neuron/neurenv/mech/K_Pst.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + v = v + 10.0 ; + mInf = ( 1.0 / ( 1.0 + exp ( - ( v + 1.0 ) / 12.0 ) ) ) ; + if ( v < - 50.0 ) { + mTau = ( 1.25 + 175.03 * exp ( - v * - 0.026 ) ) / _lqt ; + } + else { + mTau = ( ( 1.25 + 13.0 * exp ( - v * 0.026 ) ) ) / _lqt ; + } + hInf = 1.0 / ( 1.0 + exp ( - ( v + 54.0 ) / - 11.0 ) ) ; + hTau = ( 360.0 + ( 1010.0 + 24.0 * ( v + 55.0 ) ) * exp ( - pow( ( ( v + 75.0 ) / 48.0 ) , 2.0 ) ) ) / _lqt ; + v = v - 10.0 ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gK_Pst = gK_Pstbar * m * m * h ; + ik = gK_Pst * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/K_Pst.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Comment : The persistent component of the K current\n" + ":Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000\n" + ":Comment : shifted -10 mv to correct for junction potential\n" + ":Comment: corrected rates using q10 = 2.3, target temperature 35, orginal 21\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra** \n" + "\n" + "NEURON {\n" + " SUFFIX K_Pst\n" + " USEION k READ ek WRITE ik\n" + " RANGE gK_Pstbar, gK_Pst, ik, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gK_Pstbar = 0.957198 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ek (mV)\n" + " ik (mA/cm2)\n" + " gK_Pst (S/cm2)\n" + " mInf\n" + " mTau\n" + " hInf\n" + " hTau\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gK_Pst = gK_Pstbar*m*m*h\n" + " ik = gK_Pst*(v-ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10)\n" + " UNITSOFF\n" + " v = v + 10\n" + " mInf = (1/(1 + exp(-(v+1)/12)))\n" + " if(v<-50){\n" + " mTau = (1.25+175.03*exp(-v * -0.026))/qt\n" + " }else{\n" + " mTau = ((1.25+13*exp(-v*0.026)))/qt\n" + " }\n" + " hInf = 1/(1 + exp(-(v+54)/-11))\n" + " hTau = (360+(1010+24*(v+55))*exp(-((v+75)/48)^2))/qt\n" + " v = v - 10\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/K_Pst.o b/x86_64/K_Pst.o new file mode 100644 index 0000000..fd83996 Binary files /dev/null and b/x86_64/K_Pst.o differ diff --git a/x86_64/K_Tst.c b/x86_64/K_Tst.c new file mode 100644 index 0000000..a12af26 --- /dev/null +++ b/x86_64/K_Tst.c @@ -0,0 +1,578 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__K_Tst +#define _nrn_initial _nrn_initial__K_Tst +#define nrn_cur _nrn_cur__K_Tst +#define _nrn_current _nrn_current__K_Tst +#define nrn_jacob _nrn_jacob__K_Tst +#define nrn_state _nrn_state__K_Tst +#define _net_receive _net_receive__K_Tst +#define rates rates__K_Tst +#define states states__K_Tst + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gK_Tstbar _p[0] +#define gK_Tstbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ik _p[2] +#define ik_columnindex 2 +#define gK_Tst _p[3] +#define gK_Tst_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ek _p[6] +#define ek_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define hInf _p[9] +#define hInf_columnindex 9 +#define hTau _p[10] +#define hTau_columnindex 10 +#define Dm _p[11] +#define Dm_columnindex 11 +#define Dh _p[12] +#define Dh_columnindex 12 +#define v _p[13] +#define v_columnindex 13 +#define _g _p[14] +#define _g_columnindex 14 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_K_Tst", _hoc_setdata, + "rates_K_Tst", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gK_Tstbar_K_Tst", "S/cm2", + "ik_K_Tst", "mA/cm2", + "gK_Tst_K_Tst", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"K_Tst", + "gK_Tstbar_K_Tst", + "celsius_K_Tst", + 0, + "ik_K_Tst", + "gK_Tst_K_Tst", + 0, + "m_K_Tst", + "h_K_Tst", + 0, + 0}; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 15, _prop); + /*initialize range parameters*/ + gK_Tstbar = 0.029456; + celsius = 35; + _prop->param = _p; + _prop->param_size = 15; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _K_Tst_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 15, 4); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 K_Tst /mnt/c/neuron/neurenv/mech/K_Tst.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + v = v + 10.0 ; + mInf = 1.0 / ( 1.0 + exp ( - ( v + 0.0 ) / 19.0 ) ) ; + mTau = ( 0.34 + 0.92 * exp ( - pow( ( ( v + 71.0 ) / 59.0 ) , 2.0 ) ) ) / _lqt ; + hInf = 1.0 / ( 1.0 + exp ( - ( v + 66.0 ) / - 10.0 ) ) ; + hTau = ( 8.0 + 49.0 * exp ( - pow( ( ( v + 73.0 ) / 23.0 ) , 2.0 ) ) ) / _lqt ; + v = v - 10.0 ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gK_Tst = gK_Tstbar * ( pow( m , 4.0 ) ) * h ; + ik = gK_Tst * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/K_Tst.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Comment : The transient component of the K current\n" + ":Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000\n" + ":Comment : shifted -10 mv to correct for junction potential\n" + ":Comment: corrected rates using q10 = 2.3, target temperature 35, orginal 21\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX K_Tst\n" + " USEION k READ ek WRITE ik\n" + " RANGE gK_Tstbar, gK_Tst, ik, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gK_Tstbar = 0.029456 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ek (mV)\n" + " ik (mA/cm2)\n" + " gK_Tst (S/cm2)\n" + " mInf\n" + " mTau\n" + " hInf\n" + " hTau\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gK_Tst = gK_Tstbar*(m^4)*h\n" + " ik = gK_Tst*(v-ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10)\n" + " UNITSOFF\n" + " v = v + 10\n" + " mInf = 1/(1 + exp(-(v+0)/19))\n" + " mTau = (0.34+0.92*exp(-((v+71)/59)^2))/qt\n" + " hInf = 1/(1 + exp(-(v+66)/-10))\n" + " hTau = (8+49*exp(-((v+73)/23)^2))/qt\n" + " v = v - 10\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/K_Tst.o b/x86_64/K_Tst.o new file mode 100644 index 0000000..a1532d6 Binary files /dev/null and b/x86_64/K_Tst.o differ diff --git a/x86_64/NaTa_t.c b/x86_64/NaTa_t.c new file mode 100644 index 0000000..a53751d --- /dev/null +++ b/x86_64/NaTa_t.c @@ -0,0 +1,605 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__NaTa_t +#define _nrn_initial _nrn_initial__NaTa_t +#define nrn_cur _nrn_cur__NaTa_t +#define _nrn_current _nrn_current__NaTa_t +#define nrn_jacob _nrn_jacob__NaTa_t +#define nrn_state _nrn_state__NaTa_t +#define _net_receive _net_receive__NaTa_t +#define rates rates__NaTa_t +#define states states__NaTa_t + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNaTa_tbar _p[0] +#define gNaTa_tbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNaTa_t _p[3] +#define gNaTa_t_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_NaTa_t", _hoc_setdata, + "rates_NaTa_t", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNaTa_tbar_NaTa_t", "S/cm2", + "ina_NaTa_t", "mA/cm2", + "gNaTa_t_NaTa_t", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"NaTa_t", + "gNaTa_tbar_NaTa_t", + "celsius_NaTa_t", + 0, + "ina_NaTa_t", + "gNaTa_t_NaTa_t", + 0, + "m_NaTa_t", + "h_NaTa_t", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNaTa_tbar = 3.28876; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _NaTa_t_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 NaTa_t /mnt/c/neuron/neurenv/mech/NaTa_t.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + if ( v == - 38.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 38.0 ) ) / ( 1.0 - ( exp ( - ( v - - 38.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 38.0 ) ) / ( 1.0 - ( exp ( - ( - v - 38.0 ) / 6.0 ) ) ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + if ( v == - 66.0 ) { + v = v + 0.0001 ; + } + hAlpha = ( - 0.015 * ( v - - 66.0 ) ) / ( 1.0 - ( exp ( ( v - - 66.0 ) / 6.0 ) ) ) ; + hBeta = ( - 0.015 * ( - v - 66.0 ) ) / ( 1.0 - ( exp ( ( - v - 66.0 ) / 6.0 ) ) ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNaTa_t = gNaTa_tbar * m * m * m * h ; + ina = gNaTa_t * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/NaTa_t.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference :Colbert and Pan 2002\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX NaTa_t\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNaTa_tbar, gNaTa_t, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNaTa_tbar = 3.288755 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNaTa_t (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNaTa_t = gNaTa_tbar*m*m*m*h\n" + " ina = gNaTa_t*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " if(v == -38){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6)))\n" + " mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6)))\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + "\n" + " if(v == -66){\n" + " v = v + 0.0001\n" + " }\n" + "\n" + " hAlpha = (-0.015 * (v- -66))/(1-(exp((v- -66)/6)))\n" + " hBeta = (-0.015 * (-v -66))/(1-(exp((-v -66)/6)))\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/NaTa_t.o b/x86_64/NaTa_t.o new file mode 100644 index 0000000..4cc8da3 Binary files /dev/null and b/x86_64/NaTa_t.o differ diff --git a/x86_64/NaTa_t_myel.c b/x86_64/NaTa_t_myel.c new file mode 100644 index 0000000..56d2117 --- /dev/null +++ b/x86_64/NaTa_t_myel.c @@ -0,0 +1,605 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__NaTa_t_myel +#define _nrn_initial _nrn_initial__NaTa_t_myel +#define nrn_cur _nrn_cur__NaTa_t_myel +#define _nrn_current _nrn_current__NaTa_t_myel +#define nrn_jacob _nrn_jacob__NaTa_t_myel +#define nrn_state _nrn_state__NaTa_t_myel +#define _net_receive _net_receive__NaTa_t_myel +#define rates rates__NaTa_t_myel +#define states states__NaTa_t_myel + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNaTa_tbar _p[0] +#define gNaTa_tbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNaTa_t _p[3] +#define gNaTa_t_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_NaTa_t_myel", _hoc_setdata, + "rates_NaTa_t_myel", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNaTa_tbar_NaTa_t_myel", "S/cm2", + "ina_NaTa_t_myel", "mA/cm2", + "gNaTa_t_NaTa_t_myel", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"NaTa_t_myel", + "gNaTa_tbar_NaTa_t_myel", + "celsius_NaTa_t_myel", + 0, + "ina_NaTa_t_myel", + "gNaTa_t_NaTa_t_myel", + 0, + "m_NaTa_t_myel", + "h_NaTa_t_myel", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNaTa_tbar = 6.57751; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _NaTa_t_myel_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 NaTa_t_myel /mnt/c/neuron/neurenv/mech/NaTa_t_myel.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + if ( v == - 38.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 38.0 ) ) / ( 1.0 - ( exp ( - ( v - - 38.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 38.0 ) ) / ( 1.0 - ( exp ( - ( - v - 38.0 ) / 6.0 ) ) ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + if ( v == - 66.0 ) { + v = v + 0.0001 ; + } + hAlpha = ( - 0.015 * ( v - - 66.0 ) ) / ( 1.0 - ( exp ( ( v - - 66.0 ) / 6.0 ) ) ) ; + hBeta = ( - 0.015 * ( - v - 66.0 ) ) / ( 1.0 - ( exp ( ( - v - 66.0 ) / 6.0 ) ) ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNaTa_t = gNaTa_tbar * m * m * m * h ; + ina = gNaTa_t * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/NaTa_t_myel.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference :Colbert and Pan 2002\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX NaTa_t_myel\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNaTa_tbar, gNaTa_t, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNaTa_tbar = 6.577510 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNaTa_t (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNaTa_t = gNaTa_tbar*m*m*m*h\n" + " ina = gNaTa_t*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " if(v == -38){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6)))\n" + " mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6)))\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + "\n" + " if(v == -66){\n" + " v = v + 0.0001\n" + " }\n" + "\n" + " hAlpha = (-0.015 * (v- -66))/(1-(exp((v- -66)/6)))\n" + " hBeta = (-0.015 * (-v -66))/(1-(exp((-v -66)/6)))\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/NaTa_t_myel.o b/x86_64/NaTa_t_myel.o new file mode 100644 index 0000000..c17798b Binary files /dev/null and b/x86_64/NaTa_t_myel.o differ diff --git a/x86_64/NaTa_t_nor.c b/x86_64/NaTa_t_nor.c new file mode 100644 index 0000000..6d468b9 --- /dev/null +++ b/x86_64/NaTa_t_nor.c @@ -0,0 +1,605 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__NaTa_t_nor +#define _nrn_initial _nrn_initial__NaTa_t_nor +#define nrn_cur _nrn_cur__NaTa_t_nor +#define _nrn_current _nrn_current__NaTa_t_nor +#define nrn_jacob _nrn_jacob__NaTa_t_nor +#define nrn_state _nrn_state__NaTa_t_nor +#define _net_receive _net_receive__NaTa_t_nor +#define rates rates__NaTa_t_nor +#define states states__NaTa_t_nor + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNaTa_tbar _p[0] +#define gNaTa_tbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNaTa_t _p[3] +#define gNaTa_t_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_NaTa_t_nor", _hoc_setdata, + "rates_NaTa_t_nor", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNaTa_tbar_NaTa_t_nor", "S/cm2", + "ina_NaTa_t_nor", "mA/cm2", + "gNaTa_t_NaTa_t_nor", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"NaTa_t_nor", + "gNaTa_tbar_NaTa_t_nor", + "celsius_NaTa_t_nor", + 0, + "ina_NaTa_t_nor", + "gNaTa_t_NaTa_t_nor", + 0, + "m_NaTa_t_nor", + "h_NaTa_t_nor", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNaTa_tbar = 6.57751; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _NaTa_t_nor_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 NaTa_t_nor /mnt/c/neuron/neurenv/mech/NaTa_t_nor.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + if ( v == - 38.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 38.0 ) ) / ( 1.0 - ( exp ( - ( v - - 38.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 38.0 ) ) / ( 1.0 - ( exp ( - ( - v - 38.0 ) / 6.0 ) ) ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + if ( v == - 66.0 ) { + v = v + 0.0001 ; + } + hAlpha = ( - 0.015 * ( v - - 66.0 ) ) / ( 1.0 - ( exp ( ( v - - 66.0 ) / 6.0 ) ) ) ; + hBeta = ( - 0.015 * ( - v - 66.0 ) ) / ( 1.0 - ( exp ( ( - v - 66.0 ) / 6.0 ) ) ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNaTa_t = gNaTa_tbar * m * m * m * h ; + ina = gNaTa_t * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/NaTa_t_nor.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference :Colbert and Pan 2002\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX NaTa_t_nor\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNaTa_tbar, gNaTa_t, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNaTa_tbar = 6.577510 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNaTa_t (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNaTa_t = gNaTa_tbar*m*m*m*h\n" + " ina = gNaTa_t*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " if(v == -38){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6)))\n" + " mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6)))\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + "\n" + " if(v == -66){\n" + " v = v + 0.0001\n" + " }\n" + "\n" + " hAlpha = (-0.015 * (v- -66))/(1-(exp((v- -66)/6)))\n" + " hBeta = (-0.015 * (-v -66))/(1-(exp((-v -66)/6)))\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/NaTa_t_nor.o b/x86_64/NaTa_t_nor.o new file mode 100644 index 0000000..a553a21 Binary files /dev/null and b/x86_64/NaTa_t_nor.o differ diff --git a/x86_64/NaTs2_t.c b/x86_64/NaTs2_t.c new file mode 100644 index 0000000..076fd58 --- /dev/null +++ b/x86_64/NaTs2_t.c @@ -0,0 +1,605 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__NaTs2_t +#define _nrn_initial _nrn_initial__NaTs2_t +#define nrn_cur _nrn_cur__NaTs2_t +#define _nrn_current _nrn_current__NaTs2_t +#define nrn_jacob _nrn_jacob__NaTs2_t +#define nrn_state _nrn_state__NaTs2_t +#define _net_receive _net_receive__NaTs2_t +#define rates rates__NaTs2_t +#define states states__NaTs2_t + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNaTs2_tbar _p[0] +#define gNaTs2_tbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNaTs2_t _p[3] +#define gNaTs2_t_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_NaTs2_t", _hoc_setdata, + "rates_NaTs2_t", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNaTs2_tbar_NaTs2_t", "S/cm2", + "ina_NaTs2_t", "mA/cm2", + "gNaTs2_t_NaTs2_t", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"NaTs2_t", + "gNaTs2_tbar_NaTs2_t", + "celsius_NaTs2_t", + 0, + "ina_NaTs2_t", + "gNaTs2_t_NaTs2_t", + 0, + "m_NaTs2_t", + "h_NaTs2_t", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNaTs2_tbar = 1e-05; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _NaTs2_t_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 NaTs2_t /mnt/c/neuron/neurenv/mech/NaTs2_t.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + if ( v == - 32.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 32.0 ) ) / ( 1.0 - ( exp ( - ( v - - 32.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 32.0 ) ) / ( 1.0 - ( exp ( - ( - v - 32.0 ) / 6.0 ) ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + if ( v == - 60.0 ) { + v = v + 0.0001 ; + } + hAlpha = ( - 0.015 * ( v - - 60.0 ) ) / ( 1.0 - ( exp ( ( v - - 60.0 ) / 6.0 ) ) ) ; + hBeta = ( - 0.015 * ( - v - 60.0 ) ) / ( 1.0 - ( exp ( ( - v - 60.0 ) / 6.0 ) ) ) ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNaTs2_t = gNaTs2_tbar * m * m * m * h ; + ina = gNaTs2_t * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/NaTs2_t.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference :Colbert and Pan 2002\n" + ":comment: took the NaTa and shifted both activation/inactivation by 6 mv\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX NaTs2_t\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNaTs2_tbar, gNaTs2_t, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNaTs2_tbar = 0.00001 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNaTs2_t (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNaTs2_t = gNaTs2_tbar*m*m*m*h\n" + " ina = gNaTs2_t*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " if(v == -32){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -32))/(1-(exp(-(v- -32)/6)))\n" + " mBeta = (0.124 * (-v -32))/(1-(exp(-(-v -32)/6)))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + "\n" + " if(v == -60){\n" + " v = v + 0.0001\n" + " }\n" + " hAlpha = (-0.015 * (v- -60))/(1-(exp((v- -60)/6)))\n" + " hBeta = (-0.015 * (-v -60))/(1-(exp((-v -60)/6)))\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/NaTs2_t.o b/x86_64/NaTs2_t.o new file mode 100644 index 0000000..b821108 Binary files /dev/null and b/x86_64/NaTs2_t.o differ diff --git a/x86_64/NaTs2_t_apic.c b/x86_64/NaTs2_t_apic.c new file mode 100644 index 0000000..77daecb --- /dev/null +++ b/x86_64/NaTs2_t_apic.c @@ -0,0 +1,605 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__NaTs2_t_apic +#define _nrn_initial _nrn_initial__NaTs2_t_apic +#define nrn_cur _nrn_cur__NaTs2_t_apic +#define _nrn_current _nrn_current__NaTs2_t_apic +#define nrn_jacob _nrn_jacob__NaTs2_t_apic +#define nrn_state _nrn_state__NaTs2_t_apic +#define _net_receive _net_receive__NaTs2_t_apic +#define rates rates__NaTs2_t_apic +#define states states__NaTs2_t_apic + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNaTs2_tbar _p[0] +#define gNaTs2_tbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNaTs2_t _p[3] +#define gNaTs2_t_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_NaTs2_t_apic", _hoc_setdata, + "rates_NaTs2_t_apic", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNaTs2_tbar_NaTs2_t_apic", "S/cm2", + "ina_NaTs2_t_apic", "mA/cm2", + "gNaTs2_t_NaTs2_t_apic", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"NaTs2_t_apic", + "gNaTs2_tbar_NaTs2_t_apic", + "celsius_NaTs2_t_apic", + 0, + "ina_NaTs2_t_apic", + "gNaTs2_t_NaTs2_t_apic", + 0, + "m_NaTs2_t_apic", + "h_NaTs2_t_apic", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNaTs2_tbar = 0.02569; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _NaTs2_t_apic_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 NaTs2_t_apic /mnt/c/neuron/neurenv/mech/NaTs2_t_apic.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + if ( v == - 32.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 32.0 ) ) / ( 1.0 - ( exp ( - ( v - - 32.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 32.0 ) ) / ( 1.0 - ( exp ( - ( - v - 32.0 ) / 6.0 ) ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + if ( v == - 60.0 ) { + v = v + 0.0001 ; + } + hAlpha = ( - 0.015 * ( v - - 60.0 ) ) / ( 1.0 - ( exp ( ( v - - 60.0 ) / 6.0 ) ) ) ; + hBeta = ( - 0.015 * ( - v - 60.0 ) ) / ( 1.0 - ( exp ( ( - v - 60.0 ) / 6.0 ) ) ) ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNaTs2_t = gNaTs2_tbar * m * m * m * h ; + ina = gNaTs2_t * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/NaTs2_t_apic.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference :Colbert and Pan 2002\n" + ":comment: took the NaTa and shifted both activation/inactivation by 6 mv\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX NaTs2_t_apic\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNaTs2_tbar, gNaTs2_t, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNaTs2_tbar = 0.025690 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNaTs2_t (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNaTs2_t = gNaTs2_tbar*m*m*m*h\n" + " ina = gNaTs2_t*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " if(v == -32){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -32))/(1-(exp(-(v- -32)/6)))\n" + " mBeta = (0.124 * (-v -32))/(1-(exp(-(-v -32)/6)))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + "\n" + " if(v == -60){\n" + " v = v + 0.0001\n" + " }\n" + " hAlpha = (-0.015 * (v- -60))/(1-(exp((v- -60)/6)))\n" + " hBeta = (-0.015 * (-v -60))/(1-(exp((-v -60)/6)))\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/NaTs2_t_apic.o b/x86_64/NaTs2_t_apic.o new file mode 100644 index 0000000..cfcedbd Binary files /dev/null and b/x86_64/NaTs2_t_apic.o differ diff --git a/x86_64/NaTs2_t_soma.c b/x86_64/NaTs2_t_soma.c new file mode 100644 index 0000000..7e49473 --- /dev/null +++ b/x86_64/NaTs2_t_soma.c @@ -0,0 +1,605 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__NaTs2_t_soma +#define _nrn_initial _nrn_initial__NaTs2_t_soma +#define nrn_cur _nrn_cur__NaTs2_t_soma +#define _nrn_current _nrn_current__NaTs2_t_soma +#define nrn_jacob _nrn_jacob__NaTs2_t_soma +#define nrn_state _nrn_state__NaTs2_t_soma +#define _net_receive _net_receive__NaTs2_t_soma +#define rates rates__NaTs2_t_soma +#define states states__NaTs2_t_soma + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNaTs2_tbar _p[0] +#define gNaTs2_tbar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNaTs2_t _p[3] +#define gNaTs2_t_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_NaTs2_t_soma", _hoc_setdata, + "rates_NaTs2_t_soma", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNaTs2_tbar_NaTs2_t_soma", "S/cm2", + "ina_NaTs2_t_soma", "mA/cm2", + "gNaTs2_t_NaTs2_t_soma", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"NaTs2_t_soma", + "gNaTs2_tbar_NaTs2_t_soma", + "celsius_NaTs2_t_soma", + 0, + "ina_NaTs2_t_soma", + "gNaTs2_t_NaTs2_t_soma", + 0, + "m_NaTs2_t_soma", + "h_NaTs2_t_soma", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNaTs2_tbar = 0.976885; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _NaTs2_t_soma_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 NaTs2_t_soma /mnt/c/neuron/neurenv/mech/NaTs2_t_soma.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + if ( v == - 32.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 32.0 ) ) / ( 1.0 - ( exp ( - ( v - - 32.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 32.0 ) ) / ( 1.0 - ( exp ( - ( - v - 32.0 ) / 6.0 ) ) ) ; + mInf = mAlpha / ( mAlpha + mBeta ) ; + mTau = ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + if ( v == - 60.0 ) { + v = v + 0.0001 ; + } + hAlpha = ( - 0.015 * ( v - - 60.0 ) ) / ( 1.0 - ( exp ( ( v - - 60.0 ) / 6.0 ) ) ) ; + hBeta = ( - 0.015 * ( - v - 60.0 ) ) / ( 1.0 - ( exp ( ( - v - 60.0 ) / 6.0 ) ) ) ; + hInf = hAlpha / ( hAlpha + hBeta ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNaTs2_t = gNaTs2_tbar * m * m * m * h ; + ina = gNaTs2_t * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/NaTs2_t_soma.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference :Colbert and Pan 2002\n" + ":comment: took the NaTa and shifted both activation/inactivation by 6 mv\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX NaTs2_t_soma\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNaTs2_tbar, gNaTs2_t, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNaTs2_tbar = 0.976885 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNaTs2_t (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNaTs2_t = gNaTs2_tbar*m*m*m*h\n" + " ina = gNaTs2_t*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10) \n" + " UNITSOFF\n" + " if(v == -32){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -32))/(1-(exp(-(v- -32)/6)))\n" + " mBeta = (0.124 * (-v -32))/(1-(exp(-(-v -32)/6)))\n" + " mInf = mAlpha/(mAlpha + mBeta)\n" + " mTau = (1/(mAlpha + mBeta))/qt\n" + "\n" + " if(v == -60){\n" + " v = v + 0.0001\n" + " }\n" + " hAlpha = (-0.015 * (v- -60))/(1-(exp((v- -60)/6)))\n" + " hBeta = (-0.015 * (-v -60))/(1-(exp((-v -60)/6)))\n" + " hInf = hAlpha/(hAlpha + hBeta)\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/NaTs2_t_soma.o b/x86_64/NaTs2_t_soma.o new file mode 100644 index 0000000..148741e Binary files /dev/null and b/x86_64/NaTs2_t_soma.o differ diff --git a/x86_64/Nap_Et2.c b/x86_64/Nap_Et2.c new file mode 100644 index 0000000..8116bd3 --- /dev/null +++ b/x86_64/Nap_Et2.c @@ -0,0 +1,614 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__Nap_Et2 +#define _nrn_initial _nrn_initial__Nap_Et2 +#define nrn_cur _nrn_cur__Nap_Et2 +#define _nrn_current _nrn_current__Nap_Et2 +#define nrn_jacob _nrn_jacob__Nap_Et2 +#define nrn_state _nrn_state__Nap_Et2 +#define _net_receive _net_receive__Nap_Et2 +#define rates rates__Nap_Et2 +#define states states__Nap_Et2 + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gNap_Et2bar _p[0] +#define gNap_Et2bar_columnindex 0 +#define celsius _p[1] +#define celsius_columnindex 1 +#define ina _p[2] +#define ina_columnindex 2 +#define gNap_Et2 _p[3] +#define gNap_Et2_columnindex 3 +#define m _p[4] +#define m_columnindex 4 +#define h _p[5] +#define h_columnindex 5 +#define ena _p[6] +#define ena_columnindex 6 +#define mInf _p[7] +#define mInf_columnindex 7 +#define mTau _p[8] +#define mTau_columnindex 8 +#define mAlpha _p[9] +#define mAlpha_columnindex 9 +#define mBeta _p[10] +#define mBeta_columnindex 10 +#define hInf _p[11] +#define hInf_columnindex 11 +#define hTau _p[12] +#define hTau_columnindex 12 +#define hAlpha _p[13] +#define hAlpha_columnindex 13 +#define hBeta _p[14] +#define hBeta_columnindex 14 +#define Dm _p[15] +#define Dm_columnindex 15 +#define Dh _p[16] +#define Dh_columnindex 16 +#define v _p[17] +#define v_columnindex 17 +#define _g _p[18] +#define _g_columnindex 18 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_Nap_Et2", _hoc_setdata, + "rates_Nap_Et2", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gNap_Et2bar_Nap_Et2", "S/cm2", + "ina_Nap_Et2", "mA/cm2", + "gNap_Et2_Nap_Et2", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"Nap_Et2", + "gNap_Et2bar_Nap_Et2", + "celsius_Nap_Et2", + 0, + "ina_Nap_Et2", + "gNap_Et2_Nap_Et2", + 0, + "m_Nap_Et2", + "h_Nap_Et2", + 0, + 0}; + static Symbol* _na_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 19, _prop); + /*initialize range parameters*/ + gNap_Et2bar = 0.000671; + celsius = 35; + _prop->param = _p; + _prop->param_size = 19; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _Nap_Et2_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + _na_sym = hoc_lookup("na_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 19, 4); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 Nap_Et2 /mnt/c/neuron/neurenv/mech/Nap_Et2.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[2], _dlist1[2]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + Dh = ( hInf - h ) / hTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / hTau)))*(- ( ( ( hInf ) ) / hTau ) / ( ( ( ( - 1.0 ) ) ) / hTau ) - h) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + double _lqt ; + _lqt = pow( 2.3 , ( ( celsius - 21.0 ) / 10.0 ) ) ; + mInf = 1.0 / ( 1.0 + exp ( ( v - - 52.6 ) / - 4.6 ) ) ; + if ( v == - 38.0 ) { + v = v + 0.0001 ; + } + mAlpha = ( 0.182 * ( v - - 38.0 ) ) / ( 1.0 - ( exp ( - ( v - - 38.0 ) / 6.0 ) ) ) ; + mBeta = ( 0.124 * ( - v - 38.0 ) ) / ( 1.0 - ( exp ( - ( - v - 38.0 ) / 6.0 ) ) ) ; + mTau = 6.0 * ( 1.0 / ( mAlpha + mBeta ) ) / _lqt ; + if ( v == - 17.0 ) { + v = v + 0.0001 ; + } + if ( v == - 64.4 ) { + v = v + 0.0001 ; + } + hInf = 1.0 / ( 1.0 + exp ( ( v - - 48.8 ) / 10.0 ) ) ; + hAlpha = - 2.88e-6 * ( v + 17.0 ) / ( 1.0 - exp ( ( v + 17.0 ) / 4.63 ) ) ; + hBeta = 6.94e-6 * ( v + 64.4 ) / ( 1.0 - exp ( - ( v + 64.4 ) / 2.63 ) ) ; + hTau = ( 1.0 / ( hAlpha + hBeta ) ) / _lqt ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 2;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 2; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + h = hInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gNap_Et2 = gNap_Et2bar * m * m * m * h ; + ina = gNap_Et2 * ( v - ena ) ; + } + _current += ina; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dina; + _dina = ina; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/Nap_Et2.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Comment : mtau deduced from text (said to be 6 times faster than for NaTa)\n" + ":Comment : so I used the equations from NaT and multiplied by 6\n" + ":Reference : Modeled according to kinetics derived from Magistretti & Alonso 1999\n" + ":Comment: corrected rates using q10 = 2.3, target temperature 35, orginal 21\n" + ": **Modified to use 'celsius' for temperature to correct rates by Aman Aberra**\n" + "NEURON {\n" + " SUFFIX Nap_Et2\n" + " USEION na READ ena WRITE ina\n" + " RANGE gNap_Et2bar, gNap_Et2, ina, celsius\n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gNap_Et2bar = 0.000671 (S/cm2)\n" + " celsius = 35\n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ina (mA/cm2)\n" + " gNap_Et2 (S/cm2)\n" + " mInf\n" + " mTau\n" + " mAlpha\n" + " mBeta\n" + " hInf\n" + " hTau\n" + " hAlpha\n" + " hBeta\n" + "}\n" + "\n" + "STATE {\n" + " m\n" + " h\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gNap_Et2 = gNap_Et2bar*m*m*m*h\n" + " ina = gNap_Et2*(v-ena)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + " h' = (hInf-h)/hTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + " h = hInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " LOCAL qt\n" + " qt = 2.3^((celsius-21)/10)\n" + " UNITSOFF\n" + " mInf = 1.0/(1+exp((v- -52.6)/-4.6))\n" + " if(v == -38){\n" + " v = v+0.0001\n" + " }\n" + " mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6)))\n" + " mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6)))\n" + " mTau = 6*(1/(mAlpha + mBeta))/qt\n" + "\n" + " if(v == -17){\n" + " v = v + 0.0001\n" + " }\n" + " if(v == -64.4){\n" + " v = v+0.0001\n" + " }\n" + "\n" + " hInf = 1.0/(1+exp((v- -48.8)/10))\n" + " hAlpha = -2.88e-6 * (v + 17) / (1 - exp((v + 17)/4.63))\n" + " hBeta = 6.94e-6 * (v + 64.4) / (1 - exp(-(v + 64.4)/2.63))\n" + " hTau = (1/(hAlpha + hBeta))/qt\n" + " UNITSON\n" + "}\n" + ; +#endif diff --git a/x86_64/Nap_Et2.o b/x86_64/Nap_Et2.o new file mode 100644 index 0000000..937d5c7 Binary files /dev/null and b/x86_64/Nap_Et2.o differ diff --git a/x86_64/SK_E2.c b/x86_64/SK_E2.c new file mode 100644 index 0000000..00b9ed5 --- /dev/null +++ b/x86_64/SK_E2.c @@ -0,0 +1,559 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__SK_E2 +#define _nrn_initial _nrn_initial__SK_E2 +#define nrn_cur _nrn_cur__SK_E2 +#define _nrn_current _nrn_current__SK_E2 +#define nrn_jacob _nrn_jacob__SK_E2 +#define nrn_state _nrn_state__SK_E2 +#define _net_receive _net_receive__SK_E2 +#define rates rates__SK_E2 +#define states states__SK_E2 + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gSK_E2bar _p[0] +#define gSK_E2bar_columnindex 0 +#define ik _p[1] +#define ik_columnindex 1 +#define gSK_E2 _p[2] +#define gSK_E2_columnindex 2 +#define z _p[3] +#define z_columnindex 3 +#define ek _p[4] +#define ek_columnindex 4 +#define cai _p[5] +#define cai_columnindex 5 +#define zInf _p[6] +#define zInf_columnindex 6 +#define Dz _p[7] +#define Dz_columnindex 7 +#define v _p[8] +#define v_columnindex 8 +#define _g _p[9] +#define _g_columnindex 9 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval +#define _ion_cai *_ppvar[3]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_SK_E2", _hoc_setdata, + "rates_SK_E2", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ +#define zTau zTau_SK_E2 + double zTau = 1; + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "zTau_SK_E2", "ms", + "gSK_E2bar_SK_E2", "mho/cm2", + "ik_SK_E2", "mA/cm2", + "gSK_E2_SK_E2", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double z0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + "zTau_SK_E2", &zTau_SK_E2, + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[4]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"SK_E2", + "gSK_E2bar_SK_E2", + 0, + "ik_SK_E2", + "gSK_E2_SK_E2", + 0, + "z_SK_E2", + 0, + 0}; + static Symbol* _k_sym; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 10, _prop); + /*initialize range parameters*/ + gSK_E2bar = 0.098377; + _prop->param = _p; + _prop->param_size = 10; + _ppvar = nrn_prop_datum_alloc(_mechtype, 5, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 1, 0); + _ppvar[3]._pval = &prop_ion->param[1]; /* cai */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _SK_E2_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + ion_reg("ca", -10000.); + _k_sym = hoc_lookup("k_ion"); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 10, 5); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 4, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 SK_E2 /mnt/c/neuron/neurenv/mech/SK_E2.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsprotocomma_ double); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargscomma_ cai ) ; + Dz = ( zInf - z ) / zTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargscomma_ cai ) ; + Dz = Dz / (1. - dt*( ( ( ( - 1.0 ) ) ) / zTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargscomma_ cai ) ; + z = z + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / zTau)))*(- ( ( ( zInf ) ) / zTau ) / ( ( ( ( - 1.0 ) ) ) / zTau ) - z) ; + } + return 0; +} + +static int rates ( _threadargsprotocomma_ double _lca ) { + if ( _lca < 1e-7 ) { + _lca = _lca + 1e-07 ; + } + zInf = 1.0 / ( 1.0 + pow( ( 0.00043 / _lca ) , 4.8 ) ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt, *getarg(1) ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + cai = _ion_cai; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + cai = _ion_cai; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + nrn_update_ion_pointer(_ca_sym, _ppvar, 3, 1); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + z = z0; + { + rates ( _threadargscomma_ cai ) ; + z = zInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + cai = _ion_cai; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gSK_E2 = gSK_E2bar * z ; + ik = gSK_E2 * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + cai = _ion_cai; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + cai = _ion_cai; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = z_columnindex; _dlist1[0] = Dz_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/SK_E2.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ": SK-type calcium-activated potassium current\n" + ": Reference : Kohler et al. 1996\n" + "\n" + "NEURON {\n" + " SUFFIX SK_E2\n" + " USEION k READ ek WRITE ik\n" + " USEION ca READ cai\n" + " RANGE gSK_E2bar, gSK_E2, ik\n" + "}\n" + "\n" + "UNITS {\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + " (mM) = (milli/liter)\n" + "}\n" + "\n" + "PARAMETER {\n" + " v (mV)\n" + " gSK_E2bar = 0.098377 (mho/cm2)\n" + " zTau = 1 (ms)\n" + " ek (mV)\n" + " cai (mM)\n" + "}\n" + "\n" + "ASSIGNED {\n" + " zInf\n" + " ik (mA/cm2)\n" + " gSK_E2 (S/cm2)\n" + "}\n" + "\n" + "STATE {\n" + " z FROM 0 TO 1\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gSK_E2 = gSK_E2bar * z\n" + " ik = gSK_E2 * (v - ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates(cai)\n" + " z' = (zInf - z) / zTau\n" + "}\n" + "\n" + "PROCEDURE rates(ca(mM)) {\n" + " if(ca < 1e-7){\n" + " ca = ca + 1e-07\n" + " }\n" + " zInf = 1/(1 + (0.00043 / ca)^4.8)\n" + "}\n" + "\n" + "INITIAL {\n" + " rates(cai)\n" + " z = zInf\n" + "}\n" + ; +#endif diff --git a/x86_64/SK_E2.o b/x86_64/SK_E2.o new file mode 100644 index 0000000..5853c4e Binary files /dev/null and b/x86_64/SK_E2.o differ diff --git a/x86_64/SK_E2_soma.c b/x86_64/SK_E2_soma.c new file mode 100644 index 0000000..b4abbbf --- /dev/null +++ b/x86_64/SK_E2_soma.c @@ -0,0 +1,559 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__SK_E2_soma +#define _nrn_initial _nrn_initial__SK_E2_soma +#define nrn_cur _nrn_cur__SK_E2_soma +#define _nrn_current _nrn_current__SK_E2_soma +#define nrn_jacob _nrn_jacob__SK_E2_soma +#define nrn_state _nrn_state__SK_E2_soma +#define _net_receive _net_receive__SK_E2_soma +#define rates rates__SK_E2_soma +#define states states__SK_E2_soma + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gSK_E2bar _p[0] +#define gSK_E2bar_columnindex 0 +#define ik _p[1] +#define ik_columnindex 1 +#define gSK_E2 _p[2] +#define gSK_E2_columnindex 2 +#define z _p[3] +#define z_columnindex 3 +#define ek _p[4] +#define ek_columnindex 4 +#define cai _p[5] +#define cai_columnindex 5 +#define zInf _p[6] +#define zInf_columnindex 6 +#define Dz _p[7] +#define Dz_columnindex 7 +#define v _p[8] +#define v_columnindex 8 +#define _g _p[9] +#define _g_columnindex 9 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval +#define _ion_cai *_ppvar[3]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_SK_E2_soma", _hoc_setdata, + "rates_SK_E2_soma", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ +#define zTau zTau_SK_E2_soma + double zTau = 1; + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "zTau_SK_E2_soma", "ms", + "gSK_E2bar_SK_E2_soma", "mho/cm2", + "ik_SK_E2_soma", "mA/cm2", + "gSK_E2_SK_E2_soma", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double z0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + "zTau_SK_E2_soma", &zTau_SK_E2_soma, + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[4]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"SK_E2_soma", + "gSK_E2bar_SK_E2_soma", + 0, + "ik_SK_E2_soma", + "gSK_E2_SK_E2_soma", + 0, + "z_SK_E2_soma", + 0, + 0}; + static Symbol* _k_sym; + static Symbol* _ca_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 10, _prop); + /*initialize range parameters*/ + gSK_E2bar = 0.003869; + _prop->param = _p; + _prop->param_size = 10; + _ppvar = nrn_prop_datum_alloc(_mechtype, 5, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + prop_ion = need_memb(_ca_sym); + nrn_promote(prop_ion, 1, 0); + _ppvar[3]._pval = &prop_ion->param[1]; /* cai */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _SK_E2_soma_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + ion_reg("ca", -10000.); + _k_sym = hoc_lookup("k_ion"); + _ca_sym = hoc_lookup("ca_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 10, 5); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "ca_ion"); + hoc_register_dparam_semantics(_mechtype, 4, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 SK_E2_soma /mnt/c/neuron/neurenv/mech/SK_E2_soma.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsprotocomma_ double); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargscomma_ cai ) ; + Dz = ( zInf - z ) / zTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargscomma_ cai ) ; + Dz = Dz / (1. - dt*( ( ( ( - 1.0 ) ) ) / zTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargscomma_ cai ) ; + z = z + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / zTau)))*(- ( ( ( zInf ) ) / zTau ) / ( ( ( ( - 1.0 ) ) ) / zTau ) - z) ; + } + return 0; +} + +static int rates ( _threadargsprotocomma_ double _lca ) { + if ( _lca < 1e-7 ) { + _lca = _lca + 1e-07 ; + } + zInf = 1.0 / ( 1.0 + pow( ( 0.00043 / _lca ) , 4.8 ) ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt, *getarg(1) ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + cai = _ion_cai; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + cai = _ion_cai; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + nrn_update_ion_pointer(_ca_sym, _ppvar, 3, 1); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + z = z0; + { + rates ( _threadargscomma_ cai ) ; + z = zInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + cai = _ion_cai; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gSK_E2 = gSK_E2bar * z ; + ik = gSK_E2 * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + cai = _ion_cai; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + cai = _ion_cai; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = z_columnindex; _dlist1[0] = Dz_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/SK_E2_soma.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ": SK-type calcium-activated potassium current\n" + ": Reference : Kohler et al. 1996\n" + "\n" + "NEURON {\n" + " SUFFIX SK_E2_soma\n" + " USEION k READ ek WRITE ik\n" + " USEION ca READ cai\n" + " RANGE gSK_E2bar, gSK_E2, ik\n" + "}\n" + "\n" + "UNITS {\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + " (mM) = (milli/liter)\n" + "}\n" + "\n" + "PARAMETER {\n" + " v (mV)\n" + " gSK_E2bar = 0.003869 (mho/cm2)\n" + " zTau = 1 (ms)\n" + " ek (mV)\n" + " cai (mM)\n" + "}\n" + "\n" + "ASSIGNED {\n" + " zInf\n" + " ik (mA/cm2)\n" + " gSK_E2 (S/cm2)\n" + "}\n" + "\n" + "STATE {\n" + " z FROM 0 TO 1\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gSK_E2 = gSK_E2bar * z\n" + " ik = gSK_E2 * (v - ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates(cai)\n" + " z' = (zInf - z) / zTau\n" + "}\n" + "\n" + "PROCEDURE rates(ca(mM)) {\n" + " if(ca < 1e-7){\n" + " ca = ca + 1e-07\n" + " }\n" + " zInf = 1/(1 + (0.00043 / ca)^4.8)\n" + "}\n" + "\n" + "INITIAL {\n" + " rates(cai)\n" + " z = zInf\n" + "}\n" + ; +#endif diff --git a/x86_64/SK_E2_soma.o b/x86_64/SK_E2_soma.o new file mode 100644 index 0000000..7507e87 Binary files /dev/null and b/x86_64/SK_E2_soma.o differ diff --git a/x86_64/SKv3_1.c b/x86_64/SKv3_1.c new file mode 100644 index 0000000..709522f --- /dev/null +++ b/x86_64/SKv3_1.c @@ -0,0 +1,537 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__SKv3_1 +#define _nrn_initial _nrn_initial__SKv3_1 +#define nrn_cur _nrn_cur__SKv3_1 +#define _nrn_current _nrn_current__SKv3_1 +#define nrn_jacob _nrn_jacob__SKv3_1 +#define nrn_state _nrn_state__SKv3_1 +#define _net_receive _net_receive__SKv3_1 +#define rates rates__SKv3_1 +#define states states__SKv3_1 + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gSKv3_1bar _p[0] +#define gSKv3_1bar_columnindex 0 +#define ik _p[1] +#define ik_columnindex 1 +#define gSKv3_1 _p[2] +#define gSKv3_1_columnindex 2 +#define m _p[3] +#define m_columnindex 3 +#define ek _p[4] +#define ek_columnindex 4 +#define mInf _p[5] +#define mInf_columnindex 5 +#define mTau _p[6] +#define mTau_columnindex 6 +#define Dm _p[7] +#define Dm_columnindex 7 +#define v _p[8] +#define v_columnindex 8 +#define _g _p[9] +#define _g_columnindex 9 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_SKv3_1", _hoc_setdata, + "rates_SKv3_1", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gSKv3_1bar_SKv3_1", "S/cm2", + "ik_SKv3_1", "mA/cm2", + "gSKv3_1_SKv3_1", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"SKv3_1", + "gSKv3_1bar_SKv3_1", + 0, + "ik_SKv3_1", + "gSKv3_1_SKv3_1", + 0, + "m_SKv3_1", + 0, + 0}; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 10, _prop); + /*initialize range parameters*/ + gSKv3_1bar = 1.93618; + _prop->param = _p; + _prop->param_size = 10; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _SKv3_1_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 10, 4); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 SKv3_1 /mnt/c/neuron/neurenv/mech/SKv3_1.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + mInf = 1.0 / ( 1.0 + exp ( ( ( v - ( 18.700 ) ) / ( - 9.700 ) ) ) ) ; + mTau = 0.2 * 20.000 / ( 1.0 + exp ( ( ( v - ( - 46.560 ) ) / ( - 44.140 ) ) ) ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gSKv3_1 = gSKv3_1bar * m ; + ik = gSKv3_1 * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/SKv3_1.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Characterization of a Shaw-related potassium channel family in rat brain, The EMBO Journal, vol.11, no.7,2473-2486 (1992)\n" + "\n" + "NEURON {\n" + " SUFFIX SKv3_1\n" + " USEION k READ ek WRITE ik\n" + " RANGE gSKv3_1bar, gSKv3_1, ik \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gSKv3_1bar = 1.936176 (S/cm2) \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ek (mV)\n" + " ik (mA/cm2)\n" + " gSKv3_1 (S/cm2)\n" + " mInf\n" + " mTau\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gSKv3_1 = gSKv3_1bar*m\n" + " ik = gSKv3_1*(v-ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " mInf = 1/(1+exp(((v -(18.700))/(-9.700))))\n" + " mTau = 0.2*20.000/(1+exp(((v -(-46.560))/(-44.140))))\n" + " UNITSON\n" + "}\n" + "\n" + ; +#endif diff --git a/x86_64/SKv3_1.o b/x86_64/SKv3_1.o new file mode 100644 index 0000000..e2a4c2c Binary files /dev/null and b/x86_64/SKv3_1.o differ diff --git a/x86_64/SKv3_1_apic.c b/x86_64/SKv3_1_apic.c new file mode 100644 index 0000000..b1369a5 --- /dev/null +++ b/x86_64/SKv3_1_apic.c @@ -0,0 +1,537 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__SKv3_1_apic +#define _nrn_initial _nrn_initial__SKv3_1_apic +#define nrn_cur _nrn_cur__SKv3_1_apic +#define _nrn_current _nrn_current__SKv3_1_apic +#define nrn_jacob _nrn_jacob__SKv3_1_apic +#define nrn_state _nrn_state__SKv3_1_apic +#define _net_receive _net_receive__SKv3_1_apic +#define rates rates__SKv3_1_apic +#define states states__SKv3_1_apic + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gSKv3_1bar _p[0] +#define gSKv3_1bar_columnindex 0 +#define ik _p[1] +#define ik_columnindex 1 +#define gSKv3_1 _p[2] +#define gSKv3_1_columnindex 2 +#define m _p[3] +#define m_columnindex 3 +#define ek _p[4] +#define ek_columnindex 4 +#define mInf _p[5] +#define mInf_columnindex 5 +#define mTau _p[6] +#define mTau_columnindex 6 +#define Dm _p[7] +#define Dm_columnindex 7 +#define v _p[8] +#define v_columnindex 8 +#define _g _p[9] +#define _g_columnindex 9 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_SKv3_1_apic", _hoc_setdata, + "rates_SKv3_1_apic", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gSKv3_1bar_SKv3_1_apic", "S/cm2", + "ik_SKv3_1_apic", "mA/cm2", + "gSKv3_1_SKv3_1_apic", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"SKv3_1_apic", + "gSKv3_1bar_SKv3_1_apic", + 0, + "ik_SKv3_1_apic", + "gSKv3_1_SKv3_1_apic", + 0, + "m_SKv3_1_apic", + 0, + 0}; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 10, _prop); + /*initialize range parameters*/ + gSKv3_1bar = 0.039763; + _prop->param = _p; + _prop->param_size = 10; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _SKv3_1_apic_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 10, 4); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 SKv3_1_apic /mnt/c/neuron/neurenv/mech/SKv3_1_apic.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + mInf = 1.0 / ( 1.0 + exp ( ( ( v - ( 18.700 ) ) / ( - 9.700 ) ) ) ) ; + mTau = 0.2 * 20.000 / ( 1.0 + exp ( ( ( v - ( - 46.560 ) ) / ( - 44.140 ) ) ) ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gSKv3_1 = gSKv3_1bar * m ; + ik = gSKv3_1 * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/SKv3_1_apic.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Characterization of a Shaw-related potassium channel family in rat brain, The EMBO Journal, vol.11, no.7,2473-2486 (1992)\n" + "\n" + "NEURON {\n" + " SUFFIX SKv3_1_apic\n" + " USEION k READ ek WRITE ik\n" + " RANGE gSKv3_1bar, gSKv3_1, ik \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gSKv3_1bar = 0.039763 (S/cm2) \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ek (mV)\n" + " ik (mA/cm2)\n" + " gSKv3_1 (S/cm2)\n" + " mInf\n" + " mTau\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gSKv3_1 = gSKv3_1bar*m\n" + " ik = gSKv3_1*(v-ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " mInf = 1/(1+exp(((v -(18.700))/(-9.700))))\n" + " mTau = 0.2*20.000/(1+exp(((v -(-46.560))/(-44.140))))\n" + " UNITSON\n" + "}\n" + "\n" + ; +#endif diff --git a/x86_64/SKv3_1_apic.o b/x86_64/SKv3_1_apic.o new file mode 100644 index 0000000..5e6dff6 Binary files /dev/null and b/x86_64/SKv3_1_apic.o differ diff --git a/x86_64/SKv3_1_soma.c b/x86_64/SKv3_1_soma.c new file mode 100644 index 0000000..862df7d --- /dev/null +++ b/x86_64/SKv3_1_soma.c @@ -0,0 +1,537 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__SKv3_1_soma +#define _nrn_initial _nrn_initial__SKv3_1_soma +#define nrn_cur _nrn_cur__SKv3_1_soma +#define _nrn_current _nrn_current__SKv3_1_soma +#define nrn_jacob _nrn_jacob__SKv3_1_soma +#define nrn_state _nrn_state__SKv3_1_soma +#define _net_receive _net_receive__SKv3_1_soma +#define rates rates__SKv3_1_soma +#define states states__SKv3_1_soma + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gSKv3_1bar _p[0] +#define gSKv3_1bar_columnindex 0 +#define ik _p[1] +#define ik_columnindex 1 +#define gSKv3_1 _p[2] +#define gSKv3_1_columnindex 2 +#define m _p[3] +#define m_columnindex 3 +#define ek _p[4] +#define ek_columnindex 4 +#define mInf _p[5] +#define mInf_columnindex 5 +#define mTau _p[6] +#define mTau_columnindex 6 +#define Dm _p[7] +#define Dm_columnindex 7 +#define v _p[8] +#define v_columnindex 8 +#define _g _p[9] +#define _g_columnindex 9 +#define _ion_ek *_ppvar[0]._pval +#define _ion_ik *_ppvar[1]._pval +#define _ion_dikdv *_ppvar[2]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + /* declaration of user functions */ + static void _hoc_rates(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_SKv3_1_soma", _hoc_setdata, + "rates_SKv3_1_soma", _hoc_rates, + 0, 0 +}; + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gSKv3_1bar_SKv3_1_soma", "S/cm2", + "ik_SKv3_1_soma", "mA/cm2", + "gSKv3_1_SKv3_1_soma", "S/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double m0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[3]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"SKv3_1_soma", + "gSKv3_1bar_SKv3_1_soma", + 0, + "ik_SKv3_1_soma", + "gSKv3_1_SKv3_1_soma", + 0, + "m_SKv3_1_soma", + 0, + 0}; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 10, _prop); + /*initialize range parameters*/ + gSKv3_1bar = 0.072929; + _prop->param = _p; + _prop->param_size = 10; + _ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _SKv3_1_soma_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("k", -10000.); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 10, 4); + hoc_register_dparam_semantics(_mechtype, 0, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 SKv3_1_soma /mnt/c/neuron/neurenv/mech/SKv3_1_soma.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsproto_); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[1], _dlist1[1]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargs_ ) ; + Dm = ( mInf - m ) / mTau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargs_ ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargs_ ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ; + } + return 0; +} + +static int rates ( _threadargsproto_ ) { + mInf = 1.0 / ( 1.0 + exp ( ( ( v - ( 18.700 ) ) / ( - 9.700 ) ) ) ) ; + mTau = 0.2 * 20.000 / ( 1.0 + exp ( ( ( v - ( - 46.560 ) ) / ( - 44.140 ) ) ) ) ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 1;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 1; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_k_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 2, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + m = m0; + { + rates ( _threadargs_ ) ; + m = mInf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gSKv3_1 = gSKv3_1bar * m ; + ik = gSKv3_1 * ( v - ek ) ; + } + _current += ik; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/SKv3_1_soma.mod"; +static const char* nmodl_file_text = + ":Comment : L6\n" + ":Reference : : Characterization of a Shaw-related potassium channel family in rat brain, The EMBO Journal, vol.11, no.7,2473-2486 (1992)\n" + "\n" + "NEURON {\n" + " SUFFIX SKv3_1_soma\n" + " USEION k READ ek WRITE ik\n" + " RANGE gSKv3_1bar, gSKv3_1, ik \n" + "}\n" + "\n" + "UNITS {\n" + " (S) = (siemens)\n" + " (mV) = (millivolt)\n" + " (mA) = (milliamp)\n" + "}\n" + "\n" + "PARAMETER {\n" + " gSKv3_1bar = 0.072929 (S/cm2) \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (mV)\n" + " ek (mV)\n" + " ik (mA/cm2)\n" + " gSKv3_1 (S/cm2)\n" + " mInf\n" + " mTau\n" + "}\n" + "\n" + "STATE { \n" + " m\n" + "}\n" + "\n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gSKv3_1 = gSKv3_1bar*m\n" + " ik = gSKv3_1*(v-ek)\n" + "}\n" + "\n" + "DERIVATIVE states {\n" + " rates()\n" + " m' = (mInf-m)/mTau\n" + "}\n" + "\n" + "INITIAL{\n" + " rates()\n" + " m = mInf\n" + "}\n" + "\n" + "PROCEDURE rates(){\n" + " UNITSOFF\n" + " mInf = 1/(1+exp(((v -(18.700))/(-9.700))))\n" + " mTau = 0.2*20.000/(1+exp(((v -(-46.560))/(-44.140))))\n" + " UNITSON\n" + "}\n" + "\n" + ; +#endif diff --git a/x86_64/SKv3_1_soma.o b/x86_64/SKv3_1_soma.o new file mode 100644 index 0000000..5c071ef Binary files /dev/null and b/x86_64/SKv3_1_soma.o differ diff --git a/x86_64/hhqt.c b/x86_64/hhqt.c new file mode 100644 index 0000000..3cec96e --- /dev/null +++ b/x86_64/hhqt.c @@ -0,0 +1,733 @@ +/* Created by Language version: 7.7.0 */ +/* VECTORIZED */ +#define NRN_VECTORIZED 1 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__hhqt +#define _nrn_initial _nrn_initial__hhqt +#define nrn_cur _nrn_cur__hhqt +#define _nrn_current _nrn_current__hhqt +#define nrn_jacob _nrn_jacob__hhqt +#define nrn_state _nrn_state__hhqt +#define _net_receive _net_receive__hhqt +#define rates rates__hhqt +#define states states__hhqt + +#define _threadargscomma_ _p, _ppvar, _thread, _nt, +#define _threadargsprotocomma_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, +#define _threadargs_ _p, _ppvar, _thread, _nt +#define _threadargsproto_ double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + /* Thread safe. No static _p or _ppvar. */ + +#define t _nt->_t +#define dt _nt->_dt +#define gnabar _p[0] +#define gnabar_columnindex 0 +#define gkbar _p[1] +#define gkbar_columnindex 1 +#define gl _p[2] +#define gl_columnindex 2 +#define el _p[3] +#define el_columnindex 3 +#define celsius _p[4] +#define celsius_columnindex 4 +#define gna _p[5] +#define gna_columnindex 5 +#define gk _p[6] +#define gk_columnindex 6 +#define il _p[7] +#define il_columnindex 7 +#define m _p[8] +#define m_columnindex 8 +#define h _p[9] +#define h_columnindex 9 +#define n _p[10] +#define n_columnindex 10 +#define ena _p[11] +#define ena_columnindex 11 +#define ek _p[12] +#define ek_columnindex 12 +#define ina _p[13] +#define ina_columnindex 13 +#define ik _p[14] +#define ik_columnindex 14 +#define minf _p[15] +#define minf_columnindex 15 +#define hinf _p[16] +#define hinf_columnindex 16 +#define ninf _p[17] +#define ninf_columnindex 17 +#define mtau _p[18] +#define mtau_columnindex 18 +#define htau _p[19] +#define htau_columnindex 19 +#define ntau _p[20] +#define ntau_columnindex 20 +#define Dm _p[21] +#define Dm_columnindex 21 +#define Dh _p[22] +#define Dh_columnindex 22 +#define Dn _p[23] +#define Dn_columnindex 23 +#define v _p[24] +#define v_columnindex 24 +#define _g _p[25] +#define _g_columnindex 25 +#define _ion_ena *_ppvar[0]._pval +#define _ion_ina *_ppvar[1]._pval +#define _ion_dinadv *_ppvar[2]._pval +#define _ion_ek *_ppvar[3]._pval +#define _ion_ik *_ppvar[4]._pval +#define _ion_dikdv *_ppvar[5]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = -1; + static Datum* _extcall_thread; + static Prop* _extcall_prop; + /* external NEURON variables */ + extern double celsius; + /* declaration of user functions */ + static void _hoc_rates(void); + static void _hoc_vtrap(void); + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _extcall_prop = _prop; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_hhqt", _hoc_setdata, + "rates_hhqt", _hoc_rates, + "vtrap_hhqt", _hoc_vtrap, + 0, 0 +}; +#define vtrap vtrap_hhqt + extern double vtrap( _threadargsprotocomma_ double , double ); + /* declare global and static user variables */ + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + "gl_hhqt", 0, 1e+09, + "gkbar_hhqt", 0, 1e+09, + "gnabar_hhqt", 0, 1e+09, + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "gnabar_hhqt", "S/cm2", + "gkbar_hhqt", "S/cm2", + "gl_hhqt", "S/cm2", + "el_hhqt", "mV", + "celsius_hhqt", "degC", + "gna_hhqt", "S/cm2", + "gk_hhqt", "S/cm2", + "il_hhqt", "mA/cm2", + 0,0 +}; + static double delta_t = 0.01; + static double h0 = 0; + static double m0 = 0; + static double n0 = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + static void nrn_cur(NrnThread*, _Memb_list*, int); +static void nrn_jacob(NrnThread*, _Memb_list*, int); + +static int _ode_count(int); +static void _ode_map(int, double**, double**, double*, Datum*, double*, int); +static void _ode_spec(NrnThread*, _Memb_list*, int); +static void _ode_matsol(NrnThread*, _Memb_list*, int); + +#define _cvode_ieq _ppvar[6]._i + static void _ode_matsol_instance1(_threadargsproto_); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"hhqt", + "gnabar_hhqt", + "gkbar_hhqt", + "gl_hhqt", + "el_hhqt", + "celsius_hhqt", + 0, + "gna_hhqt", + "gk_hhqt", + "il_hhqt", + 0, + "m_hhqt", + "h_hhqt", + "n_hhqt", + 0, + 0}; + static Symbol* _na_sym; + static Symbol* _k_sym; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 26, _prop); + /*initialize range parameters*/ + gnabar = 0.12; + gkbar = 0.036; + gl = 0.0003; + el = -54.3; + celsius = 29; + _prop->param = _p; + _prop->param_size = 26; + _ppvar = nrn_prop_datum_alloc(_mechtype, 7, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + prop_ion = need_memb(_na_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[0]._pval = &prop_ion->param[0]; /* ena */ + _ppvar[1]._pval = &prop_ion->param[3]; /* ina */ + _ppvar[2]._pval = &prop_ion->param[4]; /* _ion_dinadv */ + prop_ion = need_memb(_k_sym); + nrn_promote(prop_ion, 0, 1); + _ppvar[3]._pval = &prop_ion->param[0]; /* ek */ + _ppvar[4]._pval = &prop_ion->param[3]; /* ik */ + _ppvar[5]._pval = &prop_ion->param[4]; /* _ion_dikdv */ + +} + static void _initlists(); + /* some states have an absolute tolerance */ + static Symbol** _atollist; + static HocStateTolerance _hoc_state_tol[] = { + 0,0 +}; + static void _update_ion_pointer(Datum*); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _hhqt_reg() { + int _vectorized = 1; + _initlists(); + ion_reg("na", -10000.); + ion_reg("k", -10000.); + _na_sym = hoc_lookup("na_ion"); + _k_sym = hoc_lookup("k_ion"); + register_mech(_mechanism, nrn_alloc,nrn_cur, nrn_jacob, nrn_state, nrn_init, hoc_nrnpointerindex, 1); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + _nrn_thread_reg(_mechtype, 2, _update_ion_pointer); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 26, 7); + hoc_register_dparam_semantics(_mechtype, 0, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 1, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 2, "na_ion"); + hoc_register_dparam_semantics(_mechtype, 3, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 4, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 5, "k_ion"); + hoc_register_dparam_semantics(_mechtype, 6, "cvodeieq"); + hoc_register_cvode(_mechtype, _ode_count, _ode_map, _ode_spec, _ode_matsol); + hoc_register_tolerance(_mechtype, _hoc_state_tol, &_atollist); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 hhqt /mnt/c/neuron/neurenv/mech/hhqt.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} +static int rates(_threadargsprotocomma_ double); + +static int _ode_spec1(_threadargsproto_); +/*static int _ode_matsol1(_threadargsproto_);*/ + static int _slist1[3], _dlist1[3]; + static int states(_threadargsproto_); + +/*CVODE*/ + static int _ode_spec1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) {int _reset = 0; { + rates ( _threadargscomma_ v ) ; + Dm = ( minf - m ) / mtau ; + Dh = ( hinf - h ) / htau ; + Dn = ( ninf - n ) / ntau ; + } + return _reset; +} + static int _ode_matsol1 (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + rates ( _threadargscomma_ v ) ; + Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mtau )) ; + Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / htau )) ; + Dn = Dn / (1. - dt*( ( ( ( - 1.0 ) ) ) / ntau )) ; + return 0; +} + /*END CVODE*/ + static int states (double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { { + rates ( _threadargscomma_ v ) ; + m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mtau)))*(- ( ( ( minf ) ) / mtau ) / ( ( ( ( - 1.0 ) ) ) / mtau ) - m) ; + h = h + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / htau)))*(- ( ( ( hinf ) ) / htau ) / ( ( ( ( - 1.0 ) ) ) / htau ) - h) ; + n = n + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / ntau)))*(- ( ( ( ninf ) ) / ntau ) / ( ( ( ( - 1.0 ) ) ) / ntau ) - n) ; + } + return 0; +} + +static int rates ( _threadargsprotocomma_ double _lv ) { + double _lalpha , _lbeta , _lsum , _lq10 ; + _lq10 = pow( 3.0 , ( ( celsius - 6.3 ) / 10.0 ) ) ; + _lalpha = .1 * vtrap ( _threadargscomma_ - ( _lv + 40.0 ) , 10.0 ) ; + _lbeta = 4.0 * exp ( - ( _lv + 65.0 ) / 18.0 ) ; + _lsum = _lalpha + _lbeta ; + mtau = 1.0 / ( _lq10 * _lsum ) ; + minf = _lalpha / _lsum ; + _lalpha = .07 * exp ( - ( _lv + 65.0 ) / 20.0 ) ; + _lbeta = 1.0 / ( exp ( - ( _lv + 35.0 ) / 10.0 ) + 1.0 ) ; + _lsum = _lalpha + _lbeta ; + htau = 1.0 / ( _lq10 * _lsum ) ; + hinf = _lalpha / _lsum ; + _lalpha = .01 * vtrap ( _threadargscomma_ - ( _lv + 55.0 ) , 10.0 ) ; + _lbeta = .125 * exp ( - ( _lv + 65.0 ) / 80.0 ) ; + _lsum = _lalpha + _lbeta ; + ntau = 1.0 / ( _lq10 * _lsum ) ; + ninf = _lalpha / _lsum ; + return 0; } + +static void _hoc_rates(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = 1.; + rates ( _p, _ppvar, _thread, _nt, *getarg(1) ); + hoc_retpushx(_r); +} + +double vtrap ( _threadargsprotocomma_ double _lx , double _ly ) { + double _lvtrap; + if ( fabs ( _lx / _ly ) < 1e-6 ) { + _lvtrap = _ly * ( 1.0 - _lx / _ly / 2.0 ) ; + } + else { + _lvtrap = _lx / ( exp ( _lx / _ly ) - 1.0 ) ; + } + +return _lvtrap; + } + +static void _hoc_vtrap(void) { + double _r; + double* _p; Datum* _ppvar; Datum* _thread; NrnThread* _nt; + if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; } + _thread = _extcall_thread; + _nt = nrn_threads; + _r = vtrap ( _p, _ppvar, _thread, _nt, *getarg(1) , *getarg(2) ); + hoc_retpushx(_r); +} + +static int _ode_count(int _type){ return 3;} + +static void _ode_spec(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + ek = _ion_ek; + _ode_spec1 (_p, _ppvar, _thread, _nt); + }} + +static void _ode_map(int _ieq, double** _pv, double** _pvdot, double* _pp, Datum* _ppd, double* _atol, int _type) { + double* _p; Datum* _ppvar; + int _i; _p = _pp; _ppvar = _ppd; + _cvode_ieq = _ieq; + for (_i=0; _i < 3; ++_i) { + _pv[_i] = _pp + _slist1[_i]; _pvdot[_i] = _pp + _dlist1[_i]; + _cvode_abstol(_atollist, _atol, _i); + } + } + +static void _ode_matsol_instance1(_threadargsproto_) { + _ode_matsol1 (_p, _ppvar, _thread, _nt); + } + +static void _ode_matsol(NrnThread* _nt, _Memb_list* _ml, int _type) { + double* _p; Datum* _ppvar; Datum* _thread; + Node* _nd; double _v; int _iml, _cntml; + _cntml = _ml->_nodecount; + _thread = _ml->_thread; + for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; + v = NODEV(_nd); + ena = _ion_ena; + ek = _ion_ek; + _ode_matsol_instance1(_threadargs_); + }} + extern void nrn_update_ion_pointer(Symbol*, Datum*, int, int); + static void _update_ion_pointer(Datum* _ppvar) { + nrn_update_ion_pointer(_na_sym, _ppvar, 0, 0); + nrn_update_ion_pointer(_na_sym, _ppvar, 1, 3); + nrn_update_ion_pointer(_na_sym, _ppvar, 2, 4); + nrn_update_ion_pointer(_k_sym, _ppvar, 3, 0); + nrn_update_ion_pointer(_k_sym, _ppvar, 4, 3); + nrn_update_ion_pointer(_k_sym, _ppvar, 5, 4); + } + +static void initmodel(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt) { + int _i; double _save;{ + h = h0; + m = m0; + n = n0; + { + rates ( _threadargscomma_ v ) ; + m = minf ; + h = hinf ; + n = ninf ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + ena = _ion_ena; + ek = _ion_ek; + initmodel(_p, _ppvar, _thread, _nt); + } +} + +static double _nrn_current(double* _p, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double _v){double _current=0.;v=_v;{ { + gna = gnabar * m * m * m * h ; + ina = gna * ( v - ena ) ; + gk = gkbar * n * n * n * n ; + ik = gk * ( v - ek ) ; + il = gl * ( v - el ) ; + } + _current += ina; + _current += ik; + _current += il; + +} return _current; +} + +static void nrn_cur(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + ena = _ion_ena; + ek = _ion_ek; + _g = _nrn_current(_p, _ppvar, _thread, _nt, _v + .001); + { double _dik; + double _dina; + _dina = ina; + _dik = ik; + _rhs = _nrn_current(_p, _ppvar, _thread, _nt, _v); + _ion_dinadv += (_dina - ina)/.001 ; + _ion_dikdv += (_dik - ik)/.001 ; + } + _g = (_g - _rhs)/.001; + _ion_ina += ina ; + _ion_ik += ik ; +#if CACHEVEC + if (use_cachevec) { + VEC_RHS(_ni[_iml]) -= _rhs; + }else +#endif + { + NODERHS(_nd) -= _rhs; + } + +} + +} + +static void nrn_jacob(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; +#if CACHEVEC + if (use_cachevec) { + VEC_D(_ni[_iml]) += _g; + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + NODED(_nd) += _g; + } + +} + +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type) { +double* _p; Datum* _ppvar; Datum* _thread; +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +_thread = _ml->_thread; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ + ena = _ion_ena; + ek = _ion_ek; + { states(_p, _ppvar, _thread, _nt); + } }} + +} + +static void terminal(){} + +static void _initlists(){ + double _x; double* _p = &_x; + int _i; static int _first = 1; + if (!_first) return; + _slist1[0] = m_columnindex; _dlist1[0] = Dm_columnindex; + _slist1[1] = h_columnindex; _dlist1[1] = Dh_columnindex; + _slist1[2] = n_columnindex; _dlist1[2] = Dn_columnindex; +_first = 0; +} + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/hhqt.mod"; +static const char* nmodl_file_text = + "COMMENT\n" + " This is the original Hodgkin-Huxley treatment for the set of sodium, \n" + " potassium, and leakage channels found in the squid giant axon membrane.\n" + " (\"A quantitative description of membrane current and its application \n" + " conduction and excitation in nerve\" J.Physiol. (Lond.) 117:500-544 (1952).)\n" + " Membrane voltage is in absolute mV and has been reversed in polarity\n" + " from the original HH convention and shifted to reflect a resting potential\n" + " of -65 mV.\n" + " Remember to set a squid-appropriate temperature\n" + " (e.g. in HOC: \"celsius=6.3\" or in Python: \"h.celsius=6.3\").\n" + " See squid.hoc for an example of a simulation using this model.\n" + " SW Jaslove 6 March, 1992\n" + "ENDCOMMENT\n" + "\n" + "NEURON {\n" + " SUFFIX hhqt\n" + " USEION na READ ena WRITE ina\n" + " USEION k READ ek WRITE ik\n" + " NONSPECIFIC_CURRENT il\n" + " RANGE gnabar, gkbar, gl, el, gna, gk, celsius\n" + "}\n" + " \n" + "UNITS {\n" + " (mA) = (milliamp)\n" + " (mV) = (millivolt)\n" + " (S) = (siemens)\n" + "}\n" + " \n" + "PARAMETER {\n" + " gnabar = .12 (S/cm2) <0,1e9>\n" + " gkbar = .036 (S/cm2) <0,1e9>\n" + " gl = .0003 (S/cm2) <0,1e9>\n" + " el = -54.3 (mV)\n" + " celsius = 29 (degC)\n" + "}\n" + " \n" + "ASSIGNED {\n" + " v (mV)\n" + " ena (mV)\n" + " ek (mV)\n" + " gna (S/cm2)\n" + " gk (S/cm2)\n" + " ina (mA/cm2)\n" + " ik (mA/cm2)\n" + " il (mA/cm2)\n" + " minf hinf ninf\n" + " mtau (ms) htau (ms) ntau (ms)\n" + "}\n" + " \n" + "STATE {\n" + " m h n\n" + "}\n" + " \n" + "BREAKPOINT {\n" + " SOLVE states METHOD cnexp\n" + " gna = gnabar*m*m*m*h\n" + " ina = gna*(v - ena)\n" + " gk = gkbar*n*n*n*n\n" + " ik = gk*(v - ek) \n" + " il = gl*(v - el)\n" + "}\n" + "\n" + "DERIVATIVE states { \n" + " rates(v)\n" + " m' = (minf-m)/mtau\n" + " h' = (hinf-h)/htau\n" + " n' = (ninf-n)/ntau\n" + "}\n" + " \n" + "INITIAL {\n" + " rates(v)\n" + " m = minf\n" + " h = hinf\n" + " n = ninf\n" + "}\n" + "\n" + "PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.\n" + " :Call once from HOC to initialize inf at resting v.\n" + " LOCAL alpha, beta, sum, q10\n" + " q10 = 3^((celsius - 6.3)/10)\n" + "\n" + "UNITSOFF\n" + " :\"m\" sodium activation system\n" + " alpha = .1*vtrap(-(v+40),10)\n" + " beta = 4*exp(-(v+65)/18)\n" + " sum = alpha + beta\n" + " mtau = 1/(q10*sum)\n" + " minf = alpha/sum\n" + " \n" + " :\"h\" sodium inactivation system\n" + " alpha = .07*exp(-(v+65)/20)\n" + " beta = 1/(exp(-(v+35)/10) + 1)\n" + " sum = alpha + beta\n" + " htau = 1/(q10*sum)\n" + " hinf = alpha/sum\n" + " \n" + " :\"n\" potassium activation system\n" + " alpha = .01*vtrap(-(v+55),10) \n" + " beta = .125*exp(-(v+65)/80)\n" + " sum = alpha + beta\n" + " ntau = 1/(q10*sum)\n" + " ninf = alpha/sum\n" + "}\n" + " \n" + "FUNCTION vtrap(x,y) { :Traps for 0 in denominator of rate eqns.\n" + " if (fabs(x/y) < 1e-6) {\n" + " vtrap = y*(1 - x/y/2)\n" + " }else{\n" + " vtrap = x/(exp(x/y) - 1)\n" + " }\n" + "}\n" + " \n" + "UNITSON\n" + ; +#endif diff --git a/x86_64/hhqt.o b/x86_64/hhqt.o new file mode 100644 index 0000000..1b769f1 Binary files /dev/null and b/x86_64/hhqt.o differ diff --git a/x86_64/libnrnmech.so b/x86_64/libnrnmech.so new file mode 100644 index 0000000..9e7ce03 Binary files /dev/null and b/x86_64/libnrnmech.so differ diff --git a/x86_64/makemod2c_inc b/x86_64/makemod2c_inc new file mode 100644 index 0000000..f3ded5f --- /dev/null +++ b/x86_64/makemod2c_inc @@ -0,0 +1,200 @@ +./CaDynamics_E2.c: /mnt/c/neuron/neurenv/mech/CaDynamics_E2.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "CaDynamics_E2.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./CaDynamics_E2.o: ./CaDynamics_E2.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./CaDynamics_E2_soma.c: /mnt/c/neuron/neurenv/mech/CaDynamics_E2_soma.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "CaDynamics_E2_soma.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./CaDynamics_E2_soma.o: ./CaDynamics_E2_soma.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Ca_HVA.c: /mnt/c/neuron/neurenv/mech/Ca_HVA.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_HVA.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Ca_HVA.o: ./Ca_HVA.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Ca_HVA_soma.c: /mnt/c/neuron/neurenv/mech/Ca_HVA_soma.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_HVA_soma.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Ca_HVA_soma.o: ./Ca_HVA_soma.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Ca_LVAst.c: /mnt/c/neuron/neurenv/mech/Ca_LVAst.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_LVAst.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Ca_LVAst.o: ./Ca_LVAst.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Ca_LVAst_soma.c: /mnt/c/neuron/neurenv/mech/Ca_LVAst_soma.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_LVAst_soma.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Ca_LVAst_soma.o: ./Ca_LVAst_soma.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Ca.c: /mnt/c/neuron/neurenv/mech/Ca.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Ca.o: ./Ca.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./hhqt.c: /mnt/c/neuron/neurenv/mech/hhqt.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "hhqt.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./hhqt.o: ./hhqt.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Ih.c: /mnt/c/neuron/neurenv/mech/Ih.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ih.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Ih.o: ./Ih.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Im.c: /mnt/c/neuron/neurenv/mech/Im.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Im.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Im.o: ./Im.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./K_Pst.c: /mnt/c/neuron/neurenv/mech/K_Pst.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "K_Pst.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./K_Pst.o: ./K_Pst.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./K_Tst.c: /mnt/c/neuron/neurenv/mech/K_Tst.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "K_Tst.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./K_Tst.o: ./K_Tst.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./Nap_Et2.c: /mnt/c/neuron/neurenv/mech/Nap_Et2.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Nap_Et2.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./Nap_Et2.o: ./Nap_Et2.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./NaTa_t.c: /mnt/c/neuron/neurenv/mech/NaTa_t.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTa_t.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./NaTa_t.o: ./NaTa_t.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./NaTa_t_myel.c: /mnt/c/neuron/neurenv/mech/NaTa_t_myel.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTa_t_myel.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./NaTa_t_myel.o: ./NaTa_t_myel.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./NaTa_t_nor.c: /mnt/c/neuron/neurenv/mech/NaTa_t_nor.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTa_t_nor.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./NaTa_t_nor.o: ./NaTa_t_nor.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./NaTs2_t_apic.c: /mnt/c/neuron/neurenv/mech/NaTs2_t_apic.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTs2_t_apic.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./NaTs2_t_apic.o: ./NaTs2_t_apic.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./NaTs2_t.c: /mnt/c/neuron/neurenv/mech/NaTs2_t.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTs2_t.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./NaTs2_t.o: ./NaTs2_t.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./NaTs2_t_soma.c: /mnt/c/neuron/neurenv/mech/NaTs2_t_soma.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTs2_t_soma.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./NaTs2_t_soma.o: ./NaTs2_t_soma.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./SK_E2.c: /mnt/c/neuron/neurenv/mech/SK_E2.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SK_E2.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./SK_E2.o: ./SK_E2.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./SK_E2_soma.c: /mnt/c/neuron/neurenv/mech/SK_E2_soma.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SK_E2_soma.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./SK_E2_soma.o: ./SK_E2_soma.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./SKv3_1_apic.c: /mnt/c/neuron/neurenv/mech/SKv3_1_apic.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SKv3_1_apic.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./SKv3_1_apic.o: ./SKv3_1_apic.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./SKv3_1.c: /mnt/c/neuron/neurenv/mech/SKv3_1.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SKv3_1.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./SKv3_1.o: ./SKv3_1.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./SKv3_1_soma.c: /mnt/c/neuron/neurenv/mech/SKv3_1_soma.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SKv3_1_soma.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./SKv3_1_soma.o: ./SKv3_1_soma.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + +./xtra.c: /mnt/c/neuron/neurenv/mech/xtra.mod + @printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n" + (cd "/mnt/c/neuron/neurenv/mech"; MODLUNIT=$(NRNUNITS) $(NOCMODL) "xtra.mod" -o "/mnt/c/neuron/neurenv/x86_64") + +./xtra.o: ./xtra.c + @printf " -> $(C_GREEN)Compiling$(C_RESET) $<\\n" + $(COMPILE) -I"/mnt/c/neuron/neurenv/mech" $(INCLUDES) -fPIC -c $< -o $@ + diff --git a/x86_64/mod_func.cpp b/x86_64/mod_func.cpp new file mode 100644 index 0000000..790385b --- /dev/null +++ b/x86_64/mod_func.cpp @@ -0,0 +1,94 @@ +#include +#include "hocdec.h" +extern int nrnmpi_myid; +extern int nrn_nobanner_; +#if defined(__cplusplus) +extern "C" { +#endif + +extern void _CaDynamics_E2_reg(void); +extern void _CaDynamics_E2_soma_reg(void); +extern void _Ca_HVA_reg(void); +extern void _Ca_HVA_soma_reg(void); +extern void _Ca_LVAst_reg(void); +extern void _Ca_LVAst_soma_reg(void); +extern void _Ca_reg(void); +extern void _hhqt_reg(void); +extern void _Ih_reg(void); +extern void _Im_reg(void); +extern void _K_Pst_reg(void); +extern void _K_Tst_reg(void); +extern void _Nap_Et2_reg(void); +extern void _NaTa_t_reg(void); +extern void _NaTa_t_myel_reg(void); +extern void _NaTa_t_nor_reg(void); +extern void _NaTs2_t_apic_reg(void); +extern void _NaTs2_t_reg(void); +extern void _NaTs2_t_soma_reg(void); +extern void _SK_E2_reg(void); +extern void _SK_E2_soma_reg(void); +extern void _SKv3_1_apic_reg(void); +extern void _SKv3_1_reg(void); +extern void _SKv3_1_soma_reg(void); +extern void _xtra_reg(void); + +void modl_reg() { + if (!nrn_nobanner_) if (nrnmpi_myid < 1) { + fprintf(stderr, "Additional mechanisms from files\n"); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/CaDynamics_E2.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/CaDynamics_E2_soma.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Ca_HVA.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Ca_HVA_soma.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Ca_LVAst.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Ca_LVAst_soma.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Ca.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/hhqt.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Ih.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Im.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/K_Pst.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/K_Tst.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/Nap_Et2.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/NaTa_t.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/NaTa_t_myel.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/NaTa_t_nor.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/NaTs2_t_apic.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/NaTs2_t.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/NaTs2_t_soma.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/SK_E2.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/SK_E2_soma.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/SKv3_1_apic.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/SKv3_1.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/SKv3_1_soma.mod\""); + fprintf(stderr, " \"/mnt/c/neuron/neurenv/mech/xtra.mod\""); + fprintf(stderr, "\n"); + } + _CaDynamics_E2_reg(); + _CaDynamics_E2_soma_reg(); + _Ca_HVA_reg(); + _Ca_HVA_soma_reg(); + _Ca_LVAst_reg(); + _Ca_LVAst_soma_reg(); + _Ca_reg(); + _hhqt_reg(); + _Ih_reg(); + _Im_reg(); + _K_Pst_reg(); + _K_Tst_reg(); + _Nap_Et2_reg(); + _NaTa_t_reg(); + _NaTa_t_myel_reg(); + _NaTa_t_nor_reg(); + _NaTs2_t_apic_reg(); + _NaTs2_t_reg(); + _NaTs2_t_soma_reg(); + _SK_E2_reg(); + _SK_E2_soma_reg(); + _SKv3_1_apic_reg(); + _SKv3_1_reg(); + _SKv3_1_soma_reg(); + _xtra_reg(); +} + +#if defined(__cplusplus) +} +#endif diff --git a/x86_64/mod_func.o b/x86_64/mod_func.o new file mode 100644 index 0000000..9c32f3c Binary files /dev/null and b/x86_64/mod_func.o differ diff --git a/x86_64/special b/x86_64/special new file mode 100644 index 0000000..4d24c75 Binary files /dev/null and b/x86_64/special differ diff --git a/x86_64/xtra.c b/x86_64/xtra.c new file mode 100644 index 0000000..5b3d37e --- /dev/null +++ b/x86_64/xtra.c @@ -0,0 +1,325 @@ +/* Created by Language version: 7.7.0 */ +/* NOT VECTORIZED */ +#define NRN_VECTORIZED 0 +#include +#include +#include +#include "mech_api.h" +#undef PI +#define nil 0 +#include "md1redef.h" +#include "section.h" +#include "nrniv_mf.h" +#include "md2redef.h" + +#if METHOD3 +extern int _method3; +#endif + +#if !NRNGPU +#undef exp +#define exp hoc_Exp +extern double hoc_Exp(double); +#endif + +#define nrn_init _nrn_init__xtra +#define _nrn_initial _nrn_initial__xtra +#define nrn_cur _nrn_cur__xtra +#define _nrn_current _nrn_current__xtra +#define nrn_jacob _nrn_jacob__xtra +#define nrn_state _nrn_state__xtra +#define _net_receive _net_receive__xtra + +#define _threadargscomma_ /**/ +#define _threadargsprotocomma_ /**/ +#define _threadargs_ /**/ +#define _threadargsproto_ /**/ + /*SUPPRESS 761*/ + /*SUPPRESS 762*/ + /*SUPPRESS 763*/ + /*SUPPRESS 765*/ + extern double *getarg(int); + static double *_p; static Datum *_ppvar; + +#define t nrn_threads->_t +#define dt nrn_threads->_dt +#define es _p[0] +#define es_columnindex 0 +#define x _p[1] +#define x_columnindex 1 +#define y _p[2] +#define y_columnindex 2 +#define z _p[3] +#define z_columnindex 3 +#define type _p[4] +#define type_columnindex 4 +#define order _p[5] +#define order_columnindex 5 +#define ex *_ppvar[0]._pval +#define _p_ex _ppvar[0]._pval +#define area *_ppvar[1]._pval + +#if MAC +#if !defined(v) +#define v _mlhv +#endif +#if !defined(h) +#define h _mlhh +#endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + static int hoc_nrnpointerindex = 0; + /* external NEURON variables */ + /* declaration of user functions */ + static int _mechtype; +extern void _nrn_cacheloop_reg(int, int); +extern void hoc_register_prop_size(int, int, int); +extern void hoc_register_limits(int, HocParmLimits*); +extern void hoc_register_units(int, HocParmUnits*); +extern void nrn_promote(Prop*, int, int); +extern Memb_func* memb_func; + +#define NMODL_TEXT 1 +#if NMODL_TEXT +static const char* nmodl_file_text; +static const char* nmodl_filename; +extern void hoc_reg_nmodl_text(int, const char*); +extern void hoc_reg_nmodl_filename(int, const char*); +#endif + + extern void _nrn_setdata_reg(int, void(*)(Prop*)); + static void _setdata(Prop* _prop) { + _p = _prop->param; _ppvar = _prop->dparam; + } + static void _hoc_setdata() { + Prop *_prop, *hoc_getdata_range(int); + _prop = hoc_getdata_range(_mechtype); + _setdata(_prop); + hoc_retpushx(1.); +} + /* connect user functions to hoc names */ + static VoidFunc hoc_intfunc[] = { + "setdata_xtra", _hoc_setdata, + 0, 0 +}; + /* declare global and static user variables */ +#define stim stim_xtra + double stim = 0; + /* some parameters have upper and lower limits */ + static HocParmLimits _hoc_parm_limits[] = { + 0,0,0 +}; + static HocParmUnits _hoc_parm_units[] = { + "stim_xtra", "unitless", + "es_xtra", "mV", + "x_xtra", "1", + "y_xtra", "1", + "z_xtra", "1", + "type_xtra", "1", + "order_xtra", "1", + "ex_xtra", "millivolts", + 0,0 +}; + static double v = 0; + /* connect global user variables to hoc */ + static DoubScal hoc_scdoub[] = { + "stim_xtra", &stim_xtra, + 0,0 +}; + static DoubVec hoc_vdoub[] = { + 0,0,0 +}; + static double _sav_indep; + static void _ba1(Node*_nd, double* _pp, Datum* _ppd, Datum* _thread, NrnThread* _nt) ; + static void nrn_alloc(Prop*); +static void nrn_init(NrnThread*, _Memb_list*, int); +static void nrn_state(NrnThread*, _Memb_list*, int); + /* connect range variables in _p that hoc is supposed to know about */ + static const char *_mechanism[] = { + "7.7.0", +"xtra", + "es_xtra", + "x_xtra", + "y_xtra", + "z_xtra", + "type_xtra", + "order_xtra", + 0, + 0, + 0, + "ex_xtra", + 0}; + extern Node* nrn_alloc_node_; + +extern Prop* need_memb(Symbol*); + +static void nrn_alloc(Prop* _prop) { + Prop *prop_ion; + double *_p; Datum *_ppvar; + _p = nrn_prop_data_alloc(_mechtype, 6, _prop); + /*initialize range parameters*/ + es = 0; + x = 0; + y = 0; + z = 0; + type = 0; + order = 0; + _prop->param = _p; + _prop->param_size = 6; + _ppvar = nrn_prop_datum_alloc(_mechtype, 2, _prop); + _prop->dparam = _ppvar; + /*connect ionic variables to this model*/ + _ppvar[1]._pval = &nrn_alloc_node_->_area; /* diam */ + +} + static void _initlists(); + extern Symbol* hoc_lookup(const char*); +extern void _nrn_thread_reg(int, int, void(*)(Datum*)); +extern void _nrn_thread_table_reg(int, void(*)(double*, Datum*, Datum*, NrnThread*, int)); +extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); +extern void _cvode_abstol( Symbol**, double*, int); + + void _xtra_reg() { + int _vectorized = 0; + _initlists(); + register_mech(_mechanism, nrn_alloc,(void*)0, (void*)0, (void*)0, nrn_init, hoc_nrnpointerindex, 0); + _mechtype = nrn_get_mechtype(_mechanism[1]); + _nrn_setdata_reg(_mechtype, _setdata); + #if NMODL_TEXT + hoc_reg_nmodl_text(_mechtype, nmodl_file_text); + hoc_reg_nmodl_filename(_mechtype, nmodl_filename); +#endif + hoc_register_prop_size(_mechtype, 6, 2); + hoc_register_dparam_semantics(_mechtype, 0, "pointer"); + hoc_register_dparam_semantics(_mechtype, 1, "area"); + hoc_reg_ba(_mechtype, _ba1, 11); + hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); + ivoc_help("help ?1 xtra /mnt/c/neuron/neurenv/mech/xtra.mod\n"); + hoc_register_limits(_mechtype, _hoc_parm_limits); + hoc_register_units(_mechtype, _hoc_parm_units); + } +static int _reset; +static char *modelname = ""; + +static int error; +static int _ninits = 0; +static int _match_recurse=1; +static void _modl_cleanup(){ _match_recurse=1;} + /* BEFORE BREAKPOINT */ + static void _ba1(Node*_nd, double* _pp, Datum* _ppd, Datum* _thread, NrnThread* _nt) { + _p = _pp; _ppvar = _ppd; + v = NODEV(_nd); + ex = stim * es ; + } + +static void initmodel() { + int _i; double _save;_ninits++; +{ + { + ex = stim * es ; + } + +} +} + +static void nrn_init(NrnThread* _nt, _Memb_list* _ml, int _type){ +Node *_nd; double _v; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v = _v; + initmodel(); +}} + +static double _nrn_current(double _v){double _current=0.;v=_v;{ +} return _current; +} + +static void nrn_state(NrnThread* _nt, _Memb_list* _ml, int _type){ +Node *_nd; double _v = 0.0; int* _ni; int _iml, _cntml; +#if CACHEVEC + _ni = _ml->_nodeindices; +#endif +_cntml = _ml->_nodecount; +for (_iml = 0; _iml < _cntml; ++_iml) { + _p = _ml->_data[_iml]; _ppvar = _ml->_pdata[_iml]; + _nd = _ml->_nodelist[_iml]; +#if CACHEVEC + if (use_cachevec) { + _v = VEC_V(_ni[_iml]); + }else +#endif + { + _nd = _ml->_nodelist[_iml]; + _v = NODEV(_nd); + } + v=_v; +{ +}} + +} + +static void terminal(){} + +static void _initlists() { + int _i; static int _first = 1; + if (!_first) return; +_first = 0; +} + +#if NMODL_TEXT +static const char* nmodl_filename = "/mnt/c/neuron/neurenv/mech/xtra.mod"; +static const char* nmodl_file_text = + ": $Id: xtra.mod,v 1.4 2014/08/18 23:15:25 ted Exp ted $\n" + ": 2018/05/20 Modified by Aman Aberra \n" + "\n" + "NEURON {\n" + " SUFFIX xtra\n" + " RANGE es : (es = max amplitude of the potential) \n" + " RANGE x, y, z, type, order\n" + " GLOBAL stim : (stim = normalized waveform)\n" + " POINTER ex \n" + "}\n" + "\n" + "PARAMETER { \n" + " es = 0 (mV)\n" + " x = 0 (1) : spatial coords\n" + " y = 0 (1)\n" + " z = 0 (1) \n" + " type = 0 (1) : numbering system for morphological category of section - unassigned is 0\n" + " order = 0 (1) : order of branch/collateral. \n" + "}\n" + "\n" + "ASSIGNED {\n" + " v (millivolts)\n" + " ex (millivolts)\n" + " stim (unitless) \n" + " area (micron2)\n" + "}\n" + "\n" + "INITIAL {\n" + " ex = stim*es \n" + "}\n" + "\n" + "\n" + "BEFORE BREAKPOINT { : before each cy' = f(y,t) setup\n" + " ex = stim*es\n" + "}\n" + "\n" + ; +#endif diff --git a/x86_64/xtra.o b/x86_64/xtra.o new file mode 100644 index 0000000..5af44af Binary files /dev/null and b/x86_64/xtra.o differ