Compare commits

...

2 Commits

Author SHA1 Message Date
Connell Paxton
a0a907245a Added additional files 2026-07-11 18:20:01 -04:00
Connell Paxton
e50cf362d4 lockd tf in 2026-06-21 09:28:23 -04:00
170 changed files with 99405 additions and 707 deletions

16
TMS_sim_simple.hoc Normal file
View File

@ -0,0 +1,16 @@
func TMS_sim_simple(){ localobj nil, detector
axon detector = new NetCon(&v(0.5), nil)
detector.threshold = 0
detector.record("handle()")
printf("Init entered\n")
init()
printf("Init exited\n")
run()
return fired
}
proc handle(){
fired = 1
stoprun = 1
}

14
TMS_sim_simple_dend.hoc Normal file
View File

@ -0,0 +1,14 @@
func TMS_sim_simple_dend(){ localobj nil, detector
dend detector = new NetCon(&v(0.5), nil)
detector.threshold = 0
detector.record("handle()")
init()
run()
return fired
}
proc handle(){
fired = 1
stoprun = 1
}

Binary file not shown.

Binary file not shown.

55
detectFire.hoc Normal file
View File

@ -0,0 +1,55 @@
proc detectFire() { localobj savSCA
printf("detectFire entered\n")
savSCA = new File()
sprint(s,$s1)
savSCA.wopen(s)
fired = 0
firstfired = 0
firstunfired = 0
SCA = -20
SCA_t = SCA
SCA_b = SCA
nt = 100
for it = 1,nt {
printf("%d\n", it)
if (abs(SCA_t - SCA_b) >= 1e-2 || it == 1) {
setstim(DEL, DUR, SCA) // In stim.hoc
printf("Stim is set\n")
TMS_sim_simple()
printf("SCA = %f\tfired = %d\n", SCA, fired)
savSCA.printf("SCA = %f\tfired = %d\n", SCA, fired)
if (fired == 1 && firstunfired == 0) {
SCA_t = SCA
SCA = SCA/2
SCA_b = SCA
firstfired = 1
fired = 0
} else if (fired == 1 && firstunfired == 1) {
SCA_t = SCA
SCA = (SCA_t + SCA_b)/2
firstfired = 1
fired = 0
} else if (fired == 0 && firstfired == 0) {
SCA_b = SCA
SCA = SCA*2
SCA_t = SCA
firstunfired = 1
} else if (fired == 0 && firstfired == 1) {
SCA_b = SCA
SCA = (SCA_t + SCA_b)/2
firstunfired = 1
}
} else {
break
}
}
savSCA.close()
}

57
exportLocs_seg.hoc Normal file
View File

@ -0,0 +1,57 @@
// Modified by Zhen Qi
// Export node positions
strdef s
proc exportLocs_seg(){ localobj savLocs, savDiam, sref
// all segment locs
neuron_section_size = 0
savLocs = new File()
sprint(s,"locs_all_seg.txt")
savLocs.wopen(s)
forall{ // loop over all sections
sref = new SectionRef()
if (!sref.has_parent) { // check if root section
for (x,0) { // loop over all segments in that section
if (x == 1/(2*nseg)) { // the first segment of the root section
savLocs.printf("%.4f %.4f %.4f nan nan nan\n", x_xtra(x), y_xtra(x), z_xtra(x))
} else {
savLocs.printf("%.4f %.4f %.4f %.4f %.4f %.4f\n", x_xtra(x), y_xtra(x), z_xtra(x), x_xtra(x-1/nseg), y_xtra(x-1/nseg), z_xtra(x-1/nseg))
}
}
} else if (sref.has_trueparent) {
for (x,0) { // loop over all segments in that section
if (x == 1/(2*nseg)) { // if the first segment, the parent segment is the last segment of the parent section
savLocs.printf("%.4f %.4f %.4f ", x_xtra(x), y_xtra(x), z_xtra(x))
sref.parent { savLocs.printf("%.4f %.4f %.4f \n", x_xtra(1-1/(2*nseg)), y_xtra(1-1/(2*nseg)), z_xtra(1-1/(2*nseg))) }
} else {
savLocs.printf("%.4f %.4f %.4f %.4f %.4f %.4f\n", x_xtra(x), y_xtra(x), z_xtra(x), x_xtra(x-1/nseg), y_xtra(x-1/nseg), z_xtra(x-1/nseg))
}
}
} else {
for (x,0) { // loop over all segments in that section
if (x == 1/(2*nseg)) { // if the first segment, the parent segment is the last segment of the parent section
savLocs.printf("%.4f %.4f %.4f ", x_xtra(x), y_xtra(x), z_xtra(x))
sref.parent { savLocs.printf("%.4f %.4f %.4f \n", x_xtra(1/(2*nseg)), y_xtra(1/(2*nseg)), z_xtra(1/(2*nseg))) }
} else {
savLocs.printf("%.4f %.4f %.4f %.4f %.4f %.4f\n", x_xtra(x), y_xtra(x), z_xtra(x), x_xtra(x-1/nseg), y_xtra(x-1/nseg), z_xtra(x-1/nseg))
}
}
}
neuron_section_size += 1
}
savLocs.close()
savDiam = new File()
sprint(s,"diam_all.txt")
savDiam.wopen(s)
forall{
sref = new SectionRef()
savDiam.printf("%.4f\n", diam3d(n3d()/2-0.5))
}
savDiam.close()
}

26
flake.lock generated Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1782045664,
"narHash": "sha256-baYJuXwcmKK9kG3jCGCE/58xxBOvfT1nT5Gd+POFOKQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7e6dcb6a0fb4d65c7cb0a9571d02a582b3b87d39",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -37,3 +37,4 @@
}; };
}; };
} }

109
hoc/E_field_params.hoc Normal file
View File

@ -0,0 +1,109 @@
/*
* Create a GUI panel for importing the extracellular potential file
* Written by Sina Shirinpour
* Modified by Zhen Qi
* Modified by Connell Paxton
*/
proc E_field_params(){ localobj pwm, file
pwm = new PWManager()
for jj = 0, pwm.count()-1 {
if (strcmp(pwm.name(jj),"E-field") == 0) {
pwm.close(jj)
break
}
}
file = new File()
getes_realistic($s1)
}
proc getes_realistic() { localobj potentials_file, ex_potential_vec
nseg_total = 0
forall { // Total number of segments
nseg_total += nseg
}
printf("Total: %d\n", nseg_total)
ex_potential_vec = new Vector(nseg_total)
potentials_file = new File()
if(!potentials_file.ropen($s1)){
printf("Extracellular potential file not found!\n")
sred("Press enter to quit", "y", "y")
quit()
}
print "Opened."
ex_potential_vec.scanf(potentials_file)
potentials_file.close()
// (Connell) NOTE: THIS DUPLICATES READINGS AS WE ONLY HAVE 1 POTENTIAL PER
// SWC node, and multiple segments per node.
ii = 0
forall {
for (x,0) {
es_xtra(x) = ex_potential_vec.x[ii]
ii += 1
}
}
printf("%d Extracellular potentials imported\n", ii)
}
// Written by Connell Paxton, to load ptntls 12/25/25 (Merry Christmas!)
objref f
strdef line
// storage
objref sec_closest
sec_closest = nil
closest_x = 0.5
min_dist = 1e9
// helper: squared distance
func dist2() { local dx, dy, dz
dx = $1 - $4
dy = $2 - $5
dz = $3 - $6
return dx*dx + dy*dy + dz*dz
}
// read file
proc load_potential_file() { local x, y, z, v, i, d2
f = new File()
if (!f.ropen($s1)) {
printf("ERROR: cannot open %s\n", $s1)
return
}
while (f.scanf("%g %g %g %g", &x, &y, &z, &v) == 4) {
min_dist = 1e9
sec_closest = nil
forall {
if (n3d() > 0) {
for i = 0, n3d()-1 {
d2 = dist2(x, y, z, x3d(i), y3d(i), z3d(i))
if (d2 < min_dist) {
min_dist = d2
sec_closest = new SectionRef()
sec_closest.sec = sec
closest_x = arc3d(i) / L
}
}
}
}
if (sec_closest != nil) {
sec_closest.sec {
// STORE POTENTIAL HERE
// Example: using extracellular
e_extracellular(closest_x) = v
}
}
}
f.close()
}
load_potential_file("pruned.ptntl")

15
hoc/TMS_sim_simple.hoc Normal file
View File

@ -0,0 +1,15 @@
func TMS_sim_simple(){ localobj nil, detector
axon detector = new NetCon(&v(0.5), nil)
detector.threshold = 0
detector.record("handle()")
init()
tstop = 2
run()
return fired
}
proc handle(){
fired = 1
stoprun = 1
}

View File

@ -0,0 +1,15 @@
func TMS_sim_simple_dend(){ localobj nil, detector
dend detector = new NetCon(&v(0.5), nil)
detector.threshold = 0
detector.record("handle()")
init()
tstop = 2
run()
return fired
}
proc handle(){
fired = 1
stoprun = 1
}

55
hoc/detectFire.hoc Normal file
View File

@ -0,0 +1,55 @@
proc detectFire() { localobj savSCA
printf("detectFire entered\n")
savSCA = new File()
sprint(s,$s1)
savSCA.wopen(s)
fired = 0
firstfired = 0
firstunfired = 0
SCA = -20
SCA_t = SCA
SCA_b = SCA
nt = 100
for it = 1,nt {
printf("%d\n", it)
if (abs(SCA_t - SCA_b) >= 1e-2 || it == 1) {
setstim(DEL, DUR, SCA) // In stim.hoc
printf("Stim is set\n")
TMS_sim_simple()
printf("SCA = %f\tfired = %d\n", SCA, fired)
savSCA.printf("SCA = %f\tfired = %d\n", SCA, fired)
if (fired == 1 && firstunfired == 0) {
SCA_t = SCA
SCA = SCA/2
SCA_b = SCA
firstfired = 1
fired = 0
} else if (fired == 1 && firstunfired == 1) {
SCA_t = SCA
SCA = (SCA_t + SCA_b)/2
firstfired = 1
fired = 0
} else if (fired == 0 && firstfired == 0) {
SCA_b = SCA
SCA = SCA*2
SCA_t = SCA
firstunfired = 1
} else if (fired == 0 && firstfired == 1) {
SCA_b = SCA
SCA = (SCA_t + SCA_b)/2
firstunfired = 1
}
} else {
break
}
}
savSCA.close()
}

0
hoc/diam_all.txt Normal file
View File

54
hoc/exportLocs_seg.hoc Normal file
View File

@ -0,0 +1,54 @@
strdef s
proc exportLocs_seg(){ localobj savLocs, savDiam, sref
// all segment locs
neuron_section_size = 0
savLocs = new File()
sprint(s,"locs_all_seg.txt")
savLocs.wopen(s)
forall{ // loop over all sections
sref = new SectionRef()
if (!sref.has_parent) { // check if root section
for (x,0) { // loop over all segments in that section
if (x == 1/(2*nseg)) { // the first segment of the root section
savLocs.printf("%.4f %.4f %.4f nan nan nan\n", x_xtra(x), y_xtra(x), z_xtra(x))
} else {
savLocs.printf("%.4f %.4f %.4f %.4f %.4f %.4f\n", x_xtra(x), y_xtra(x), z_xtra(x), x_xtra(x-1/nseg), y_xtra(x-1/nseg), z_xtra(x-1/nseg))
}
}
} else if (sref.has_trueparent) {
for (x,0) { // loop over all segments in that section
if (x == 1/(2*nseg)) { // if the first segment, the parent segment is the last segment of the parent section
savLocs.printf("%.4f %.4f %.4f ", x_xtra(x), y_xtra(x), z_xtra(x))
sref.parent { savLocs.printf("%.4f %.4f %.4f \n", x_xtra(1-1/(2*nseg)), y_xtra(1-1/(2*nseg)), z_xtra(1-1/(2*nseg))) }
} else {
savLocs.printf("%.4f %.4f %.4f %.4f %.4f %.4f\n", x_xtra(x), y_xtra(x), z_xtra(x), x_xtra(x-1/nseg), y_xtra(x-1/nseg), z_xtra(x-1/nseg))
}
}
} else {
for (x,0) { // loop over all segments in that section
if (x == 1/(2*nseg)) { // if the first segment, the parent segment is the last segment of the parent section
savLocs.printf("%.4f %.4f %.4f ", x_xtra(x), y_xtra(x), z_xtra(x))
sref.parent { savLocs.printf("%.4f %.4f %.4f \n", x_xtra(1/(2*nseg)), y_xtra(1/(2*nseg)), z_xtra(1/(2*nseg))) }
} else {
savLocs.printf("%.4f %.4f %.4f %.4f %.4f %.4f\n", x_xtra(x), y_xtra(x), z_xtra(x), x_xtra(x-1/nseg), y_xtra(x-1/nseg), z_xtra(x-1/nseg))
}
}
}
neuron_section_size += 1
}
savLocs.close()
savDiam = new File()
sprint(s,"diam_all.txt")
savDiam.wopen(s)
forall{
sref = new SectionRef()
savDiam.printf("%.4f\n", diam3d(n3d()/2-0.5))
}
savDiam.close()
}

10
hoc/importswc.hoc Normal file
View File

@ -0,0 +1,10 @@
objref cell, i3d, null
proc importswc() {
cell = new Import3d_SWC_read()
cell.input("pruned.swc")
i3d = new Import3d_GUI(cell, 0)
i3d.instantiate(null)
}
importswc()

29
hoc/init.hoc Normal file
View File

@ -0,0 +1,29 @@
// $Id: initxstim.hoc,v 1.2 2005/09/10 23:02:15 ted Exp $
// Modified by Zhen Qi
// Calculate transmembrane potential of a cell with extracellular stimulation
begintemplate Location2
public secRef, loc
objref secRef
proc init() {
secRef = new SectionRef()
loc = $1
}
endtemplate Location2
load_file("nrngui.hoc")
load_file("stdlib.hoc")
load_file("import3d.hoc")
load_file("importswc.hoc") // Load topology from a .swc file
load_file("parameters.hoc") // Set up geometry and membrane parameters and mechanisms
load_file("interpxyz.hoc") // Only interpolate sections that have extracellular
load_file("setpointers.hoc") // Automatically call grindaway() in interpxyz.hoc
load_file("exportLocs_seg.hoc") // Export node positions, diameters
print "After any change to cell geometry or nseg, be sure to invoke setpointers()"
parameters() // In parameters.hoc
setpointers() // In setpointers.hoc
exportLocs_seg() // In exportLocs_seg.hoc
quit()

64
hoc/interpxyz.hoc Normal file
View File

@ -0,0 +1,64 @@
// $Id: interpxyz.hoc,v 1.2 2005/09/10 23:02:15 ted Exp $
/* Compute xyz coords of nodes in a model cell
whose topology & geometry are defined by pt3d data.
Expect sections to already exist, and that the xtra mechanism has been inserted
*/
objref xx, yy, zz, length // original data, irregularly spaced
objref xint, yint, zint, range // interpolated data, spaced at regular intervals
proc grindaway() { local ii, nn, kk, xr
forall {
if (ismembrane("xtra")) {
// get the data for the section
nn = n3d()
xx = new Vector(nn)
yy = new Vector(nn)
zz = new Vector(nn)
length = new Vector(nn)
for ii = 0,nn-1 {
xx.x[ii] = x3d(ii)
yy.x[ii] = y3d(ii)
zz.x[ii] = z3d(ii)
length.x[ii] = arc3d(ii)
}
// to use Vector class's .interpolate()
// must first scale the independent variable
// i.e. normalize length along centroid
length.div(length.x[nn-1])
// initialize the destination "independent" vector
range = new Vector(nseg+2)
range.indgen(1/nseg)
range.sub(1/(2*nseg))
range.x[0]=0
range.x[nseg+1]=1
// length contains the normalized distances of the pt3d points
// along the centroid of the section. These are spaced at
// irregular intervals.
// range contains the normalized distances of the nodes along the
// centroid of the section. These are spaced at regular intervals.
// Ready to interpolate.
xint = new Vector(nseg+2)
yint = new Vector(nseg+2)
zint = new Vector(nseg+2)
xint.interpolate(range, length, xx)
yint.interpolate(range, length, yy)
zint.interpolate(range, length, zz)
// for each node, assign the xyz values to x_xtra, y_xtra, z_xtra
// don't bother computing coords of the 0 and 1 ends
// also avoid writing coords of the 1 end into the last internal node's coords
for ii = 1, nseg {
xr = range.x[ii]
x_xtra(xr) = xint.x[ii]
y_xtra(xr) = yint.x[ii]
z_xtra(xr) = zint.x[ii]
}
}
}
}

0
hoc/locs_all_seg.txt Normal file
View File

70
hoc/parameters.hoc Normal file
View File

@ -0,0 +1,70 @@
// Written by Zhen Qi
// Set up geometry and membrane parameters and mechanisms
proc parameters() {
forall {
Ra = 100
insert pas
g_pas = 3e-5
e_pas = -65
insert extracellular
insert xtra
}
forsec "soma" {
cm = 1
insert CaDynamics_E2_soma
insert Ca_HVA_soma
insert Ca_LVAst_soma
insert Ih
insert NaTs2_t_soma
insert SK_E2_soma
insert SKv3_1_soma
}
forsec "axon" {
cm = 1
insert CaDynamics_E2
insert Ca_HVA
insert Ca_LVAst
insert K_Pst
insert K_Tst
insert NaTa_t
insert Nap_Et2
insert SK_E2
insert SKv3_1
}
forsec "dend" {
cm = 2
insert Ih
}
forsec "apic" {
cm = 2
insert Ih
insert Im
insert NaTs2_t_apic
insert SKv3_1_apic
}
// these are reasonable values for most models
freq = 100 // Hz, frequency at which AC length constant will be computed
d_lambda = 0.01
forall {
nseg = int((L/(d_lambda*lambda_f(freq))+0.999)/2)*2 + 1
}
}
begintemplate Location2
public secRef, loc
objref secRef
proc init() {
secRef = new SectionRef()
loc = $1
}
endtemplate Location2
setstim(DEL, DUR, SCA)
detectFire("run.out")
quit()

16
hoc/setpointers.hoc Normal file
View File

@ -0,0 +1,16 @@
// $Id: setpointers.hoc,v 1.4 2008/12/02 22:19:41 ted Exp ted $
// Modified by Zhen Qi
// Set pointers after sections have been created
proc setpointers() { local done
grindaway() // in interpxyz.hoc, determines interpolated node locations
forall {
if (ismembrane("xtra") && ismembrane("extracellular")) {
for (x, 0) {
setpointer ex_xtra(x), e_extracellular(x)
}
}
}
}
parameters()
setpointers()

67
hoc/stim.hoc Normal file
View File

@ -0,0 +1,67 @@
// $Id: stim.hoc,v 1.5 2009/02/24 00:55:27 ted Exp ted $
// Create a rectangular stimulus waveform and set up the Ve scaling
// Modified by Zhen Qi
// default values
DEL = 0 // ms
DUR = 0.1 // ms
SCA = -70 // unitless
// with fixed dt and adaptive integration
objref stim_scale, stim_time
stim_scale = new Vector()
stim_time = new Vector()
proc stim_waveform() {
// this uses interpolated play
// index 0 1 2 3 4 5
// stim vec 0, 0, 1, 1, 0 0
// time vec 0, DEL, DEL, DEL+DUR, DEL+DUR, DEL+DUR+1
// really 0, $1, $1, $1+$2, $1+$2, $1+$2+1
// first the stim vector
stim_scale.resize(6)
stim_scale.fill(0)
stim_scale.x[2]=1
stim_scale.x[3]=1
stim_scale.mul($3)
// now the time vector
stim_time.resize(6)
stim_time.x[1]=$1
stim_time.x[2]=$1
stim_time.x[3]=$1+$2
stim_time.x[4]=$1+$2
stim_time.x[5]=$1+$2+1
}
ATTACHED__ = 0
proc attach_stim() {
// since stim_xtra is GLOBAL, we only need to specify Vector.play()
// for one instance of xtra, i.e. at just one internal node
// of only one section that contains xtra
forall { // check each section to find one that has xtra
if (ATTACHED__ == 0) { // don't bother if stim is already attached to something
if (ismembrane("xtra")) {
stim_scale.play(&stim_xtra, stim_time, 1) // "interpolated" play
ATTACHED__ = 1
}
}
}
}
proc setstim() {
del = $1
dur = $2
sca = $3
stim_waveform(del, dur, sca)
attach_stim()
}
xpanel("Extracellular Stimulus Current", 0)
xvalue("del (ms)", "DEL", 1, "setstim(DEL,DUR,SCA)", 0, 1)
xvalue("dur (ms)", "DUR", 0.1, "setstim(DEL,DUR,SCA)", 0, 1)
xvalue("scale", "SCA", 1, "setstim(DEL,DUR,SCA)", 0, 1)
xpanel(0,560)

14038
input.fld Normal file

File diff suppressed because it is too large Load Diff

14037
input.swc Normal file

File diff suppressed because it is too large Load Diff

64
interpxyz.hoc Normal file
View File

@ -0,0 +1,64 @@
// $Id: interpxyz.hoc,v 1.2 2005/09/10 23:02:15 ted Exp $
/* Compute xyz coords of nodes in a model cell
whose topology & geometry are defined by pt3d data.
Expect sections to already exist, and that the xtra mechanism has been inserted
*/
objref xx, yy, zz, length // original data, irregularly spaced
objref xint, yint, zint, range // interpolated data, spaced at regular intervals
proc grindaway() { local ii, nn, kk, xr
forall {
if (ismembrane("xtra")) {
// get the data for the section
nn = n3d()
xx = new Vector(nn)
yy = new Vector(nn)
zz = new Vector(nn)
length = new Vector(nn)
for ii = 0,nn-1 {
xx.x[ii] = x3d(ii)
yy.x[ii] = y3d(ii)
zz.x[ii] = z3d(ii)
length.x[ii] = arc3d(ii)
}
// to use Vector class's .interpolate()
// must first scale the independent variable
// i.e. normalize length along centroid
length.div(length.x[nn-1])
// initialize the destination "independent" vector
range = new Vector(nseg+2)
range.indgen(1/nseg)
range.sub(1/(2*nseg))
range.x[0]=0
range.x[nseg+1]=1
// length contains the normalized distances of the pt3d points
// along the centroid of the section. These are spaced at
// irregular intervals.
// range contains the normalized distances of the nodes along the
// centroid of the section. These are spaced at regular intervals.
// Ready to interpolate.
xint = new Vector(nseg+2)
yint = new Vector(nseg+2)
zint = new Vector(nseg+2)
xint.interpolate(range, length, xx)
yint.interpolate(range, length, yy)
zint.interpolate(range, length, zz)
// for each node, assign the xyz values to x_xtra, y_xtra, z_xtra
// don't bother computing coords of the 0 and 1 ends
// also avoid writing coords of the 1 end into the last internal node's coords
for ii = 1, nseg {
xr = range.x[ii]
x_xtra(xr) = xint.x[ii]
y_xtra(xr) = yint.x[ii]
z_xtra(xr) = zint.x[ii]
}
}
}
}

81
iso.py Normal file
View File

@ -0,0 +1,81 @@
import numpy as np
from swc import read_swc, write_swc
from neuron import h
ptntls = np.loadtxt("neuron_ISO.fld")
neuron = read_swc("input.swc")
coords = neuron['coords'] * 1e-6
ptntl_coords = ptntls[:, :3]
from scipy.spatial import cKDTree
ptntl_tree = cKDTree(ptntl_coords)
# query nearest neighbor for each SWC node
ptntl_idx = ptntl_tree.query(coords, k=1)[1]
ptntls_ordered = ptntls[ptntl_idx] * 1e3
flags = [not np.isnan(p[3]) for p in ptntls_ordered]
non_nan = {
'id' : neuron['id'][flags],
'type' : neuron['type'][flags],
'coords' : neuron['coords'][flags],
'radius' : neuron['radius'][flags],
'parent' : neuron['parent'][flags]
}
write_swc("pruned.swc", non_nan)
ptntls_reduce = ptntls_ordered[flags]
# load preamble
h.load_file("import3d.hoc")
imp = h.Import3d_SWC_read()
imp.input("pruned.swc")
gui = h.Import3d_GUI(imp)
gui.instantiate(None)
h.load_file("parameters.hoc")
h.load_file("interpxyz.hoc")
h.load_file("setup.hoc")
# insert xtra at each section
for sec in h.allsec():
sec.insert("xtra")
h.load_file("setpointers.hoc")
h('setpointers()')
segs = []
seg_xyz = []
for sec in h.allsec():
for seg in sec:
segs.append(seg)
seg_xyz.append([seg.xtra.x, seg.xtra.y, seg.xtra.z])
seg_xyz = np.array(seg_xyz)
# KD-Tree again to match closest segments
tree = cKDTree(non_nan['coords'])
_, node_idx = tree.query(seg_xyz)
i = 0
for seg, idx in zip(segs, node_idx):
print(i)
i += 1
seg.xtra.es = ptntls_reduce[idx][3]
h.load_file("nrngui.hoc")
h.load_file("stdlib.hoc")
h.load_file("stim.hoc")
h.load_file("exportLocs_seg.hoc")
h.load_file("exportLocs_seg.hoc")
h.load_file("TMS_sim_simple.hoc")
h.load_file("detectFire.hoc")
h.load_file("run.hoc")

51
loadVe_NoChooser.hoc Normal file
View File

@ -0,0 +1,51 @@
/*
* Create a GUI panel for importing the extracellular potential file
* Written by Sina Shirinpour
* Modified by Zhen Qi
* Modified by Connell Paxton
*/
proc E_field_params(){ localobj pwm, file
pwm = new PWManager()
for jj = 0, pwm.count()-1 {
if (strcmp(pwm.name(jj),"E-field") == 0) {
pwm.close(jj)
break
}
}
file = new File()
getes_realistic($s1)
}
proc getes_realistic() { localobj potentials_file, ex_potential_vec
nseg_total = 0
forall { // Total number of segments
nseg_total += nseg
}
printf("Total: %d\n", nseg_total)
ex_potential_vec = new Vector(nseg_total)
potentials_file = new File()
if(!potentials_file.ropen($s1)){
printf("Extracellular potential file not found!\n")
sred("Press enter to quit", "y", "y")
quit()
}
print "Opened."
ex_potential_vec.scanf(potentials_file)
potentials_file.close()
// (Connell) NOTE: THIS DUPLICATES READINGS AS WE ONLY HAVE 1 POTENTIAL PER
// SWC node, and multiple segments per node.
ii = 0
forall {
for (x,0) {
es_xtra(x) = ex_potential_vec.x[ii]
ii += 1
}
}
printf("%d Extracellular potentials imported\n", ii)
}

View File

@ -7,7 +7,7 @@
NEURON { NEURON {
SUFFIX Ca_LVAst SUFFIX Ca_LVAst
USEION ca READ eca WRITE ica USEION ca READ eca WRITE ica
RANGE gCa_LVAstbar, gCa_LVAst, ica, celsius RANGE gCa_LVAstbar, gCa_LVAst, ica
} }
UNITS { UNITS {
@ -18,7 +18,6 @@ UNITS {
PARAMETER { PARAMETER {
gCa_LVAstbar = 0.000007 (S/cm2) gCa_LVAstbar = 0.000007 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {

View File

@ -7,7 +7,7 @@
NEURON { NEURON {
SUFFIX Ca_LVAst_soma SUFFIX Ca_LVAst_soma
USEION ca READ eca WRITE ica USEION ca READ eca WRITE ica
RANGE gCa_LVAstbar, gCa_LVAst, ica, celsius RANGE gCa_LVAstbar, gCa_LVAst, ica
} }
UNITS { UNITS {
@ -18,7 +18,6 @@ UNITS {
PARAMETER { PARAMETER {
gCa_LVAstbar = 0.005592 (S/cm2) gCa_LVAstbar = 0.005592 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -26,6 +25,7 @@ ASSIGNED {
eca (mV) eca (mV)
ica (mA/cm2) ica (mA/cm2)
gCa_LVAst (S/cm2) gCa_LVAst (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
hInf hInf

View File

@ -5,7 +5,7 @@
NEURON { NEURON {
SUFFIX Im SUFFIX Im
USEION k READ ek WRITE ik USEION k READ ek WRITE ik
RANGE gImbar, gIm, ik, celsius RANGE gImbar, gIm, ik
} }
UNITS { UNITS {
@ -16,7 +16,6 @@ UNITS {
PARAMETER { PARAMETER {
gImbar = 0.001000 (S/cm2) gImbar = 0.001000 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -24,6 +23,7 @@ ASSIGNED {
ek (mV) ek (mV)
ik (mA/cm2) ik (mA/cm2)
gIm (S/cm2) gIm (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha

View File

@ -8,7 +8,7 @@
NEURON { NEURON {
SUFFIX K_Pst SUFFIX K_Pst
USEION k READ ek WRITE ik USEION k READ ek WRITE ik
RANGE gK_Pstbar, gK_Pst, ik, celsius RANGE gK_Pstbar, gK_Pst, ik
} }
UNITS { UNITS {
@ -19,7 +19,6 @@ UNITS {
PARAMETER { PARAMETER {
gK_Pstbar = 0.957198 (S/cm2) gK_Pstbar = 0.957198 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {

View File

@ -7,7 +7,7 @@
NEURON { NEURON {
SUFFIX K_Tst SUFFIX K_Tst
USEION k READ ek WRITE ik USEION k READ ek WRITE ik
RANGE gK_Tstbar, gK_Tst, ik, celsius RANGE gK_Tstbar, gK_Tst, ik
} }
UNITS { UNITS {
@ -18,7 +18,6 @@ UNITS {
PARAMETER { PARAMETER {
gK_Tstbar = 0.029456 (S/cm2) gK_Tstbar = 0.029456 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {

View File

@ -4,7 +4,7 @@
NEURON { NEURON {
SUFFIX NaTa_t SUFFIX NaTa_t
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNaTa_tbar, gNaTa_t, ina, celsius RANGE gNaTa_tbar, gNaTa_t, ina
} }
UNITS { UNITS {
@ -15,7 +15,6 @@ UNITS {
PARAMETER { PARAMETER {
gNaTa_tbar = 3.288755 (S/cm2) gNaTa_tbar = 3.288755 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -23,6 +22,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNaTa_t (S/cm2) gNaTa_t (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -77,4 +77,4 @@ PROCEDURE rates(){
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
hInf = hAlpha/(hAlpha + hBeta) hInf = hAlpha/(hAlpha + hBeta)
UNITSON UNITSON
} }

View File

@ -4,7 +4,7 @@
NEURON { NEURON {
SUFFIX NaTa_t_myel SUFFIX NaTa_t_myel
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNaTa_tbar, gNaTa_t, ina, celsius RANGE gNaTa_tbar, gNaTa_t, ina
} }
UNITS { UNITS {
@ -15,7 +15,6 @@ UNITS {
PARAMETER { PARAMETER {
gNaTa_tbar = 6.577510 (S/cm2) gNaTa_tbar = 6.577510 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -23,6 +22,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNaTa_t (S/cm2) gNaTa_t (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -77,4 +77,4 @@ PROCEDURE rates(){
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
hInf = hAlpha/(hAlpha + hBeta) hInf = hAlpha/(hAlpha + hBeta)
UNITSON UNITSON
} }

View File

@ -4,7 +4,7 @@
NEURON { NEURON {
SUFFIX NaTa_t_nor SUFFIX NaTa_t_nor
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNaTa_tbar, gNaTa_t, ina, celsius RANGE gNaTa_tbar, gNaTa_t, ina
} }
UNITS { UNITS {
@ -15,7 +15,6 @@ UNITS {
PARAMETER { PARAMETER {
gNaTa_tbar = 6.577510 (S/cm2) gNaTa_tbar = 6.577510 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -23,6 +22,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNaTa_t (S/cm2) gNaTa_t (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -77,4 +77,4 @@ PROCEDURE rates(){
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
hInf = hAlpha/(hAlpha + hBeta) hInf = hAlpha/(hAlpha + hBeta)
UNITSON UNITSON
} }

View File

@ -5,7 +5,7 @@
NEURON { NEURON {
SUFFIX NaTs2_t SUFFIX NaTs2_t
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNaTs2_tbar, gNaTs2_t, ina, celsius RANGE gNaTs2_tbar, gNaTs2_t, ina
} }
UNITS { UNITS {
@ -16,7 +16,6 @@ UNITS {
PARAMETER { PARAMETER {
gNaTs2_tbar = 0.00001 (S/cm2) gNaTs2_tbar = 0.00001 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -24,6 +23,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNaTs2_t (S/cm2) gNaTs2_t (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -77,4 +77,4 @@ PROCEDURE rates(){
hInf = hAlpha/(hAlpha + hBeta) hInf = hAlpha/(hAlpha + hBeta)
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
UNITSON UNITSON
} }

View File

@ -5,7 +5,7 @@
NEURON { NEURON {
SUFFIX NaTs2_t_apic SUFFIX NaTs2_t_apic
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNaTs2_tbar, gNaTs2_t, ina, celsius RANGE gNaTs2_tbar, gNaTs2_t, ina
} }
UNITS { UNITS {
@ -16,7 +16,6 @@ UNITS {
PARAMETER { PARAMETER {
gNaTs2_tbar = 0.025690 (S/cm2) gNaTs2_tbar = 0.025690 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -24,6 +23,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNaTs2_t (S/cm2) gNaTs2_t (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -77,4 +77,4 @@ PROCEDURE rates(){
hInf = hAlpha/(hAlpha + hBeta) hInf = hAlpha/(hAlpha + hBeta)
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
UNITSON UNITSON
} }

View File

@ -5,7 +5,7 @@
NEURON { NEURON {
SUFFIX NaTs2_t_soma SUFFIX NaTs2_t_soma
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNaTs2_tbar, gNaTs2_t, ina, celsius RANGE gNaTs2_tbar, gNaTs2_t, ina
} }
UNITS { UNITS {
@ -16,7 +16,6 @@ UNITS {
PARAMETER { PARAMETER {
gNaTs2_tbar = 0.976885 (S/cm2) gNaTs2_tbar = 0.976885 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -24,6 +23,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNaTs2_t (S/cm2) gNaTs2_t (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -77,4 +77,4 @@ PROCEDURE rates(){
hInf = hAlpha/(hAlpha + hBeta) hInf = hAlpha/(hAlpha + hBeta)
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
UNITSON UNITSON
} }

View File

@ -7,7 +7,7 @@
NEURON { NEURON {
SUFFIX Nap_Et2 SUFFIX Nap_Et2
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
RANGE gNap_Et2bar, gNap_Et2, ina, celsius RANGE gNap_Et2bar, gNap_Et2, ina
} }
UNITS { UNITS {
@ -18,7 +18,6 @@ UNITS {
PARAMETER { PARAMETER {
gNap_Et2bar = 0.000671 (S/cm2) gNap_Et2bar = 0.000671 (S/cm2)
celsius = 35
} }
ASSIGNED { ASSIGNED {
@ -26,6 +25,7 @@ ASSIGNED {
ena (mV) ena (mV)
ina (mA/cm2) ina (mA/cm2)
gNap_Et2 (S/cm2) gNap_Et2 (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
mAlpha mAlpha
@ -83,4 +83,4 @@ PROCEDURE rates(){
hBeta = 6.94e-6 * (v + 64.4) / (1 - exp(-(v + 64.4)/2.63)) hBeta = 6.94e-6 * (v + 64.4) / (1 - exp(-(v + 64.4)/2.63))
hTau = (1/(hAlpha + hBeta))/qt hTau = (1/(hAlpha + hBeta))/qt
UNITSON UNITSON
} }

View File

@ -27,6 +27,7 @@ ASSIGNED {
zInf zInf
ik (mA/cm2) ik (mA/cm2)
gSK_E2 (S/cm2) gSK_E2 (S/cm2)
celsius (degC)
} }
STATE { STATE {

View File

@ -27,6 +27,7 @@ ASSIGNED {
zInf zInf
ik (mA/cm2) ik (mA/cm2)
gSK_E2 (S/cm2) gSK_E2 (S/cm2)
celsius (degC)
} }
STATE { STATE {

View File

@ -22,6 +22,7 @@ ASSIGNED {
ek (mV) ek (mV)
ik (mA/cm2) ik (mA/cm2)
gSKv3_1 (S/cm2) gSKv3_1 (S/cm2)
celsius (degC)
mInf mInf
mTau mTau
} }

View File

@ -17,7 +17,7 @@ NEURON {
USEION na READ ena WRITE ina USEION na READ ena WRITE ina
USEION k READ ek WRITE ik USEION k READ ek WRITE ik
NONSPECIFIC_CURRENT il NONSPECIFIC_CURRENT il
RANGE gnabar, gkbar, gl, el, gna, gk, celsius RANGE gnabar, gkbar, gl, el, gna, gk
} }
UNITS { UNITS {
@ -31,7 +31,6 @@ PARAMETER {
gkbar = .036 (S/cm2) <0,1e9> gkbar = .036 (S/cm2) <0,1e9>
gl = .0003 (S/cm2) <0,1e9> gl = .0003 (S/cm2) <0,1e9>
el = -54.3 (mV) el = -54.3 (mV)
celsius = 29 (degC)
} }
ASSIGNED { ASSIGNED {
@ -45,6 +44,7 @@ ASSIGNED {
il (mA/cm2) il (mA/cm2)
minf hinf ninf minf hinf ninf
mtau (ms) htau (ms) ntau (ms) mtau (ms) htau (ms) ntau (ms)
celsius (degC)
} }
STATE { STATE {

643
mech/x86_64/Ca.cpp Normal file
View File

@ -0,0 +1,643 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gCabar _ml->template fpfield<0>(_iml)
#define gCabar_columnindex 0
#define ica _ml->template fpfield<1>(_iml)
#define ica_columnindex 1
#define gCa _ml->template fpfield<2>(_iml)
#define gCa_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define eca _ml->template fpfield<5>(_iml)
#define eca_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_eca *(_ml->dptr_field<0>(_iml))
#define _p_ion_eca static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ica *(_ml->dptr_field<1>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dicadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Ca", _hoc_setdata},
{"rates_Ca", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
1e-05, /* gCabar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gCabar = _parm_default[0]; /* 1e-05 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* eca */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dicadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gCabar"} /* 0 */,
_nrn_mechanism_field<double>{"ica"} /* 1 */,
_nrn_mechanism_field<double>{"gCa"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"eca"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_eca", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dicadv", "ca_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
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 /home/qh4os/neurenv/mech/Ca.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
eca = _ion_eca;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ double _v) {
double _current=0.; v=_v;
{ {
gCa = gCabar * m * m * h ;
ica = gCa * ( v - eca ) ;
}
_current += ica;
} return _current;
}
static void nrn_cur(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
eca = _ion_eca;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dica;
_dica = ica;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dicadv += (_dica - ica)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ica += ica ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
eca = _ion_eca;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Ca.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Ca.o Normal file

Binary file not shown.

View File

@ -0,0 +1,525 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 5;
static constexpr auto number_of_floating_point_variables = 9;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gamma _ml->template fpfield<0>(_iml)
#define gamma_columnindex 0
#define decay _ml->template fpfield<1>(_iml)
#define decay_columnindex 1
#define depth _ml->template fpfield<2>(_iml)
#define depth_columnindex 2
#define minCai _ml->template fpfield<3>(_iml)
#define minCai_columnindex 3
#define ica _ml->template fpfield<4>(_iml)
#define ica_columnindex 4
#define cai _ml->template fpfield<5>(_iml)
#define cai_columnindex 5
#define Dcai _ml->template fpfield<6>(_iml)
#define Dcai_columnindex 6
#define v _ml->template fpfield<7>(_iml)
#define v_columnindex 7
#define _g _ml->template fpfield<8>(_iml)
#define _g_columnindex 8
#define _ion_ica *(_ml->dptr_field<0>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_cao *(_ml->dptr_field<1>(_iml))
#define _p_ion_cao static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_cai *(_ml->dptr_field<2>(_iml))
#define _p_ion_cai static_cast<neuron::container::data_handle<double>>(_ppvar[2])
#define _ion_ca_erev *_ml->dptr_field<3>(_iml)
#define _style_ca *_ppvar[4].get<int*>()
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* external NEURON variables */
/* declaration of user functions */
static int _mechtype;
extern void _nrn_cacheloop_reg(int, int);
extern void hoc_register_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_CaDynamics_E2", _hoc_setdata},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static NPyDirectMechFunc npy_direct_func_proc[] = {
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[5].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.001734, /* gamma */
103.091, /* decay */
0.1, /* depth */
0.0001, /* minCai */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 6, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 9);
/*initialize range parameters*/
gamma = _parm_default[0]; /* 0.001734 */
decay = _parm_default[1]; /* 103.091 */
depth = _parm_default[2]; /* 0.1 */
minCai = _parm_default[3]; /* 0.0001 */
assert(_nrn_mechanism_get_num_vars(_prop) == 9);
_nrn_mechanism_access_dparam(_prop) = _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] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 2); /* cao */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 1); /* cai */
_ppvar[3] = _nrn_mechanism_get_param_handle(prop_ion, 0); // erev ca
_ppvar[4] = {neuron::container::do_not_search, &(_nrn_mechanism_access_dparam(prop_ion)[0].literal_value<int>())}; /* iontype for ca */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gamma"} /* 0 */,
_nrn_mechanism_field<double>{"decay"} /* 1 */,
_nrn_mechanism_field<double>{"depth"} /* 2 */,
_nrn_mechanism_field<double>{"minCai"} /* 3 */,
_nrn_mechanism_field<double>{"ica"} /* 4 */,
_nrn_mechanism_field<double>{"cai"} /* 5 */,
_nrn_mechanism_field<double>{"Dcai"} /* 6 */,
_nrn_mechanism_field<double>{"v"} /* 7 */,
_nrn_mechanism_field<double>{"_g"} /* 8 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_cao", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_cai", "ca_ion"} /* 2 */,
_nrn_mechanism_field<double*>{"_ion_ca_erev", "ca_ion"} /* 3 */,
_nrn_mechanism_field<int*>{"_style_ca", "#ca_ion"} /* 4 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 5 */);
hoc_register_prop_size(_mechtype, 9, 6);
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, "ca_ion");
hoc_register_dparam_semantics(_mechtype, 4, "#ca_ion");
hoc_register_dparam_semantics(_mechtype, 5, "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 /home/qh4os/neurenv/mech/CaDynamics_E2.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static double FARADAY = 0x1.78e555060882cp+16;
static int _reset;
static const 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(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
Dcai = - ( 10000.0 ) * ( ica * gamma / ( 2.0 * FARADAY * depth ) ) - ( cai - minCai ) / decay ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
Dcai = Dcai / (1. - dt*( ( - ( ( 1.0 ) ) / decay ) )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ica = _ion_ica;
cai = _ion_cai;
_ode_spec1 (_threadargs_);
_ion_cai = cai;
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
_pv[0] = _p_ion_cai;
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ica = _ion_ica;
cai = _ion_cai;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ica = _ion_ica;
cai = _ion_cai;
initmodel(_threadargs_);
_ion_cai = cai;
nrn_wrote_conc(_ca_sym, _ion_ca_erev, _ion_cai, _ion_cao, _style_ca);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ double _v) {
double _current=0.; v=_v;
{
} return _current;
}
static void nrn_cur(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ica = _ion_ica;
cai = _ion_cai;
{ states(_threadargs_);
} {
}
_ion_cai = cai;
}}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {cai_columnindex, 0}; _dlist1[0] = {Dcai_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/CaDynamics_E2.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/CaDynamics_E2.o Normal file

Binary file not shown.

View File

@ -0,0 +1,525 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 5;
static constexpr auto number_of_floating_point_variables = 9;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gamma _ml->template fpfield<0>(_iml)
#define gamma_columnindex 0
#define decay _ml->template fpfield<1>(_iml)
#define decay_columnindex 1
#define depth _ml->template fpfield<2>(_iml)
#define depth_columnindex 2
#define minCai _ml->template fpfield<3>(_iml)
#define minCai_columnindex 3
#define ica _ml->template fpfield<4>(_iml)
#define ica_columnindex 4
#define cai _ml->template fpfield<5>(_iml)
#define cai_columnindex 5
#define Dcai _ml->template fpfield<6>(_iml)
#define Dcai_columnindex 6
#define v _ml->template fpfield<7>(_iml)
#define v_columnindex 7
#define _g _ml->template fpfield<8>(_iml)
#define _g_columnindex 8
#define _ion_ica *(_ml->dptr_field<0>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_cao *(_ml->dptr_field<1>(_iml))
#define _p_ion_cao static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_cai *(_ml->dptr_field<2>(_iml))
#define _p_ion_cai static_cast<neuron::container::data_handle<double>>(_ppvar[2])
#define _ion_ca_erev *_ml->dptr_field<3>(_iml)
#define _style_ca *_ppvar[4].get<int*>()
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* external NEURON variables */
/* declaration of user functions */
static int _mechtype;
extern void _nrn_cacheloop_reg(int, int);
extern void hoc_register_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_CaDynamics_E2_soma", _hoc_setdata},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static NPyDirectMechFunc npy_direct_func_proc[] = {
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[5].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.000996, /* gamma */
873.499, /* decay */
0.1, /* depth */
0.0001, /* minCai */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 6, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 9);
/*initialize range parameters*/
gamma = _parm_default[0]; /* 0.000996 */
decay = _parm_default[1]; /* 873.499 */
depth = _parm_default[2]; /* 0.1 */
minCai = _parm_default[3]; /* 0.0001 */
assert(_nrn_mechanism_get_num_vars(_prop) == 9);
_nrn_mechanism_access_dparam(_prop) = _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] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 2); /* cao */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 1); /* cai */
_ppvar[3] = _nrn_mechanism_get_param_handle(prop_ion, 0); // erev ca
_ppvar[4] = {neuron::container::do_not_search, &(_nrn_mechanism_access_dparam(prop_ion)[0].literal_value<int>())}; /* iontype for ca */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gamma"} /* 0 */,
_nrn_mechanism_field<double>{"decay"} /* 1 */,
_nrn_mechanism_field<double>{"depth"} /* 2 */,
_nrn_mechanism_field<double>{"minCai"} /* 3 */,
_nrn_mechanism_field<double>{"ica"} /* 4 */,
_nrn_mechanism_field<double>{"cai"} /* 5 */,
_nrn_mechanism_field<double>{"Dcai"} /* 6 */,
_nrn_mechanism_field<double>{"v"} /* 7 */,
_nrn_mechanism_field<double>{"_g"} /* 8 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_cao", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_cai", "ca_ion"} /* 2 */,
_nrn_mechanism_field<double*>{"_ion_ca_erev", "ca_ion"} /* 3 */,
_nrn_mechanism_field<int*>{"_style_ca", "#ca_ion"} /* 4 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 5 */);
hoc_register_prop_size(_mechtype, 9, 6);
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, "ca_ion");
hoc_register_dparam_semantics(_mechtype, 4, "#ca_ion");
hoc_register_dparam_semantics(_mechtype, 5, "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 /home/qh4os/neurenv/mech/CaDynamics_E2_soma.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static double FARADAY = 0x1.78e555060882cp+16;
static int _reset;
static const 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(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
Dcai = - ( 10000.0 ) * ( ica * gamma / ( 2.0 * FARADAY * depth ) ) - ( cai - minCai ) / decay ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
Dcai = Dcai / (1. - dt*( ( - ( ( 1.0 ) ) / decay ) )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ica = _ion_ica;
cai = _ion_cai;
_ode_spec1 (_threadargs_);
_ion_cai = cai;
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
_pv[0] = _p_ion_cai;
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ica = _ion_ica;
cai = _ion_cai;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ica = _ion_ica;
cai = _ion_cai;
initmodel(_threadargs_);
_ion_cai = cai;
nrn_wrote_conc(_ca_sym, _ion_ca_erev, _ion_cai, _ion_cao, _style_ca);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ double _v) {
double _current=0.; v=_v;
{
} return _current;
}
static void nrn_cur(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ica = _ion_ica;
cai = _ion_cai;
{ states(_threadargs_);
} {
}
_ion_cai = cai;
}}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {cai_columnindex, 0}; _dlist1[0] = {Dcai_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/CaDynamics_E2_soma.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

Binary file not shown.

641
mech/x86_64/Ca_HVA.cpp Normal file
View File

@ -0,0 +1,641 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gCa_HVAbar _ml->template fpfield<0>(_iml)
#define gCa_HVAbar_columnindex 0
#define ica _ml->template fpfield<1>(_iml)
#define ica_columnindex 1
#define m _ml->template fpfield<2>(_iml)
#define m_columnindex 2
#define h _ml->template fpfield<3>(_iml)
#define h_columnindex 3
#define eca _ml->template fpfield<4>(_iml)
#define eca_columnindex 4
#define gCa _ml->template fpfield<5>(_iml)
#define gCa_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_eca *(_ml->dptr_field<0>(_iml))
#define _p_ion_eca static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ica *(_ml->dptr_field<1>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dicadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Ca_HVA", _hoc_setdata},
{"rates_Ca_HVA", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.000684, /* gCa_HVAbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gCa_HVAbar = _parm_default[0]; /* 0.000684 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* eca */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dicadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gCa_HVAbar"} /* 0 */,
_nrn_mechanism_field<double>{"ica"} /* 1 */,
_nrn_mechanism_field<double>{"m"} /* 2 */,
_nrn_mechanism_field<double>{"h"} /* 3 */,
_nrn_mechanism_field<double>{"eca"} /* 4 */,
_nrn_mechanism_field<double>{"gCa"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_eca", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dicadv", "ca_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
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 /home/qh4os/neurenv/mech/Ca_HVA.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
eca = _ion_eca;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
eca = _ion_eca;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dica;
_dica = ica;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dicadv += (_dica - ica)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ica += ica ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
eca = _ion_eca;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Ca_HVA.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Ca_HVA.o Normal file

Binary file not shown.

641
mech/x86_64/Ca_HVA_soma.cpp Normal file
View File

@ -0,0 +1,641 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gCa_HVAbar _ml->template fpfield<0>(_iml)
#define gCa_HVAbar_columnindex 0
#define ica _ml->template fpfield<1>(_iml)
#define ica_columnindex 1
#define m _ml->template fpfield<2>(_iml)
#define m_columnindex 2
#define h _ml->template fpfield<3>(_iml)
#define h_columnindex 3
#define eca _ml->template fpfield<4>(_iml)
#define eca_columnindex 4
#define gCa _ml->template fpfield<5>(_iml)
#define gCa_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_eca *(_ml->dptr_field<0>(_iml))
#define _p_ion_eca static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ica *(_ml->dptr_field<1>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dicadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Ca_HVA_soma", _hoc_setdata},
{"rates_Ca_HVA_soma", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.000459, /* gCa_HVAbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gCa_HVAbar = _parm_default[0]; /* 0.000459 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* eca */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dicadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gCa_HVAbar"} /* 0 */,
_nrn_mechanism_field<double>{"ica"} /* 1 */,
_nrn_mechanism_field<double>{"m"} /* 2 */,
_nrn_mechanism_field<double>{"h"} /* 3 */,
_nrn_mechanism_field<double>{"eca"} /* 4 */,
_nrn_mechanism_field<double>{"gCa"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_eca", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dicadv", "ca_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
eca = _ion_eca;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
eca = _ion_eca;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dica;
_dica = ica;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dicadv += (_dica - ica)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ica += ica ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
eca = _ion_eca;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Ca_HVA_soma.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Ca_HVA_soma.o Normal file

Binary file not shown.

625
mech/x86_64/Ca_LVAst.cpp Normal file
View File

@ -0,0 +1,625 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 14;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gCa_LVAstbar _ml->template fpfield<0>(_iml)
#define gCa_LVAstbar_columnindex 0
#define ica _ml->template fpfield<1>(_iml)
#define ica_columnindex 1
#define gCa_LVAst _ml->template fpfield<2>(_iml)
#define gCa_LVAst_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define eca _ml->template fpfield<5>(_iml)
#define eca_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define hInf _ml->template fpfield<8>(_iml)
#define hInf_columnindex 8
#define hTau _ml->template fpfield<9>(_iml)
#define hTau_columnindex 9
#define Dm _ml->template fpfield<10>(_iml)
#define Dm_columnindex 10
#define Dh _ml->template fpfield<11>(_iml)
#define Dh_columnindex 11
#define v _ml->template fpfield<12>(_iml)
#define v_columnindex 12
#define _g _ml->template fpfield<13>(_iml)
#define _g_columnindex 13
#define _ion_eca *(_ml->dptr_field<0>(_iml))
#define _p_ion_eca static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ica *(_ml->dptr_field<1>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dicadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Ca_LVAst", _hoc_setdata},
{"rates_Ca_LVAst", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"ica_Ca_LVAst",
"gCa_LVAst_Ca_LVAst",
0,
"m_Ca_LVAst",
"h_Ca_LVAst",
0,
0};
static Symbol* _ca_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
7e-06, /* gCa_LVAstbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
/*initialize range parameters*/
gCa_LVAstbar = _parm_default[0]; /* 7e-06 */
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* eca */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dicadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gCa_LVAstbar"} /* 0 */,
_nrn_mechanism_field<double>{"ica"} /* 1 */,
_nrn_mechanism_field<double>{"gCa_LVAst"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"eca"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"hInf"} /* 8 */,
_nrn_mechanism_field<double>{"hTau"} /* 9 */,
_nrn_mechanism_field<double>{"Dm"} /* 10 */,
_nrn_mechanism_field<double>{"Dh"} /* 11 */,
_nrn_mechanism_field<double>{"v"} /* 12 */,
_nrn_mechanism_field<double>{"_g"} /* 13 */,
_nrn_mechanism_field<double*>{"_ion_eca", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dicadv", "ca_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 14, 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 /home/qh4os/neurenv/mech/Ca_LVAst.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
eca = _ion_eca;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
eca = _ion_eca;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dica;
_dica = ica;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dicadv += (_dica - ica)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ica += ica ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
eca = _ion_eca;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Ca_LVAst.mod";
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\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"
"}\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Ca_LVAst.o Normal file

Binary file not shown.

View File

@ -0,0 +1,626 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 14;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gCa_LVAstbar _ml->template fpfield<0>(_iml)
#define gCa_LVAstbar_columnindex 0
#define ica _ml->template fpfield<1>(_iml)
#define ica_columnindex 1
#define gCa_LVAst _ml->template fpfield<2>(_iml)
#define gCa_LVAst_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define eca _ml->template fpfield<5>(_iml)
#define eca_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define hInf _ml->template fpfield<8>(_iml)
#define hInf_columnindex 8
#define hTau _ml->template fpfield<9>(_iml)
#define hTau_columnindex 9
#define Dm _ml->template fpfield<10>(_iml)
#define Dm_columnindex 10
#define Dh _ml->template fpfield<11>(_iml)
#define Dh_columnindex 11
#define v _ml->template fpfield<12>(_iml)
#define v_columnindex 12
#define _g _ml->template fpfield<13>(_iml)
#define _g_columnindex 13
#define _ion_eca *(_ml->dptr_field<0>(_iml))
#define _p_ion_eca static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ica *(_ml->dptr_field<1>(_iml))
#define _p_ion_ica static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dicadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Ca_LVAst_soma", _hoc_setdata},
{"rates_Ca_LVAst_soma", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.005592, /* gCa_LVAstbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
/*initialize range parameters*/
gCa_LVAstbar = _parm_default[0]; /* 0.005592 */
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* eca */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ica */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dicadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gCa_LVAstbar"} /* 0 */,
_nrn_mechanism_field<double>{"ica"} /* 1 */,
_nrn_mechanism_field<double>{"gCa_LVAst"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"eca"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"hInf"} /* 8 */,
_nrn_mechanism_field<double>{"hTau"} /* 9 */,
_nrn_mechanism_field<double>{"Dm"} /* 10 */,
_nrn_mechanism_field<double>{"Dh"} /* 11 */,
_nrn_mechanism_field<double>{"v"} /* 12 */,
_nrn_mechanism_field<double>{"_g"} /* 13 */,
_nrn_mechanism_field<double*>{"_ion_eca", "ca_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ica", "ca_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dicadv", "ca_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 14, 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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
eca = _ion_eca;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
eca = _ion_eca;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
eca = _ion_eca;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dica;
_dica = ica;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dicadv += (_dica - ica)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ica += ica ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
eca = _ion_eca;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Ca_LVAst_soma.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" eca (mV)\n"
" ica (mA/cm2)\n"
" gCa_LVAst (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Ca_LVAst_soma.o Normal file

Binary file not shown.

575
mech/x86_64/Ih.cpp Normal file
View File

@ -0,0 +1,575 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 0;
static constexpr auto number_of_floating_point_variables = 11;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gIhbar _ml->template fpfield<0>(_iml)
#define gIhbar_columnindex 0
#define ihcn _ml->template fpfield<1>(_iml)
#define ihcn_columnindex 1
#define gIh _ml->template fpfield<2>(_iml)
#define gIh_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define mInf _ml->template fpfield<4>(_iml)
#define mInf_columnindex 4
#define mTau _ml->template fpfield<5>(_iml)
#define mTau_columnindex 5
#define mAlpha _ml->template fpfield<6>(_iml)
#define mAlpha_columnindex 6
#define mBeta _ml->template fpfield<7>(_iml)
#define mBeta_columnindex 7
#define Dm _ml->template fpfield<8>(_iml)
#define Dm_columnindex 8
#define v _ml->template fpfield<9>(_iml)
#define v_columnindex 9
#define _g _ml->template fpfield<10>(_iml)
#define _g_columnindex 10
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Ih", _hoc_setdata},
{"rates_Ih", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
#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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[0].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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};
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
8e-05, /* gIhbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 1, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 11);
/*initialize range parameters*/
gIhbar = _parm_default[0]; /* 8e-05 */
assert(_nrn_mechanism_get_num_vars(_prop) == 11);
_nrn_mechanism_access_dparam(_prop) = _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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gIhbar"} /* 0 */,
_nrn_mechanism_field<double>{"ihcn"} /* 1 */,
_nrn_mechanism_field<double>{"gIh"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"mInf"} /* 4 */,
_nrn_mechanism_field<double>{"mTau"} /* 5 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 6 */,
_nrn_mechanism_field<double>{"mBeta"} /* 7 */,
_nrn_mechanism_field<double>{"Dm"} /* 8 */,
_nrn_mechanism_field<double>{"v"} /* 9 */,
_nrn_mechanism_field<double>{"_g"} /* 10 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 0 */);
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 /home/qh4os/neurenv/mech/Ih.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargs_ ) ;
m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ;
}
return 0;
}
static int rates ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ double _v) {
double _current=0.; v=_v;
{ {
gIh = gIhbar * m ;
ihcn = gIh * ( v - ehcn ) ;
}
_current += ihcn;
} return _current;
}
static void nrn_cur(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ _rhs = _nrn_current(_threadargscomma_ _v);
}
_g = (_g_local - _rhs)/.001;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
{ states(_threadargs_);
}}}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Ih.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Ih.o Normal file

Binary file not shown.

603
mech/x86_64/Im.cpp Normal file
View File

@ -0,0 +1,603 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 12;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gImbar _ml->template fpfield<0>(_iml)
#define gImbar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gIm _ml->template fpfield<2>(_iml)
#define gIm_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define ek _ml->template fpfield<4>(_iml)
#define ek_columnindex 4
#define mInf _ml->template fpfield<5>(_iml)
#define mInf_columnindex 5
#define mTau _ml->template fpfield<6>(_iml)
#define mTau_columnindex 6
#define mAlpha _ml->template fpfield<7>(_iml)
#define mAlpha_columnindex 7
#define mBeta _ml->template fpfield<8>(_iml)
#define mBeta_columnindex 8
#define Dm _ml->template fpfield<9>(_iml)
#define Dm_columnindex 9
#define v _ml->template fpfield<10>(_iml)
#define v_columnindex 10
#define _g _ml->template fpfield<11>(_iml)
#define _g_columnindex 11
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Im", _hoc_setdata},
{"rates_Im", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* connect range variables in _p that hoc is supposed to know about */
static const char *_mechanism[] = {
"7.7.0",
"Im",
"gImbar_Im",
0,
"ik_Im",
"gIm_Im",
0,
"m_Im",
0,
0};
static Symbol* _k_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.001, /* gImbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 12);
/*initialize range parameters*/
gImbar = _parm_default[0]; /* 0.001 */
assert(_nrn_mechanism_get_num_vars(_prop) == 12);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gImbar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gIm"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"ek"} /* 4 */,
_nrn_mechanism_field<double>{"mInf"} /* 5 */,
_nrn_mechanism_field<double>{"mTau"} /* 6 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 7 */,
_nrn_mechanism_field<double>{"mBeta"} /* 8 */,
_nrn_mechanism_field<double>{"Dm"} /* 9 */,
_nrn_mechanism_field<double>{"v"} /* 10 */,
_nrn_mechanism_field<double>{"_g"} /* 11 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 12, 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 /home/qh4os/neurenv/mech/Im.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargs_ ) ;
m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ;
}
return 0;
}
static int rates ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ double _v) {
double _current=0.; v=_v;
{ {
gIm = gImbar * m ;
ik = gIm * ( v - ek ) ;
}
_current += ik;
} return _current;
}
static void nrn_cur(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Im.mod";
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\n"
"}\n"
"\n"
"UNITS {\n"
" (S) = (siemens)\n"
" (mV) = (millivolt)\n"
" (mA) = (milliamp)\n"
"}\n"
"\n"
"PARAMETER {\n"
" gImbar = 0.001000 (S/cm2)\n"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ek (mV)\n"
" ik (mA/cm2)\n"
" gIm (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Im.o Normal file

Binary file not shown.

635
mech/x86_64/K_Pst.cpp Normal file
View File

@ -0,0 +1,635 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 14;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gK_Pstbar _ml->template fpfield<0>(_iml)
#define gK_Pstbar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gK_Pst _ml->template fpfield<2>(_iml)
#define gK_Pst_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ek _ml->template fpfield<5>(_iml)
#define ek_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define hInf _ml->template fpfield<8>(_iml)
#define hInf_columnindex 8
#define hTau _ml->template fpfield<9>(_iml)
#define hTau_columnindex 9
#define Dm _ml->template fpfield<10>(_iml)
#define Dm_columnindex 10
#define Dh _ml->template fpfield<11>(_iml)
#define Dh_columnindex 11
#define v _ml->template fpfield<12>(_iml)
#define v_columnindex 12
#define _g _ml->template fpfield<13>(_iml)
#define _g_columnindex 13
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_K_Pst", _hoc_setdata},
{"rates_K_Pst", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"ik_K_Pst",
"gK_Pst_K_Pst",
0,
"m_K_Pst",
"h_K_Pst",
0,
0};
static Symbol* _k_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.957198, /* gK_Pstbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
/*initialize range parameters*/
gK_Pstbar = _parm_default[0]; /* 0.957198 */
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gK_Pstbar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gK_Pst"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ek"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"hInf"} /* 8 */,
_nrn_mechanism_field<double>{"hTau"} /* 9 */,
_nrn_mechanism_field<double>{"Dm"} /* 10 */,
_nrn_mechanism_field<double>{"Dh"} /* 11 */,
_nrn_mechanism_field<double>{"v"} /* 12 */,
_nrn_mechanism_field<double>{"_g"} /* 13 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 14, 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 /home/qh4os/neurenv/mech/K_Pst.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/K_Pst.mod";
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\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"
"}\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/K_Pst.o Normal file

Binary file not shown.

625
mech/x86_64/K_Tst.cpp Normal file
View File

@ -0,0 +1,625 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 14;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gK_Tstbar _ml->template fpfield<0>(_iml)
#define gK_Tstbar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gK_Tst _ml->template fpfield<2>(_iml)
#define gK_Tst_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ek _ml->template fpfield<5>(_iml)
#define ek_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define hInf _ml->template fpfield<8>(_iml)
#define hInf_columnindex 8
#define hTau _ml->template fpfield<9>(_iml)
#define hTau_columnindex 9
#define Dm _ml->template fpfield<10>(_iml)
#define Dm_columnindex 10
#define Dh _ml->template fpfield<11>(_iml)
#define Dh_columnindex 11
#define v _ml->template fpfield<12>(_iml)
#define v_columnindex 12
#define _g _ml->template fpfield<13>(_iml)
#define _g_columnindex 13
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_K_Tst", _hoc_setdata},
{"rates_K_Tst", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"ik_K_Tst",
"gK_Tst_K_Tst",
0,
"m_K_Tst",
"h_K_Tst",
0,
0};
static Symbol* _k_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.029456, /* gK_Tstbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
/*initialize range parameters*/
gK_Tstbar = _parm_default[0]; /* 0.029456 */
assert(_nrn_mechanism_get_num_vars(_prop) == 14);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gK_Tstbar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gK_Tst"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ek"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"hInf"} /* 8 */,
_nrn_mechanism_field<double>{"hTau"} /* 9 */,
_nrn_mechanism_field<double>{"Dm"} /* 10 */,
_nrn_mechanism_field<double>{"Dh"} /* 11 */,
_nrn_mechanism_field<double>{"v"} /* 12 */,
_nrn_mechanism_field<double>{"_g"} /* 13 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 14, 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 /home/qh4os/neurenv/mech/K_Tst.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/K_Tst.mod";
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\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"
"}\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/K_Tst.o Normal file

Binary file not shown.

657
mech/x86_64/NaTa_t.cpp Normal file
View File

@ -0,0 +1,657 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNaTa_tbar _ml->template fpfield<0>(_iml)
#define gNaTa_tbar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNaTa_t _ml->template fpfield<2>(_iml)
#define gNaTa_t_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_NaTa_t", _hoc_setdata},
{"rates_NaTa_t", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"ina_NaTa_t",
"gNaTa_t_NaTa_t",
0,
"m_NaTa_t",
"h_NaTa_t",
0,
0};
static Symbol* _na_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
3.28876, /* gNaTa_tbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNaTa_tbar = _parm_default[0]; /* 3.28876 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNaTa_tbar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNaTa_t"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/neurenv/mech/NaTa_t.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/NaTa_t.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNaTa_t (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/NaTa_t.o Normal file

Binary file not shown.

657
mech/x86_64/NaTa_t_myel.cpp Normal file
View File

@ -0,0 +1,657 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNaTa_tbar _ml->template fpfield<0>(_iml)
#define gNaTa_tbar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNaTa_t _ml->template fpfield<2>(_iml)
#define gNaTa_t_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_NaTa_t_myel", _hoc_setdata},
{"rates_NaTa_t_myel", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
6.57751, /* gNaTa_tbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNaTa_tbar = _parm_default[0]; /* 6.57751 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNaTa_tbar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNaTa_t"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/NaTa_t_myel.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNaTa_t (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/NaTa_t_myel.o Normal file

Binary file not shown.

657
mech/x86_64/NaTa_t_nor.cpp Normal file
View File

@ -0,0 +1,657 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNaTa_tbar _ml->template fpfield<0>(_iml)
#define gNaTa_tbar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNaTa_t _ml->template fpfield<2>(_iml)
#define gNaTa_t_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_NaTa_t_nor", _hoc_setdata},
{"rates_NaTa_t_nor", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
6.57751, /* gNaTa_tbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNaTa_tbar = _parm_default[0]; /* 6.57751 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNaTa_tbar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNaTa_t"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/NaTa_t_nor.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNaTa_t (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/NaTa_t_nor.o Normal file

Binary file not shown.

657
mech/x86_64/NaTs2_t.cpp Normal file
View File

@ -0,0 +1,657 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNaTs2_tbar _ml->template fpfield<0>(_iml)
#define gNaTs2_tbar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNaTs2_t _ml->template fpfield<2>(_iml)
#define gNaTs2_t_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_NaTs2_t", _hoc_setdata},
{"rates_NaTs2_t", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"ina_NaTs2_t",
"gNaTs2_t_NaTs2_t",
0,
"m_NaTs2_t",
"h_NaTs2_t",
0,
0};
static Symbol* _na_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
1e-05, /* gNaTs2_tbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNaTs2_tbar = _parm_default[0]; /* 1e-05 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNaTs2_tbar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNaTs2_t"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/neurenv/mech/NaTs2_t.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/NaTs2_t.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNaTs2_t (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/NaTs2_t.o Normal file

Binary file not shown.

View File

@ -0,0 +1,657 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNaTs2_tbar _ml->template fpfield<0>(_iml)
#define gNaTs2_tbar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNaTs2_t _ml->template fpfield<2>(_iml)
#define gNaTs2_t_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_NaTs2_t_apic", _hoc_setdata},
{"rates_NaTs2_t_apic", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.02569, /* gNaTs2_tbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNaTs2_tbar = _parm_default[0]; /* 0.02569 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNaTs2_tbar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNaTs2_t"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/NaTs2_t_apic.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNaTs2_t (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/NaTs2_t_apic.o Normal file

Binary file not shown.

View File

@ -0,0 +1,657 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNaTs2_tbar _ml->template fpfield<0>(_iml)
#define gNaTs2_tbar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNaTs2_t _ml->template fpfield<2>(_iml)
#define gNaTs2_t_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_NaTs2_t_soma", _hoc_setdata},
{"rates_NaTs2_t_soma", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.976885, /* gNaTs2_tbar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNaTs2_tbar = _parm_default[0]; /* 0.976885 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNaTs2_tbar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNaTs2_t"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/NaTs2_t_soma.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNaTs2_t (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/NaTs2_t_soma.o Normal file

Binary file not shown.

666
mech/x86_64/Nap_Et2.cpp Normal file
View File

@ -0,0 +1,666 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 18;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gNap_Et2bar _ml->template fpfield<0>(_iml)
#define gNap_Et2bar_columnindex 0
#define ina _ml->template fpfield<1>(_iml)
#define ina_columnindex 1
#define gNap_Et2 _ml->template fpfield<2>(_iml)
#define gNap_Et2_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define h _ml->template fpfield<4>(_iml)
#define h_columnindex 4
#define ena _ml->template fpfield<5>(_iml)
#define ena_columnindex 5
#define mInf _ml->template fpfield<6>(_iml)
#define mInf_columnindex 6
#define mTau _ml->template fpfield<7>(_iml)
#define mTau_columnindex 7
#define mAlpha _ml->template fpfield<8>(_iml)
#define mAlpha_columnindex 8
#define mBeta _ml->template fpfield<9>(_iml)
#define mBeta_columnindex 9
#define hInf _ml->template fpfield<10>(_iml)
#define hInf_columnindex 10
#define hTau _ml->template fpfield<11>(_iml)
#define hTau_columnindex 11
#define hAlpha _ml->template fpfield<12>(_iml)
#define hAlpha_columnindex 12
#define hBeta _ml->template fpfield<13>(_iml)
#define hBeta_columnindex 13
#define Dm _ml->template fpfield<14>(_iml)
#define Dm_columnindex 14
#define Dh _ml->template fpfield<15>(_iml)
#define Dh_columnindex 15
#define v _ml->template fpfield<16>(_iml)
#define v_columnindex 16
#define _g _ml->template fpfield<17>(_iml)
#define _g_columnindex 17
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_Nap_Et2", _hoc_setdata},
{"rates_Nap_Et2", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"ina_Nap_Et2",
"gNap_Et2_Nap_Et2",
0,
"m_Nap_Et2",
"h_Nap_Et2",
0,
0};
static Symbol* _na_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.000671, /* gNap_Et2bar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
/*initialize range parameters*/
gNap_Et2bar = _parm_default[0]; /* 0.000671 */
assert(_nrn_mechanism_get_num_vars(_prop) == 18);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gNap_Et2bar"} /* 0 */,
_nrn_mechanism_field<double>{"ina"} /* 1 */,
_nrn_mechanism_field<double>{"gNap_Et2"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"h"} /* 4 */,
_nrn_mechanism_field<double>{"ena"} /* 5 */,
_nrn_mechanism_field<double>{"mInf"} /* 6 */,
_nrn_mechanism_field<double>{"mTau"} /* 7 */,
_nrn_mechanism_field<double>{"mAlpha"} /* 8 */,
_nrn_mechanism_field<double>{"mBeta"} /* 9 */,
_nrn_mechanism_field<double>{"hInf"} /* 10 */,
_nrn_mechanism_field<double>{"hTau"} /* 11 */,
_nrn_mechanism_field<double>{"hAlpha"} /* 12 */,
_nrn_mechanism_field<double>{"hBeta"} /* 13 */,
_nrn_mechanism_field<double>{"Dm"} /* 14 */,
_nrn_mechanism_field<double>{"Dh"} /* 15 */,
_nrn_mechanism_field<double>{"v"} /* 16 */,
_nrn_mechanism_field<double>{"_g"} /* 17 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
hoc_register_prop_size(_mechtype, 18, 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 /home/qh4os/neurenv/mech/Nap_Et2.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[2], _dlist1[2];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
Dh = ( hInf - h ) / hTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
Dh = Dh / (1. - dt*( ( ( ( - 1.0 ) ) ) / hTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
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 ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 2;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 2; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
h = hInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dina;
_dina = ina;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/Nap_Et2.mod";
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\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"
"}\n"
"\n"
"ASSIGNED {\n"
" v (mV)\n"
" ena (mV)\n"
" ina (mA/cm2)\n"
" gNap_Et2 (S/cm2)\n"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/Nap_Et2.o Normal file

Binary file not shown.

615
mech/x86_64/SK_E2.cpp Normal file
View File

@ -0,0 +1,615 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 5;
static constexpr auto number_of_floating_point_variables = 10;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gSK_E2bar _ml->template fpfield<0>(_iml)
#define gSK_E2bar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gSK_E2 _ml->template fpfield<2>(_iml)
#define gSK_E2_columnindex 2
#define z _ml->template fpfield<3>(_iml)
#define z_columnindex 3
#define ek _ml->template fpfield<4>(_iml)
#define ek_columnindex 4
#define cai _ml->template fpfield<5>(_iml)
#define cai_columnindex 5
#define zInf _ml->template fpfield<6>(_iml)
#define zInf_columnindex 6
#define Dz _ml->template fpfield<7>(_iml)
#define Dz_columnindex 7
#define v _ml->template fpfield<8>(_iml)
#define v_columnindex 8
#define _g _ml->template fpfield<9>(_iml)
#define _g_columnindex 9
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
#define _ion_cai *(_ml->dptr_field<3>(_iml))
#define _p_ion_cai static_cast<neuron::container::data_handle<double>>(_ppvar[3])
#define _ion_cao *(_ml->dptr_field<4>(_iml))
#define _p_ion_cao static_cast<neuron::container::data_handle<double>>(_ppvar[4])
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_SK_E2", _hoc_setdata},
{"rates_SK_E2", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
#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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[5].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.098377, /* gSK_E2bar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 6, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
/*initialize range parameters*/
gSK_E2bar = _parm_default[0]; /* 0.098377 */
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 1, 0);
_ppvar[3] = _nrn_mechanism_get_param_handle(prop_ion, 1); /* cai */
_ppvar[4] = _nrn_mechanism_get_param_handle(prop_ion, 2); /* cao */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gSK_E2bar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gSK_E2"} /* 2 */,
_nrn_mechanism_field<double>{"z"} /* 3 */,
_nrn_mechanism_field<double>{"ek"} /* 4 */,
_nrn_mechanism_field<double>{"cai"} /* 5 */,
_nrn_mechanism_field<double>{"zInf"} /* 6 */,
_nrn_mechanism_field<double>{"Dz"} /* 7 */,
_nrn_mechanism_field<double>{"v"} /* 8 */,
_nrn_mechanism_field<double>{"_g"} /* 9 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<double*>{"_ion_cai", "ca_ion"} /* 3 */,
_nrn_mechanism_field<double*>{"_ion_cao", "ca_ion"} /* 4 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 5 */);
hoc_register_prop_size(_mechtype, 10, 6);
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, "ca_ion");
hoc_register_dparam_semantics(_mechtype, 5, "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 /home/qh4os/neurenv/mech/SK_E2.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsprotocomma_ double);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargscomma_ cai ) ;
Dz = ( zInf - z ) / zTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargscomma_ cai ) ;
Dz = Dz / (1. - dt*( ( ( ( - 1.0 ) ) ) / zTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargscomma_ cai ) ;
z = z + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / zTau)))*(- ( ( ( zInf ) ) / zTau ) / ( ( ( ( - 1.0 ) ) ) / zTau ) - z) ;
}
return 0;
}
static int rates ( _internalthreadargsprotocomma_ 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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargscomma_ *getarg(1) );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargscomma_ *getarg(1) );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
cai = _ion_cai;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
cai = _ion_cai;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
z = z0;
{
rates ( _threadargscomma_ cai ) ;
z = zInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
cai = _ion_cai;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
cai = _ion_cai;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
cai = _ion_cai;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {z_columnindex, 0}; _dlist1[0] = {Dz_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/SK_E2.mod";
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"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/SK_E2.o Normal file

Binary file not shown.

615
mech/x86_64/SK_E2_soma.cpp Normal file
View File

@ -0,0 +1,615 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 5;
static constexpr auto number_of_floating_point_variables = 10;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gSK_E2bar _ml->template fpfield<0>(_iml)
#define gSK_E2bar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gSK_E2 _ml->template fpfield<2>(_iml)
#define gSK_E2_columnindex 2
#define z _ml->template fpfield<3>(_iml)
#define z_columnindex 3
#define ek _ml->template fpfield<4>(_iml)
#define ek_columnindex 4
#define cai _ml->template fpfield<5>(_iml)
#define cai_columnindex 5
#define zInf _ml->template fpfield<6>(_iml)
#define zInf_columnindex 6
#define Dz _ml->template fpfield<7>(_iml)
#define Dz_columnindex 7
#define v _ml->template fpfield<8>(_iml)
#define v_columnindex 8
#define _g _ml->template fpfield<9>(_iml)
#define _g_columnindex 9
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
#define _ion_cai *(_ml->dptr_field<3>(_iml))
#define _p_ion_cai static_cast<neuron::container::data_handle<double>>(_ppvar[3])
#define _ion_cao *(_ml->dptr_field<4>(_iml))
#define _p_ion_cao static_cast<neuron::container::data_handle<double>>(_ppvar[4])
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_SK_E2_soma", _hoc_setdata},
{"rates_SK_E2_soma", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
#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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[5].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.003869, /* gSK_E2bar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 6, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
/*initialize range parameters*/
gSK_E2bar = _parm_default[0]; /* 0.003869 */
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
prop_ion = need_memb(_ca_sym);
nrn_promote(prop_ion, 1, 0);
_ppvar[3] = _nrn_mechanism_get_param_handle(prop_ion, 1); /* cai */
_ppvar[4] = _nrn_mechanism_get_param_handle(prop_ion, 2); /* cao */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gSK_E2bar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gSK_E2"} /* 2 */,
_nrn_mechanism_field<double>{"z"} /* 3 */,
_nrn_mechanism_field<double>{"ek"} /* 4 */,
_nrn_mechanism_field<double>{"cai"} /* 5 */,
_nrn_mechanism_field<double>{"zInf"} /* 6 */,
_nrn_mechanism_field<double>{"Dz"} /* 7 */,
_nrn_mechanism_field<double>{"v"} /* 8 */,
_nrn_mechanism_field<double>{"_g"} /* 9 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<double*>{"_ion_cai", "ca_ion"} /* 3 */,
_nrn_mechanism_field<double*>{"_ion_cao", "ca_ion"} /* 4 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 5 */);
hoc_register_prop_size(_mechtype, 10, 6);
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, "ca_ion");
hoc_register_dparam_semantics(_mechtype, 5, "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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsprotocomma_ double);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargscomma_ cai ) ;
Dz = ( zInf - z ) / zTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargscomma_ cai ) ;
Dz = Dz / (1. - dt*( ( ( ( - 1.0 ) ) ) / zTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargscomma_ cai ) ;
z = z + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / zTau)))*(- ( ( ( zInf ) ) / zTau ) / ( ( ( ( - 1.0 ) ) ) / zTau ) - z) ;
}
return 0;
}
static int rates ( _internalthreadargsprotocomma_ 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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargscomma_ *getarg(1) );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargscomma_ *getarg(1) );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
cai = _ion_cai;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
cai = _ion_cai;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
z = z0;
{
rates ( _threadargscomma_ cai ) ;
z = zInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
cai = _ion_cai;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
cai = _ion_cai;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
cai = _ion_cai;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {z_columnindex, 0}; _dlist1[0] = {Dz_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/SK_E2_soma.mod";
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"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/SK_E2_soma.o Normal file

Binary file not shown.

585
mech/x86_64/SKv3_1.cpp Normal file
View File

@ -0,0 +1,585 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 10;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gSKv3_1bar _ml->template fpfield<0>(_iml)
#define gSKv3_1bar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gSKv3_1 _ml->template fpfield<2>(_iml)
#define gSKv3_1_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define ek _ml->template fpfield<4>(_iml)
#define ek_columnindex 4
#define mInf _ml->template fpfield<5>(_iml)
#define mInf_columnindex 5
#define mTau _ml->template fpfield<6>(_iml)
#define mTau_columnindex 6
#define Dm _ml->template fpfield<7>(_iml)
#define Dm_columnindex 7
#define v _ml->template fpfield<8>(_iml)
#define v_columnindex 8
#define _g _ml->template fpfield<9>(_iml)
#define _g_columnindex 9
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_SKv3_1", _hoc_setdata},
{"rates_SKv3_1", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
1.93618, /* gSKv3_1bar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
/*initialize range parameters*/
gSKv3_1bar = _parm_default[0]; /* 1.93618 */
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gSKv3_1bar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gSKv3_1"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"ek"} /* 4 */,
_nrn_mechanism_field<double>{"mInf"} /* 5 */,
_nrn_mechanism_field<double>{"mTau"} /* 6 */,
_nrn_mechanism_field<double>{"Dm"} /* 7 */,
_nrn_mechanism_field<double>{"v"} /* 8 */,
_nrn_mechanism_field<double>{"_g"} /* 9 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
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 /home/qh4os/neurenv/mech/SKv3_1.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargs_ ) ;
m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ;
}
return 0;
}
static int rates ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/SKv3_1.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/SKv3_1.o Normal file

Binary file not shown.

587
mech/x86_64/SKv3_1_apic.cpp Normal file
View File

@ -0,0 +1,587 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 10;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gSKv3_1bar _ml->template fpfield<0>(_iml)
#define gSKv3_1bar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gSKv3_1 _ml->template fpfield<2>(_iml)
#define gSKv3_1_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define ek _ml->template fpfield<4>(_iml)
#define ek_columnindex 4
#define mInf _ml->template fpfield<5>(_iml)
#define mInf_columnindex 5
#define mTau _ml->template fpfield<6>(_iml)
#define mTau_columnindex 6
#define Dm _ml->template fpfield<7>(_iml)
#define Dm_columnindex 7
#define v _ml->template fpfield<8>(_iml)
#define v_columnindex 8
#define _g _ml->template fpfield<9>(_iml)
#define _g_columnindex 9
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_SKv3_1_apic", _hoc_setdata},
{"rates_SKv3_1_apic", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.039763, /* gSKv3_1bar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
/*initialize range parameters*/
gSKv3_1bar = _parm_default[0]; /* 0.039763 */
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gSKv3_1bar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gSKv3_1"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"ek"} /* 4 */,
_nrn_mechanism_field<double>{"mInf"} /* 5 */,
_nrn_mechanism_field<double>{"mTau"} /* 6 */,
_nrn_mechanism_field<double>{"Dm"} /* 7 */,
_nrn_mechanism_field<double>{"v"} /* 8 */,
_nrn_mechanism_field<double>{"_g"} /* 9 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargs_ ) ;
m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ;
}
return 0;
}
static int rates ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/SKv3_1_apic.mod";
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"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/SKv3_1_apic.o Normal file

Binary file not shown.

585
mech/x86_64/SKv3_1_soma.cpp Normal file
View File

@ -0,0 +1,585 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 3;
static constexpr auto number_of_floating_point_variables = 10;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gSKv3_1bar _ml->template fpfield<0>(_iml)
#define gSKv3_1bar_columnindex 0
#define ik _ml->template fpfield<1>(_iml)
#define ik_columnindex 1
#define gSKv3_1 _ml->template fpfield<2>(_iml)
#define gSKv3_1_columnindex 2
#define m _ml->template fpfield<3>(_iml)
#define m_columnindex 3
#define ek _ml->template fpfield<4>(_iml)
#define ek_columnindex 4
#define mInf _ml->template fpfield<5>(_iml)
#define mInf_columnindex 5
#define mTau _ml->template fpfield<6>(_iml)
#define mTau_columnindex 6
#define Dm _ml->template fpfield<7>(_iml)
#define Dm_columnindex 7
#define v _ml->template fpfield<8>(_iml)
#define v_columnindex 8
#define _g _ml->template fpfield<9>(_iml)
#define _g_columnindex 9
#define _ion_ek *(_ml->dptr_field<0>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ik *(_ml->dptr_field<1>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dikdv *(_ml->dptr_field<2>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_SKv3_1_soma", _hoc_setdata},
{"rates_SKv3_1_soma", _hoc_rates},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[3].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.072929, /* gSKv3_1bar */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 4, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
/*initialize range parameters*/
gSKv3_1bar = _parm_default[0]; /* 0.072929 */
assert(_nrn_mechanism_get_num_vars(_prop) == 10);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gSKv3_1bar"} /* 0 */,
_nrn_mechanism_field<double>{"ik"} /* 1 */,
_nrn_mechanism_field<double>{"gSKv3_1"} /* 2 */,
_nrn_mechanism_field<double>{"m"} /* 3 */,
_nrn_mechanism_field<double>{"ek"} /* 4 */,
_nrn_mechanism_field<double>{"mInf"} /* 5 */,
_nrn_mechanism_field<double>{"mTau"} /* 6 */,
_nrn_mechanism_field<double>{"Dm"} /* 7 */,
_nrn_mechanism_field<double>{"v"} /* 8 */,
_nrn_mechanism_field<double>{"_g"} /* 9 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 2 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 3 */);
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 /home/qh4os/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 const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsproto_);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[1], _dlist1[1];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargs_ ) ;
Dm = ( mInf - m ) / mTau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
rates ( _threadargs_ ) ;
Dm = Dm / (1. - dt*( ( ( ( - 1.0 ) ) ) / mTau )) ;
return 0;
}
/*END CVODE*/
static int states (_internalthreadargsproto_) { {
rates ( _threadargs_ ) ;
m = m + (1. - exp(dt*(( ( ( - 1.0 ) ) ) / mTau)))*(- ( ( ( mInf ) ) / mTau ) / ( ( ( ( - 1.0 ) ) ) / mTau ) - m) ;
}
return 0;
}
static int rates ( _internalthreadargsproto_ ) {
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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargs_ );
return(_r);
}
static int _ode_count(int _type){ return 1;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 1; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
m = m0;
{
rates ( _threadargs_ ) ;
m = mInf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/SKv3_1_soma.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/SKv3_1_soma.o Normal file

Binary file not shown.

820
mech/x86_64/hhqt.cpp Normal file
View File

@ -0,0 +1,820 @@
/* Created by Language version: 7.7.0 */
/* VECTORIZED */
#define NRN_VECTORIZED 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
static constexpr auto number_of_datum_variables = 6;
static constexpr auto number_of_floating_point_variables = 25;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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_ _ml, _iml, _ppvar, _thread, _globals, _nt,
#define _threadargsprotocomma_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _internalthreadargsprotocomma_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt,
#define _threadargs_ _ml, _iml, _ppvar, _thread, _globals, _nt
#define _threadargsproto_ Memb_list* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
#define _internalthreadargsproto_ _nrn_mechanism_cache_range* _ml, size_t _iml, Datum* _ppvar, Datum* _thread, double* _globals, NrnThread* _nt
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t _nt->_t
#define dt _nt->_dt
#define gnabar _ml->template fpfield<0>(_iml)
#define gnabar_columnindex 0
#define gkbar _ml->template fpfield<1>(_iml)
#define gkbar_columnindex 1
#define gl _ml->template fpfield<2>(_iml)
#define gl_columnindex 2
#define el _ml->template fpfield<3>(_iml)
#define el_columnindex 3
#define gna _ml->template fpfield<4>(_iml)
#define gna_columnindex 4
#define gk _ml->template fpfield<5>(_iml)
#define gk_columnindex 5
#define il _ml->template fpfield<6>(_iml)
#define il_columnindex 6
#define m _ml->template fpfield<7>(_iml)
#define m_columnindex 7
#define h _ml->template fpfield<8>(_iml)
#define h_columnindex 8
#define n _ml->template fpfield<9>(_iml)
#define n_columnindex 9
#define ena _ml->template fpfield<10>(_iml)
#define ena_columnindex 10
#define ek _ml->template fpfield<11>(_iml)
#define ek_columnindex 11
#define ina _ml->template fpfield<12>(_iml)
#define ina_columnindex 12
#define ik _ml->template fpfield<13>(_iml)
#define ik_columnindex 13
#define minf _ml->template fpfield<14>(_iml)
#define minf_columnindex 14
#define hinf _ml->template fpfield<15>(_iml)
#define hinf_columnindex 15
#define ninf _ml->template fpfield<16>(_iml)
#define ninf_columnindex 16
#define mtau _ml->template fpfield<17>(_iml)
#define mtau_columnindex 17
#define htau _ml->template fpfield<18>(_iml)
#define htau_columnindex 18
#define ntau _ml->template fpfield<19>(_iml)
#define ntau_columnindex 19
#define Dm _ml->template fpfield<20>(_iml)
#define Dm_columnindex 20
#define Dh _ml->template fpfield<21>(_iml)
#define Dh_columnindex 21
#define Dn _ml->template fpfield<22>(_iml)
#define Dn_columnindex 22
#define v _ml->template fpfield<23>(_iml)
#define v_columnindex 23
#define _g _ml->template fpfield<24>(_iml)
#define _g_columnindex 24
#define _ion_ena *(_ml->dptr_field<0>(_iml))
#define _p_ion_ena static_cast<neuron::container::data_handle<double>>(_ppvar[0])
#define _ion_ina *(_ml->dptr_field<1>(_iml))
#define _p_ion_ina static_cast<neuron::container::data_handle<double>>(_ppvar[1])
#define _ion_dinadv *(_ml->dptr_field<2>(_iml))
#define _ion_ek *(_ml->dptr_field<3>(_iml))
#define _p_ion_ek static_cast<neuron::container::data_handle<double>>(_ppvar[3])
#define _ion_ik *(_ml->dptr_field<4>(_iml))
#define _p_ion_ik static_cast<neuron::container::data_handle<double>>(_ppvar[4])
#define _ion_dikdv *(_ml->dptr_field<5>(_iml))
/* Thread safe. No static _ml, _iml or _ppvar. */
static int hoc_nrnpointerindex = -1;
static _nrn_mechanism_std_vector<Datum> _extcall_thread;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* 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_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_hhqt", _hoc_setdata},
{"rates_hhqt", _hoc_rates},
{"vtrap_hhqt", _hoc_vtrap},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static double _npy_rates(Prop*);
static double _npy_vtrap(Prop*);
static NPyDirectMechFunc npy_direct_func_proc[] = {
{"rates", _npy_rates},
{"vtrap", _npy_vtrap},
{0, 0}
};
#define vtrap vtrap_hhqt
extern double vtrap( _internalthreadargsprotocomma_ double , double );
/* declare global and static user variables */
#define gind 0
#define _gth 0
/* 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"},
{"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;
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_cur(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_jacob(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static int _ode_count(int);
static void _ode_map(Prop*, int, neuron::container::data_handle<double>*, neuron::container::data_handle<double>*, double*, int);
static void _ode_spec(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void _ode_matsol(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
#define _cvode_ieq _ppvar[6].literal_value<int>()
static void _ode_matsol_instance1(_internalthreadargsproto_);
/* 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",
0,
"gna_hhqt",
"gk_hhqt",
"il_hhqt",
0,
"m_hhqt",
"h_hhqt",
"n_hhqt",
0,
0};
static Symbol* _na_sym;
static Symbol* _k_sym;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0.12, /* gnabar */
0.036, /* gkbar */
0.0003, /* gl */
-54.3, /* el */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 7, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 25);
/*initialize range parameters*/
gnabar = _parm_default[0]; /* 0.12 */
gkbar = _parm_default[1]; /* 0.036 */
gl = _parm_default[2]; /* 0.0003 */
el = _parm_default[3]; /* -54.3 */
assert(_nrn_mechanism_get_num_vars(_prop) == 25);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
prop_ion = need_memb(_na_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[0] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ena */
_ppvar[1] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ina */
_ppvar[2] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dinadv */
prop_ion = need_memb(_k_sym);
nrn_promote(prop_ion, 0, 1);
_ppvar[3] = _nrn_mechanism_get_param_handle(prop_ion, 0); /* ek */
_ppvar[4] = _nrn_mechanism_get_param_handle(prop_ion, 3); /* ik */
_ppvar[5] = _nrn_mechanism_get_param_handle(prop_ion, 4); /* _ion_dikdv */
}
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*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" 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]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"gnabar"} /* 0 */,
_nrn_mechanism_field<double>{"gkbar"} /* 1 */,
_nrn_mechanism_field<double>{"gl"} /* 2 */,
_nrn_mechanism_field<double>{"el"} /* 3 */,
_nrn_mechanism_field<double>{"gna"} /* 4 */,
_nrn_mechanism_field<double>{"gk"} /* 5 */,
_nrn_mechanism_field<double>{"il"} /* 6 */,
_nrn_mechanism_field<double>{"m"} /* 7 */,
_nrn_mechanism_field<double>{"h"} /* 8 */,
_nrn_mechanism_field<double>{"n"} /* 9 */,
_nrn_mechanism_field<double>{"ena"} /* 10 */,
_nrn_mechanism_field<double>{"ek"} /* 11 */,
_nrn_mechanism_field<double>{"ina"} /* 12 */,
_nrn_mechanism_field<double>{"ik"} /* 13 */,
_nrn_mechanism_field<double>{"minf"} /* 14 */,
_nrn_mechanism_field<double>{"hinf"} /* 15 */,
_nrn_mechanism_field<double>{"ninf"} /* 16 */,
_nrn_mechanism_field<double>{"mtau"} /* 17 */,
_nrn_mechanism_field<double>{"htau"} /* 18 */,
_nrn_mechanism_field<double>{"ntau"} /* 19 */,
_nrn_mechanism_field<double>{"Dm"} /* 20 */,
_nrn_mechanism_field<double>{"Dh"} /* 21 */,
_nrn_mechanism_field<double>{"Dn"} /* 22 */,
_nrn_mechanism_field<double>{"v"} /* 23 */,
_nrn_mechanism_field<double>{"_g"} /* 24 */,
_nrn_mechanism_field<double*>{"_ion_ena", "na_ion"} /* 0 */,
_nrn_mechanism_field<double*>{"_ion_ina", "na_ion"} /* 1 */,
_nrn_mechanism_field<double*>{"_ion_dinadv", "na_ion"} /* 2 */,
_nrn_mechanism_field<double*>{"_ion_ek", "k_ion"} /* 3 */,
_nrn_mechanism_field<double*>{"_ion_ik", "k_ion"} /* 4 */,
_nrn_mechanism_field<double*>{"_ion_dikdv", "k_ion"} /* 5 */,
_nrn_mechanism_field<int>{"_cvode_ieq", "cvodeieq"} /* 6 */);
hoc_register_prop_size(_mechtype, 25, 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 /home/qh4os/neurenv/mech/hhqt.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const char *modelname = "";
static int error;
static int _ninits = 0;
static int _match_recurse=1;
static void _modl_cleanup(){ _match_recurse=1;}
static int rates(_internalthreadargsprotocomma_ double);
static int _ode_spec1(_internalthreadargsproto_);
/*static int _ode_matsol1(_internalthreadargsproto_);*/
static neuron::container::field_index _slist1[3], _dlist1[3];
static int states(_internalthreadargsproto_);
/*CVODE*/
static int _ode_spec1 (_internalthreadargsproto_) {int _reset = 0; {
rates ( _threadargscomma_ v ) ;
Dm = ( minf - m ) / mtau ;
Dh = ( hinf - h ) / htau ;
Dn = ( ninf - n ) / ntau ;
}
return _reset;
}
static int _ode_matsol1 (_internalthreadargsproto_) {
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 (_internalthreadargsproto_) { {
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 ( _internalthreadargsprotocomma_ 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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargscomma_ *getarg(1) );
hoc_retpushx(_r);
}
static double _npy_rates(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = 1.;
rates ( _threadargscomma_ *getarg(1) );
return(_r);
}
double vtrap ( _internalthreadargsprotocomma_ 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;
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
Prop* _local_prop = _prop_id ? _extcall_prop : nullptr;
_nrn_mechanism_cache_instance _ml_real{_local_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr;
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = vtrap ( _threadargscomma_ *getarg(1) , *getarg(2) );
hoc_retpushx(_r);
}
static double _npy_vtrap(Prop* _prop) {
double _r{0.0};
Datum* _ppvar; Datum* _thread; NrnThread* _nt;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
_ppvar = _nrn_mechanism_access_dparam(_prop);
_thread = _extcall_thread.data();
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_nt = nrn_threads;
_r = vtrap ( _threadargscomma_ *getarg(1) , *getarg(2) );
return(_r);
}
static int _ode_count(int _type){ return 3;}
static void _ode_spec(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
ek = _ion_ek;
_ode_spec1 (_threadargs_);
}}
static void _ode_map(Prop* _prop, int _ieq, neuron::container::data_handle<double>* _pv, neuron::container::data_handle<double>* _pvdot, double* _atol, int _type) {
Datum* _ppvar;
_ppvar = _nrn_mechanism_access_dparam(_prop);
_cvode_ieq = _ieq;
for (int _i=0; _i < 3; ++_i) {
_pv[_i] = _nrn_mechanism_get_param_handle(_prop, _slist1[_i]);
_pvdot[_i] = _nrn_mechanism_get_param_handle(_prop, _dlist1[_i]);
_cvode_abstol(_atollist, _atol, _i);
}
}
static void _ode_matsol_instance1(_internalthreadargsproto_) {
_ode_matsol1 (_threadargs_);
}
static void _ode_matsol(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
Datum* _ppvar;
size_t _iml; _nrn_mechanism_cache_range* _ml; Node* _nd{};
double _v{};
int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
_ml = &_lmr;
_cntml = _ml_arg->_nodecount;
Datum *_thread{_ml_arg->_thread};
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
v = NODEV(_nd);
ena = _ion_ena;
ek = _ion_ek;
_ode_matsol_instance1(_threadargs_);
}}
static void initmodel(_internalthreadargsproto_) {
int _i; double _save;{
h = h0;
m = m0;
n = n0;
{
rates ( _threadargscomma_ v ) ;
m = minf ;
h = hinf ;
n = ninf ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
ena = _ion_ena;
ek = _ion_ek;
initmodel(_threadargs_);
}
}
static double _nrn_current(_internalthreadargsprotocomma_ 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(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_rhs = _nt->node_rhs_storage();
auto const _vec_sav_rhs = _nt->node_sav_rhs_storage();
auto const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; double _rhs, _v; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
ena = _ion_ena;
ek = _ion_ek;
auto const _g_local = _nrn_current(_threadargscomma_ _v + .001);
{ double _dik;
double _dina;
_dina = ina;
_dik = ik;
_rhs = _nrn_current(_threadargscomma_ _v);
_ion_dinadv += (_dina - ina)/.001 ;
_ion_dikdv += (_dik - ik)/.001 ;
}
_g = (_g_local - _rhs)/.001;
_ion_ina += ina ;
_ion_ik += ik ;
_vec_rhs[_ni[_iml]] -= _rhs;
}
}
static void nrn_jacob(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto const _vec_d = _nt->node_d_storage();
auto const _vec_sav_d = _nt->node_sav_d_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; int* _ni; int _iml, _cntml;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (_iml = 0; _iml < _cntml; ++_iml) {
_vec_d[_ni[_iml]] += _g;
}
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
auto* const _ml = &_lmr;
Datum* _ppvar; Datum* _thread;
Node *_nd; double _v = 0.0; int* _ni;
_ni = _ml_arg->_nodeindices;
size_t _cntml = _ml_arg->_nodecount;
_thread = _ml_arg->_thread;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
for (size_t _iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
ena = _ion_ena;
ek = _ion_ek;
{ states(_threadargs_);
} }}
}
static void terminal(){}
static void _initlists(){
int _i; static int _first = 1;
if (!_first) return;
_slist1[0] = {m_columnindex, 0}; _dlist1[0] = {Dm_columnindex, 0};
_slist1[1] = {h_columnindex, 0}; _dlist1[1] = {Dh_columnindex, 0};
_slist1[2] = {n_columnindex, 0}; _dlist1[2] = {Dn_columnindex, 0};
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/hhqt.mod";
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\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"
"}\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"
" celsius (degC)\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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/hhqt.o Normal file

Binary file not shown.

BIN
mech/x86_64/libnrnmech.so Executable file

Binary file not shown.

200
mech/x86_64/makemod2c_inc Normal file
View File

@ -0,0 +1,200 @@
CaDynamics_E2.cpp: ../CaDynamics_E2.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "CaDynamics_E2.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./CaDynamics_E2.o: CaDynamics_E2.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
CaDynamics_E2_soma.cpp: ../CaDynamics_E2_soma.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "CaDynamics_E2_soma.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./CaDynamics_E2_soma.o: CaDynamics_E2_soma.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Ca_HVA.cpp: ../Ca_HVA.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_HVA.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Ca_HVA.o: Ca_HVA.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Ca_HVA_soma.cpp: ../Ca_HVA_soma.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_HVA_soma.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Ca_HVA_soma.o: Ca_HVA_soma.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Ca_LVAst.cpp: ../Ca_LVAst.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_LVAst.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Ca_LVAst.o: Ca_LVAst.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Ca_LVAst_soma.cpp: ../Ca_LVAst_soma.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca_LVAst_soma.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Ca_LVAst_soma.o: Ca_LVAst_soma.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Ca.cpp: ../Ca.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ca.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Ca.o: Ca.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
hhqt.cpp: ../hhqt.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "hhqt.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./hhqt.o: hhqt.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Ih.cpp: ../Ih.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Ih.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Ih.o: Ih.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Im.cpp: ../Im.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Im.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Im.o: Im.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
K_Pst.cpp: ../K_Pst.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "K_Pst.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./K_Pst.o: K_Pst.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
K_Tst.cpp: ../K_Tst.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "K_Tst.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./K_Tst.o: K_Tst.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
Nap_Et2.cpp: ../Nap_Et2.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "Nap_Et2.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./Nap_Et2.o: Nap_Et2.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
NaTa_t.cpp: ../NaTa_t.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTa_t.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./NaTa_t.o: NaTa_t.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
NaTa_t_myel.cpp: ../NaTa_t_myel.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTa_t_myel.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./NaTa_t_myel.o: NaTa_t_myel.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
NaTa_t_nor.cpp: ../NaTa_t_nor.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTa_t_nor.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./NaTa_t_nor.o: NaTa_t_nor.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
NaTs2_t_apic.cpp: ../NaTs2_t_apic.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTs2_t_apic.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./NaTs2_t_apic.o: NaTs2_t_apic.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
NaTs2_t.cpp: ../NaTs2_t.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTs2_t.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./NaTs2_t.o: NaTs2_t.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
NaTs2_t_soma.cpp: ../NaTs2_t_soma.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "NaTs2_t_soma.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./NaTs2_t_soma.o: NaTs2_t_soma.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
SK_E2.cpp: ../SK_E2.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SK_E2.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./SK_E2.o: SK_E2.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
SK_E2_soma.cpp: ../SK_E2_soma.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SK_E2_soma.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./SK_E2_soma.o: SK_E2_soma.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
SKv3_1_apic.cpp: ../SKv3_1_apic.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SKv3_1_apic.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./SKv3_1_apic.o: SKv3_1_apic.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
SKv3_1.cpp: ../SKv3_1.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SKv3_1.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./SKv3_1.o: SKv3_1.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
SKv3_1_soma.cpp: ../SKv3_1_soma.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "SKv3_1_soma.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./SKv3_1_soma.o: SKv3_1_soma.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@
xtra.cpp: ../xtra.mod $(NOCMODL)
@printf " -> $(C_GREEN)NMODL$(C_RESET) $<\\n"
(cd ".."; MODLUNIT=$(NRNUNITS) $(NOCMODL) "xtra.mod" -o "/home/qh4os/neurenv/mech/x86_64" )
./xtra.o: xtra.cpp
@printf " -> $(C_GREEN)Compiling$(C_RESET) /home/qh4os/neurenv/mech/x86_64/$<\\n"
$(CXXCOMPILE) -I".." $(INCLUDES) -fPIC -c "/home/qh4os/neurenv/mech/x86_64/$<" -o $@

87
mech/x86_64/mod_func.cpp Normal file
View File

@ -0,0 +1,87 @@
#include <stdio.h>
#include "hocdec.h"
extern int nrnmpi_myid;
extern int nrn_nobanner_;
extern "C" void _CaDynamics_E2_reg(void);
extern "C" void _CaDynamics_E2_soma_reg(void);
extern "C" void _Ca_HVA_reg(void);
extern "C" void _Ca_HVA_soma_reg(void);
extern "C" void _Ca_LVAst_reg(void);
extern "C" void _Ca_LVAst_soma_reg(void);
extern "C" void _Ca_reg(void);
extern "C" void _hhqt_reg(void);
extern "C" void _Ih_reg(void);
extern "C" void _Im_reg(void);
extern "C" void _K_Pst_reg(void);
extern "C" void _K_Tst_reg(void);
extern "C" void _Nap_Et2_reg(void);
extern "C" void _NaTa_t_reg(void);
extern "C" void _NaTa_t_myel_reg(void);
extern "C" void _NaTa_t_nor_reg(void);
extern "C" void _NaTs2_t_apic_reg(void);
extern "C" void _NaTs2_t_reg(void);
extern "C" void _NaTs2_t_soma_reg(void);
extern "C" void _SK_E2_reg(void);
extern "C" void _SK_E2_soma_reg(void);
extern "C" void _SKv3_1_apic_reg(void);
extern "C" void _SKv3_1_reg(void);
extern "C" void _SKv3_1_soma_reg(void);
extern "C" void _xtra_reg(void);
extern "C" void modl_reg() {
if (!nrn_nobanner_) if (nrnmpi_myid < 1) {
fprintf(stderr, "Additional mechanisms from files\n");
fprintf(stderr, " \"CaDynamics_E2.mod\"");
fprintf(stderr, " \"CaDynamics_E2_soma.mod\"");
fprintf(stderr, " \"Ca_HVA.mod\"");
fprintf(stderr, " \"Ca_HVA_soma.mod\"");
fprintf(stderr, " \"Ca_LVAst.mod\"");
fprintf(stderr, " \"Ca_LVAst_soma.mod\"");
fprintf(stderr, " \"Ca.mod\"");
fprintf(stderr, " \"hhqt.mod\"");
fprintf(stderr, " \"Ih.mod\"");
fprintf(stderr, " \"Im.mod\"");
fprintf(stderr, " \"K_Pst.mod\"");
fprintf(stderr, " \"K_Tst.mod\"");
fprintf(stderr, " \"Nap_Et2.mod\"");
fprintf(stderr, " \"NaTa_t.mod\"");
fprintf(stderr, " \"NaTa_t_myel.mod\"");
fprintf(stderr, " \"NaTa_t_nor.mod\"");
fprintf(stderr, " \"NaTs2_t_apic.mod\"");
fprintf(stderr, " \"NaTs2_t.mod\"");
fprintf(stderr, " \"NaTs2_t_soma.mod\"");
fprintf(stderr, " \"SK_E2.mod\"");
fprintf(stderr, " \"SK_E2_soma.mod\"");
fprintf(stderr, " \"SKv3_1_apic.mod\"");
fprintf(stderr, " \"SKv3_1.mod\"");
fprintf(stderr, " \"SKv3_1_soma.mod\"");
fprintf(stderr, " \"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();
}

BIN
mech/x86_64/mod_func.o Normal file

Binary file not shown.

135
mech/x86_64/special Executable file
View File

@ -0,0 +1,135 @@
#!/usr/bin/python
"""
A generic wrapper to access nrn binaries from a python installation
Please create a softlink with the binary name to be called.
"""
import os
import shutil
import subprocess
import sys
import warnings
from importlib.metadata import metadata, PackageNotFoundError
from importlib.util import find_spec
from pathlib import Path
from setuptools.command.build_ext import new_compiler
from packaging.version import Version
from sysconfig import get_config_vars, get_config_var
from find_libpython import find_libpython
def _customize_compiler(compiler):
"""Do platform-specific customizations of compilers on unix platforms."""
if compiler.compiler_type == "unix":
(cc, cxx, cflags) = get_config_vars("CC", "CXX", "CFLAGS")
if "CC" in os.environ:
cc = os.environ["CC"]
if "CXX" in os.environ:
cxx = os.environ["CXX"]
if "CFLAGS" in os.environ:
cflags = cflags + " " + os.environ["CFLAGS"]
cc_cmd = cc + " " + cflags
# We update executables in compiler to take advantage of distutils arg splitting
compiler.set_executables(compiler=cc_cmd, compiler_cxx=cxx)
def _set_default_compiler():
"""Set (dont overwrite) CC/CXX so that apps dont use the build-time ones"""
ccompiler = new_compiler()
_customize_compiler(ccompiler)
# xcrun wrapper must bring all args
if ccompiler.compiler[0] == "xcrun":
ccompiler.compiler[0] = get_config_var("CC")
ccompiler.compiler_cxx[0] = get_config_var("CXX")
os.environ.setdefault("CC", ccompiler.compiler[0])
os.environ.setdefault("CXX", ccompiler.compiler_cxx[0])
def _check_cpp_compiler_version(min_version: str):
"""Check if GCC compiler is >= min supported one, otherwise show warning"""
try:
cpp_compiler = os.environ.get("CXX", "")
version = subprocess.run(
[cpp_compiler, "--version"],
stdout=subprocess.PIPE,
).stdout.decode("utf-8")
if "gcc" in version.lower() or "gnu" in version.lower():
version = subprocess.run(
[cpp_compiler, "-dumpversion"],
stdout=subprocess.PIPE,
).stdout.decode("utf-8")
if Version(version) <= Version(min_version):
warnings.warn(
f"Warning: GCC >= {min_version} is required with this version of NEURON"
f"but found version {version}",
)
except:
pass
def _config_exe(exe_name):
"""Sets the environment to run the real executable (returned)"""
try:
metadata("neuron-nightly")
print("INFO : Using neuron-nightly Package (Developer Version)")
except PackageNotFoundError:
pass
NRN_PREFIX = str(Path(find_spec("neuron").origin).parent / ".data")
os.environ["NEURONHOME"] = os.path.join(NRN_PREFIX, "share/nrn")
os.environ["NRNHOME"] = NRN_PREFIX
os.environ["CORENRNHOME"] = NRN_PREFIX
os.environ["NRN_PYTHONEXE"] = sys.executable
os.environ["CORENRN_PYTHONEXE"] = sys.executable
os.environ["CORENRN_PERLEXE"] = shutil.which("perl")
os.environ["NRNBIN"] = os.path.dirname(__file__)
if "NMODLHOME" not in os.environ:
os.environ["NMODLHOME"] = NRN_PREFIX
if "NMODL_PYLIB" not in os.environ:
result = find_libpython()
if not result:
raise ValueError(
"unable to locate the Python shared library; "
"please make sure it is installed, "
"or set the environmental variable `NMODL_PYLIB` "
"manually to the path to the Python shared library"
)
os.environ["NMODL_PYLIB"] = result
# nmodl module is inside <prefix>/lib directory
sys.path.insert(0, os.path.join(NRN_PREFIX, "lib"))
os.environ["PYTHONPATH"] = ":".join(sys.path)
_set_default_compiler()
return os.path.join(NRN_PREFIX, "bin", exe_name)
def _wrap_executable(output_name):
"""Create a wrapper for an executable in same dir. Requires renaming the original file.
Executables are typically found under arch_name
"""
release_dir = os.path.join(os.environ["NEURONHOME"], "demo/release")
arch_name = next(os.walk(release_dir))[1][0] # first dir
file_path = os.path.join(arch_name, output_name)
shutil.move(file_path, file_path + ".nrn")
shutil.copy(__file__, file_path)
if __name__ == "__main__":
exe = _config_exe(os.path.basename(sys.argv[0]))
if Path(exe).name.startswith("nrnivmodl"):
# To create a wrapper for special (so it also gets ENV vars) we intercept nrnivmodl
_check_cpp_compiler_version("10.0")
subprocess.check_call([exe, *sys.argv[1:]])
_wrap_executable("special")
sys.exit(0)
if exe.endswith("special"):
exe = os.path.join(
sys.argv[0] + ".nrn"
) # original special is renamed special.nrn
os.execv(exe, sys.argv)

135
mech/x86_64/special.nrn Executable file
View File

@ -0,0 +1,135 @@
#!/usr/bin/python
"""
A generic wrapper to access nrn binaries from a python installation
Please create a softlink with the binary name to be called.
"""
import os
import shutil
import subprocess
import sys
import warnings
from importlib.metadata import metadata, PackageNotFoundError
from importlib.util import find_spec
from pathlib import Path
from setuptools.command.build_ext import new_compiler
from packaging.version import Version
from sysconfig import get_config_vars, get_config_var
from find_libpython import find_libpython
def _customize_compiler(compiler):
"""Do platform-specific customizations of compilers on unix platforms."""
if compiler.compiler_type == "unix":
(cc, cxx, cflags) = get_config_vars("CC", "CXX", "CFLAGS")
if "CC" in os.environ:
cc = os.environ["CC"]
if "CXX" in os.environ:
cxx = os.environ["CXX"]
if "CFLAGS" in os.environ:
cflags = cflags + " " + os.environ["CFLAGS"]
cc_cmd = cc + " " + cflags
# We update executables in compiler to take advantage of distutils arg splitting
compiler.set_executables(compiler=cc_cmd, compiler_cxx=cxx)
def _set_default_compiler():
"""Set (dont overwrite) CC/CXX so that apps dont use the build-time ones"""
ccompiler = new_compiler()
_customize_compiler(ccompiler)
# xcrun wrapper must bring all args
if ccompiler.compiler[0] == "xcrun":
ccompiler.compiler[0] = get_config_var("CC")
ccompiler.compiler_cxx[0] = get_config_var("CXX")
os.environ.setdefault("CC", ccompiler.compiler[0])
os.environ.setdefault("CXX", ccompiler.compiler_cxx[0])
def _check_cpp_compiler_version(min_version: str):
"""Check if GCC compiler is >= min supported one, otherwise show warning"""
try:
cpp_compiler = os.environ.get("CXX", "")
version = subprocess.run(
[cpp_compiler, "--version"],
stdout=subprocess.PIPE,
).stdout.decode("utf-8")
if "gcc" in version.lower() or "gnu" in version.lower():
version = subprocess.run(
[cpp_compiler, "-dumpversion"],
stdout=subprocess.PIPE,
).stdout.decode("utf-8")
if Version(version) <= Version(min_version):
warnings.warn(
f"Warning: GCC >= {min_version} is required with this version of NEURON"
f"but found version {version}",
)
except:
pass
def _config_exe(exe_name):
"""Sets the environment to run the real executable (returned)"""
try:
metadata("neuron-nightly")
print("INFO : Using neuron-nightly Package (Developer Version)")
except PackageNotFoundError:
pass
NRN_PREFIX = str(Path(find_spec("neuron").origin).parent / ".data")
os.environ["NEURONHOME"] = os.path.join(NRN_PREFIX, "share/nrn")
os.environ["NRNHOME"] = NRN_PREFIX
os.environ["CORENRNHOME"] = NRN_PREFIX
os.environ["NRN_PYTHONEXE"] = sys.executable
os.environ["CORENRN_PYTHONEXE"] = sys.executable
os.environ["CORENRN_PERLEXE"] = shutil.which("perl")
os.environ["NRNBIN"] = os.path.dirname(__file__)
if "NMODLHOME" not in os.environ:
os.environ["NMODLHOME"] = NRN_PREFIX
if "NMODL_PYLIB" not in os.environ:
result = find_libpython()
if not result:
raise ValueError(
"unable to locate the Python shared library; "
"please make sure it is installed, "
"or set the environmental variable `NMODL_PYLIB` "
"manually to the path to the Python shared library"
)
os.environ["NMODL_PYLIB"] = result
# nmodl module is inside <prefix>/lib directory
sys.path.insert(0, os.path.join(NRN_PREFIX, "lib"))
os.environ["PYTHONPATH"] = ":".join(sys.path)
_set_default_compiler()
return os.path.join(NRN_PREFIX, "bin", exe_name)
def _wrap_executable(output_name):
"""Create a wrapper for an executable in same dir. Requires renaming the original file.
Executables are typically found under arch_name
"""
release_dir = os.path.join(os.environ["NEURONHOME"], "demo/release")
arch_name = next(os.walk(release_dir))[1][0] # first dir
file_path = os.path.join(arch_name, output_name)
shutil.move(file_path, file_path + ".nrn")
shutil.copy(__file__, file_path)
if __name__ == "__main__":
exe = _config_exe(os.path.basename(sys.argv[0]))
if Path(exe).name.startswith("nrnivmodl"):
# To create a wrapper for special (so it also gets ENV vars) we intercept nrnivmodl
_check_cpp_compiler_version("10.0")
subprocess.check_call([exe, *sys.argv[1:]])
_wrap_executable("special")
sys.exit(0)
if exe.endswith("special"):
exe = os.path.join(
sys.argv[0] + ".nrn"
) # original special is renamed special.nrn
os.execv(exe, sys.argv)

368
mech/x86_64/xtra.cpp Normal file
View File

@ -0,0 +1,368 @@
/* Created by Language version: 7.7.0 */
/* NOT VECTORIZED */
#define NRN_VECTORIZED 0
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mech_api.h"
#undef PI
#define nil 0
#define _pval pval
// clang-format off
#include "md1redef.h"
#include "section_fwd.hpp"
#include "nrniv_mf.h"
#include "md2redef.h"
#include "nrnconf.h"
// clang-format on
#include "neuron/cache/mechanism_range.hpp"
#include <vector>
using std::size_t;
static auto& std_cerr_stream = std::cerr;
static constexpr auto number_of_datum_variables = 2;
static constexpr auto number_of_floating_point_variables = 6;
namespace {
template <typename T>
using _nrn_mechanism_std_vector = std::vector<T>;
using _nrn_model_sorted_token = neuron::model_sorted_token;
using _nrn_mechanism_cache_range = neuron::cache::MechanismRange<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance<number_of_floating_point_variables, number_of_datum_variables>;
using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container;
template <typename T>
using _nrn_mechanism_field = neuron::mechanism::field<T>;
template <typename... Args>
void _nrn_mechanism_register_data_fields(Args&&... args) {
neuron::mechanism::register_data_fields(std::forward<Args>(args)...);
}
}
#if !NRNGPU
#undef exp
#define exp hoc_Exp
#if NRN_ENABLE_ARCH_INDEP_EXP_POW
#undef pow
#define pow hoc_pow
#endif
#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 _internalthreadargsprotocomma_ /**/
#define _threadargs_ /**/
#define _threadargsproto_ /**/
#define _internalthreadargsproto_ /**/
/*SUPPRESS 761*/
/*SUPPRESS 762*/
/*SUPPRESS 763*/
/*SUPPRESS 765*/
extern double *hoc_getarg(int);
#define t nrn_threads->_t
#define dt nrn_threads->_dt
#define es _ml->template fpfield<0>(_iml)
#define es_columnindex 0
#define x _ml->template fpfield<1>(_iml)
#define x_columnindex 1
#define y _ml->template fpfield<2>(_iml)
#define y_columnindex 2
#define z _ml->template fpfield<3>(_iml)
#define z_columnindex 3
#define type _ml->template fpfield<4>(_iml)
#define type_columnindex 4
#define order _ml->template fpfield<5>(_iml)
#define order_columnindex 5
#define ex *_ppvar[0].get<double*>()
#define _p_ex _ppvar[0].literal_value<void*>()
#define area (*(_ml->dptr_field<1>(_iml)))
static _nrn_mechanism_cache_instance _ml_real{nullptr};
static _nrn_mechanism_cache_range *_ml{&_ml_real};
static size_t _iml{0};
static Datum *_ppvar;
static int hoc_nrnpointerindex = 0;
static Prop* _extcall_prop;
/* _prop_id kind of shadows _extcall_prop to allow validity checking. */
static _nrn_non_owning_id_without_container _prop_id{};
/* external NEURON variables */
/* declaration of user functions */
static int _mechtype;
extern void _nrn_cacheloop_reg(int, int);
extern void hoc_register_limits(int, HocParmLimits*);
extern void hoc_register_units(int, HocParmUnits*);
extern void nrn_promote(Prop*, int, int);
#define NMODL_TEXT 1
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mechtype);
#endif
static void _hoc_setdata();
/* connect user functions to hoc names */
static VoidFunc hoc_intfunc[] = {
{"setdata_xtra", _hoc_setdata},
{0, 0}
};
/* Direct Python call wrappers to density mechanism functions.*/
static NPyDirectMechFunc npy_direct_func_proc[] = {
{0, 0}
};
/* declare global and static user variables */
#define gind 0
#define _gth 0
#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, Datum* _ppd, Datum* _thread, NrnThread* _nt, Memb_list* _ml, size_t _iml, _nrn_model_sorted_token const&);
extern void _nrn_setdata_reg(int, void(*)(Prop*));
static void _setdata(Prop* _prop) {
_extcall_prop = _prop;
_prop_id = _nrn_get_prop_id(_prop);
neuron::legacy::set_globals_from_prop(_prop, _ml_real, _ml, _iml);
_ppvar = _nrn_mechanism_access_dparam(_prop);
Node * _node = _nrn_mechanism_access_node(_prop);
v = _nrn_mechanism_access_voltage(_node);
}
static void _hoc_setdata() {
Prop *_prop, *hoc_getdata_range(int);
_prop = hoc_getdata_range(_mechtype);
_setdata(_prop);
hoc_retpushx(1.);
}
static void nrn_alloc(Prop*);
static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int);
static void nrn_state(_nrn_model_sorted_token const&, 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_;
/* Used by NrnProperty */
static _nrn_mechanism_std_vector<double> _parm_default{
0, /* es */
0, /* x */
0, /* y */
0, /* z */
0, /* type */
0, /* order */
};
extern Prop* need_memb(Symbol*);
static void nrn_alloc(Prop* _prop) {
Prop *prop_ion{};
Datum *_ppvar{};
_ppvar = nrn_prop_datum_alloc(_mechtype, 2, _prop);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
_nrn_mechanism_cache_instance _ml_real{_prop};
auto* const _ml = &_ml_real;
size_t const _iml{};
assert(_nrn_mechanism_get_num_vars(_prop) == 6);
/*initialize range parameters*/
es = _parm_default[0]; /* 0 */
x = _parm_default[1]; /* 0 */
y = _parm_default[2]; /* 0 */
z = _parm_default[3]; /* 0 */
type = _parm_default[4]; /* 0 */
order = _parm_default[5]; /* 0 */
assert(_nrn_mechanism_get_num_vars(_prop) == 6);
_nrn_mechanism_access_dparam(_prop) = _ppvar;
/*connect ionic variables to this model*/
_ppvar[1] = _nrn_mechanism_get_area_handle(nrn_alloc_node_);
}
static void _initlists();
extern Symbol* hoc_lookup(const char*);
extern void _nrn_thread_reg(int, int, void(*)(Datum*));
void _nrn_thread_table_reg(int, nrn_thread_table_check_t);
extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***);
extern void _cvode_abstol( Symbol**, double*, int);
extern "C" void _xtra_reg() {
int _vectorized = 0;
_initlists();
register_mech(_mechanism, nrn_alloc,nullptr, nullptr, nullptr, nrn_init, hoc_nrnpointerindex, 0);
_mechtype = nrn_get_mechtype(_mechanism[1]);
hoc_register_parm_default(_mechtype, &_parm_default);
hoc_register_npy_direct(_mechtype, npy_direct_func_proc);
_nrn_setdata_reg(_mechtype, _setdata);
#if NMODL_TEXT
register_nmodl_text_and_filename(_mechtype);
#endif
_nrn_mechanism_register_data_fields(_mechtype,
_nrn_mechanism_field<double>{"es"} /* 0 */,
_nrn_mechanism_field<double>{"x"} /* 1 */,
_nrn_mechanism_field<double>{"y"} /* 2 */,
_nrn_mechanism_field<double>{"z"} /* 3 */,
_nrn_mechanism_field<double>{"type"} /* 4 */,
_nrn_mechanism_field<double>{"order"} /* 5 */,
_nrn_mechanism_field<double*>{"ex", "pointer"} /* 0 */,
_nrn_mechanism_field<double*>{"area", "area"} /* 1 */);
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 /home/qh4os/neurenv/mech/xtra.mod\n");
hoc_register_limits(_mechtype, _hoc_parm_limits);
hoc_register_units(_mechtype, _hoc_parm_units);
}
static int _reset;
static const 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, Datum* _ppd, Datum* _thread, NrnThread* _nt, Memb_list* _ml_arg, size_t _iml, _nrn_model_sorted_token const& _sorted_token) {
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _ml_arg->_type()}; auto* const _ml = &_lmr;
double* _globals = nullptr;
if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get<double*>(); }
_ppvar = _ppd;
v = NODEV(_nd);
ex = stim * es ;
}
static void initmodel() {
int _i; double _save;_ninits++;
{
{
ex = stim * es ;
}
}
}
static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
Node *_nd; double _v; int* _ni; int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
_ml = &_lmr;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_v = _vec_v[_ni[_iml]];
v = _v;
initmodel();
}}
static double _nrn_current(double _v){double _current=0.;v=_v;{
} return _current;
}
static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){
Node *_nd; double _v = 0.0; int* _ni; int _cntml;
_nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type};
auto* const _vec_v = _nt->node_voltage_storage();
_ml = &_lmr;
_ni = _ml_arg->_nodeindices;
_cntml = _ml_arg->_nodecount;
for (_iml = 0; _iml < _cntml; ++_iml) {
_ppvar = _ml_arg->_pdata[_iml];
_nd = _ml_arg->_nodelist[_iml];
_v = _vec_v[_ni[_iml]];
v=_v;
{
}}
}
static void terminal(){}
static void _initlists() {
int _i; static int _first = 1;
if (!_first) return;
_first = 0;
}
#if NMODL_TEXT
static void register_nmodl_text_and_filename(int mech_type) {
const char* nmodl_filename = "/home/qh4os/neurenv/mech/xtra.mod";
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"
;
hoc_reg_nmodl_filename(mech_type, nmodl_filename);
hoc_reg_nmodl_text(mech_type, nmodl_file_text);
}
#endif

BIN
mech/x86_64/xtra.o Normal file

Binary file not shown.

14037
neuron.fld Normal file

File diff suppressed because it is too large Load Diff

14037
neuron_ISO.fld Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More