-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNaV.h
90 lines (79 loc) · 2.09 KB
/
NaV.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Sodium CONDUCTANCE
#ifndef NAV
#define NAV
#include "conductance.h"
//inherit conductance class spec
class NaV: public conductance {
protected:
double m;
double h;
public:
//constructors - must set gbar!
// gbar only
NaV(double g_in)//: conductance(g_in)
{
gbar = g_in;
state_dim = 2;
// default if unspecified
e_rev = 50.0;
}
//specify both gbar and erev
NaV(double g_in, double e_in)//: conductance(g_in)
{
gbar = g_in;
state_dim = 2;
e_rev = e_in;
}
//return current
double i(void);
void integrate(double dt);
//let conductance access cell/compartment state
int get_state_dim(void);
void connect(compstate *s_in);
double m_inf(void);
double h_inf(void);
double tau_m(void);
double tau_h(void);
void state2double(double*);
void double2state(double*);
};
int NaV::get_state_dim(void)
{
return 2;
}
double NaV::i(void)
{
return gbar*m*m*m*h*(e_rev - v_m());
}
// can maybe speed things up by overwriting get_g to return gbar & making integrate empty.
void NaV::integrate(double dt)
{
//mexPrintf("integrating, dt = %e\n", dt);
m = m_inf() + (m - m_inf())*exp(-dt/tau_m());
h = h_inf() + (h - h_inf())*exp(-dt/tau_h());
g = gbar*m*m*m*h;
//default: g is fixed
}
void NaV::connect(compstate *s_in)
{
compartment_state = s_in;
m = m_inf();
h = h_inf();
//mexPrintf("state ptr val: %f\n",compartment_state->get_v());
//mexPrintf("state ptr: %d\n",compartment_state);
}
double NaV::m_inf(void) {return 1.0/(1.0+exp((v_m()+25.5)/-5.29));}
double NaV::h_inf(void) {return 1.0/(1.0+exp((v_m()+48.9)/5.18));}
double NaV::tau_m(void) {return 1.32 - 1.26/(1+exp((v_m()+120.0)/-25.0));}
double NaV::tau_h(void) {return (0.67/(1.0+exp((v_m()+62.9)/-10.0)))*(1.5+1.0/(1.0+exp((v_m()+34.9)/3.6)));}
void NaV::state2double(double* st)
{
st[0] = m;
st[1] = h;
}
void NaV::double2state(double* st)
{
m = st[0];
h = st[1];
}
#endif