-
Notifications
You must be signed in to change notification settings - Fork 1
/
NMDA.f95
66 lines (56 loc) · 1.9 KB
/
NMDA.f95
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
! -*- f95 -*-
! (c) 2016 - Ilya Prokin - [email protected] - https://sites.google.com/site/ilyaprokin
! INRIA Rhone-Alpes
! STDP model : NMDAR model
module NMDA
use pars_mod
use general_math
use ghk_flux
implicit none
type NMDA_tabs_type
real*8, allocatable :: B(:)
integer :: n
real*8 :: xst, xfin, xstep
end type NMDA_tabs_type
type(NMDA_tabs_type), save :: NMDA_tabs
contains
subroutine NMDA_tables_make(xst,xfin,n_x,pars, NMDA_tabs)
integer, intent(in) :: n_x
real*8, intent(in) :: xst,xfin
type(pars_type), intent(in) :: pars
type(NMDA_tabs_type), intent(out) :: NMDA_tabs
real*8 :: v(n_x), xstep
integer :: i
xstep = (xfin-xst)/n_x
NMDA_tabs%n=n_x
NMDA_tabs%xst=xst
NMDA_tabs%xfin=xfin
NMDA_tabs%xstep=xstep
allocate(NMDA_tabs%B(n_x))
forall (i=1:n_x)
v(i) = xst+xstep*(i-1)
NMDA_tabs%B(i) = 1.0/(1+pars%NMDA%Mg/3.57*exp(-0.062*v(i)))
end forall
end subroutine NMDA_tables_make
subroutine NMDA_tables_clean(NMDA_tabs)
type(NMDA_tabs_type) :: NMDA_tabs
deallocate(NMDA_tabs%B)
end subroutine NMDA_tables_clean
real*8 function NMDA_B(v)
real*8, intent(in) :: v
NMDA_B=lin_interpTable_brds(NMDA_tabs%B, NMDA_tabs%n, (v-NMDA_tabs%xst)/NMDA_tabs%xstep)
end function NMDA_B
real*8 function g_NMDA_func(V, o_NMDA)
implicit none
real*8 :: o_NMDA,V
g_NMDA_func = o_NMDA * NMDA_B(V)
end function g_NMDA_func
subroutine do_NMDA(Glu,o_NMDA,pars, d_o_NMDA)
! o_NMDA - probability of the open state
implicit none
real*8, intent(in) :: Glu,o_NMDA
type(pars_type), intent(in) :: pars
real*8, intent(out) :: d_o_NMDA
d_o_NMDA = pars%NMDA%Alpha*Glu*(1-o_NMDA)-pars%NMDA%Beta*o_NMDA
end subroutine do_NMDA
end module NMDA