-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCaS.h
92 lines (79 loc) · 2.08 KB
/
CaS.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
91
92
// CALCIUM CONDUCTANCE (slow)
#ifndef CAS
#define CAS
#include "conductance.h"
//inherit conductance class spec
class CaS: public conductance {
protected:
double m;
double h;
double i_Ca;
double v;
public:
//constructors - must set gbar!
// gbar only
CaS(double g_in)//: conductance(g_in)
{
gbar = g_in;
state_dim = 2;
// default if unspecified
e_rev = 120.0;
}
//specify both gbar and erev
CaS(double g_in, double e_in)//: conductance(g_in)
{
gbar = g_in;
state_dim = 2;
e_rev = e_in;
}
int get_state_dim(void);
double i(void);
void integrate(double dt);
//let conductance access cell/compartment state
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 CaS::get_state_dim(void)
{
return 2;
}
double CaS::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 CaS::integrate(double dt)
{
i_Ca = compartment_state->get_i_Ca();
e_rev = compartment_state->get_e_Ca();
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;
compartment_state->set_i_Ca(g*(e_rev - v_m()) + i_Ca);
}
void CaS::connect(compstate *s_in)
{
compartment_state = s_in;
m = m_inf();
h = h_inf();
}
double CaS::m_inf(void) {return 1.0/(1.0+exp((v_m()+33.0)/-8.1));}
double CaS::h_inf(void) {return 1.0/(1.0+exp((v_m()+60.0)/6.2));}
double CaS::tau_m(void) {return 1.4 + 7.0/(exp((v_m()+27.0)/10.0) + exp((v_m()+70.0)/-13.0));}
double CaS::tau_h(void) {return 60.0 + 150.0/(exp((v_m()+55.0)/9.0) + exp((v_m()+65.0)/-16.0));}
void CaS::state2double(double* st)
{
st[0] = m;
st[1] = h;
}
void CaS::double2state(double* st)
{
m = st[0];
h = st[1];
}
#endif