na = rxd.Species([cyt, mem, ecs], name="na", d=1, charge=1, initial=concentration(15.5, 161.5)) k = rxd.Species([cyt, mem, ecs], name="k", d=1, charge=1, initial=concentration(142.5, 7.8)) cl = rxd.Species([cyt, mem, ecs], name="cl", d=1, charge=-1, initial=concentration(6.0, 130)) glial_na = rxd.Parameter([gcyt, gmem], name="na", charge=1, value=18) # Na in book is 55 for astrocyte glial_k = rxd.Parameter([gcyt, gmem], name="k", charge=1, value=80) dump = rxd.Parameter([cyt, mem, gcyt, gmem], name="dump") ki, ko, nai, nao, cli, clo, gnai, gki = ( k[cyt], k[ecs], na[cyt], na[ecs], cl[cyt], cl[ecs], glial_na[gcyt], glial_k[gcyt], ) # i = in cytosol (cyt) o = in extracellular (ecs) # extracellular oxygen concentration o2ecs = rxd.Species([ecs], name="o2ecs", initial=oa_bath)
from neuron import h, rxd from neuron.units import mV, ms h.load_file("stdrun.hoc") soma = h.Section(name="soma") soma.diam = soma.L = 10 # the geometry of the ecs doesn't matter in the constant case ecs = rxd.Region([soma], name="ecs", nrn_region="o", geometry=rxd.Shell(1, 2)) cyt = rxd.Region([soma], name="cyt", nrn_region="i") mem = rxd.Region([soma], name="mem", geometry=rxd.membrane()) cao = rxd.Parameter(ecs, charge=2) ca = rxd.Species( [cyt], d=1, # with single section and nseg=1 only affects extracellular name="ca", charge=2, initial=lambda node: 1e-3 if node.region == cyt else 0, ) e = 1.60217662e-19 scale = 1e-14 / e # rate constant is in terms of molecules/um2 ms ca_pump = rxd.MultiCompartmentReaction( ca[cyt], cao[ecs], ca[cyt] * scale,
from neuron.units import mM, ms sim_time = 100 axon_terminal = h.Section(name="axon_terminal") #synaptic_cleft = rxd.Region([axon_terminal], nrn_region='o') axon_terminal_region = rxd.Region([axon_terminal], nrn_region='i') ca_intra = rxd.Species(axon_terminal_region, name="ca", charge=2, d=0, initial=5e-4, atolscale=1e-6) F = rxd.Species(axon_terminal_region, name="F", initial=0.001) FA = rxd.Species(axon_terminal_region, name="FA", initial=0) kb = rxd.Parameter(axon_terminal_region, name="kb", value=1e16 / (mM**4 * ms)) ku = rxd.Parameter(axon_terminal_region, name="ku", value=0.1 / ms) myreaction = rxd.Reaction(F + 4 * ca_intra, FA, kb, ku) #, regions=axon_terminal_region) tvec = h.Vector().record(h._ref_t) Fvec = h.Vector().record(F.nodes._ref_concentration) FAvec = h.Vector().record(FA.nodes._ref_concentration) h.finitialize(-65) h.continuerun(10) pyplot.plot(tvec, Fvec) pyplot.plot(tvec, FAvec) pyplot.show()
def declare_parameters(**kwargs): """enables clean declaration of parameters in top namespace""" for key in sorted(kwargs): globals()[key] = rxd.Parameter(r, name=key, value=kwargs[key])
'PDE4', 'PDE4cAMP' ] windows = [0, 0, 0, 2, 1, 1, 3, 3, 4, 4] tolscales = [1.0 for i in range(0, len(species))] print "my_volume = " + str(my_volume) + " l ?= " + str( dend.L * (dend.diam / 2)**2 * 3.14159265358) + " um3" specs = [] for ispec in range(0, len(species)): specs.append( rxd.Species(cyt, name='spec' + str(ispec), charge=0, initial=initvalues[ispec], atolscale=tolscales[ispec])) cAMP_flux_rate = rxd.Parameter(cyt, initial=0) #specs[0] cAMP #specs[1] PKA2cAMP #specs[2] PKA4cAMP #specs[3] PKA #specs[4] PKAr #specs[5] PKAc #specs[6] AMP #specs[7] ATP #specs[8] PDE4 #specs[9] PDE4cAMP reaction1 = rxd.Reaction(specs[3] + specs[0] * 4 <> specs[2], ks[0], ks[1]) reaction3 = rxd.Reaction(specs[2] <> specs[4] + specs[5] * 2, ks[4] * specs[2], ks[5] * specs[4] * specs[5],
na = rxd.Species([cyt, mem, ecs], name='na', d=1, charge=1, initial=concentration(15.5, 161.5)) k = rxd.Species([cyt, mem, ecs], name='k', d=1, charge=1, initial=concentration(142.5, 7.8)) cl = rxd.Species([cyt, mem, ecs], name='cl', d=1, charge=-1, initial=concentration(6.0, 130)) glial_na = rxd.Parameter([gcyt, gmem], name='na', charge=1, value=18) #Na in book is 55 for astrocyte glial_k = rxd.Parameter([gcyt, gmem], name='k', charge=1, value=80) dump = rxd.Parameter([cyt, mem, gcyt, gmem], name='dump') ki, ko, nai, nao, cli, clo, gnai, gki = k[cyt], k[ecs], na[cyt], na[ecs], cl[ cyt], cl[ecs], glial_na[gcyt], glial_k[gcyt] #i = in cytosol (cyt) o = in extracellular (ecs) #extracellular oxygen concentration o2ecs = rxd.Species([ecs], name='o2ecs', initial=oa_bath) #STATES------------------------------------------------------------------------------------------------------------------------- #gating variables (m, h, n) mgate = rxd.State([cyt, mem], name='mgate', initial=0.00787013592322398) hgate = rxd.State([cyt, mem], name='hgate', initial=0.9981099795551048) ngate = rxd.State([cyt, mem], name='ngate', initial=0.02284760152971809)
cyt = rxd.Region(h.allsec(), nrn_region='i', geometry=rxd.FractionalVolume(fc, surface_fraction=1)) er = rxd.Region(h.allsec(), geometry=rxd.FractionalVolume(fe)) # this defines a boundary with an area independent of geometry (here there is # one square micron of area per micron of length) cyt_er_membrane = rxd.Region(h.allsec(), geometry=rxd.ScalableBorder(1)) # reaction-diffusion definition ca = rxd.Species([cyt, er], d=caDiff, name='ca', charge=2, initial=caCYT_init) ip3 = rxd.Species(cyt, d=ip3Diff, initial=ip3_init) #gip3r - not a rate constant but multiplies k, which is a rate constant (?) gip3r = rxd.Parameter( cyt, initial=ip3_notorigin ) # parameters but set magnitude via concentration or value gserca = rxd.Parameter(cyt, initial=gserca0) gleak = rxd.Parameter(cyt, initial=gleak0) # action of IP3 receptor Kip3 = 0.13 # Kip3 = 0.15 Kact = 0.4 minf = ip3[cyt] * 1000. * ca[cyt] / (ip3[cyt] + Kip3) / (1000. * ca[cyt] + Kact) #ip3r_gate_state = rxd.State(cyt_er_membrane, initial=0.78282068629348611) ip3r_gate_state = rxd.State(cyt_er_membrane, initial=0.8) h_gate = ip3r_gate_state[cyt_er_membrane] k = gip3r[cyt] * (minf * h_gate)**3 ip3r = rxd.MultiCompartmentReaction(ca[er] <> ca[cyt], k,