-
Notifications
You must be signed in to change notification settings - Fork 3
/
testnetstimdirect.hoc
82 lines (69 loc) · 1.6 KB
/
testnetstimdirect.hoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{load_file("nrngui.hoc")}
{load_file("defvar.hoc")}
load_file("common.hoc")
ncell = 10
objref cell, cells, nil, vec, vecs, r, netcons, nc
pnm = new ParallelNetManager(0)
pc = pnm.pc
cells = new List()
netcons = new List()
begintemplate Cell
public soma, vvec, ivec, syn
create soma
objref vvec, ivec, syn
proc init() {
soma {
insert pas e_pas=-65 g_pas = 0.0001
syn = new ExpSyn(.5) syn.e = 0 syn.g = 0.001
vvec = new Vector()
vvec.record(&v(.5))
ivec = new Vector()
ivec.record(&i_pas(.5))
}
}
endtemplate Cell
for (gid = pc.id; gid < ncell; gid += pc.nhost) {
pc.set_gid2node(gid, pc.id)
if (1 && gid < pc.nhost) {
cell = new Cell()
cells.append(cell)
pc.cell(gid, new NetCon(&cell.soma.v(.5), nil))
continue
}
cell = new NetStim()
cell.start=1
pc.cell(gid, new NetCon(cell, nil))
cells.append(cell)
nc = new NetCon(cell, cells.o(0).syn)
netcons.append(nc)
nc.delay = 1.0
nc.weight[0] = 1.0
}
objref tvec, idvec
tvec = new Vector()
idvec = new Vector()
pc.spike_record(-1, tvec, idvec)
cvode.cache_efficient(1)
pc.set_maxstep(10)
stdinit()
// Run NEURON simulation
prun("")
objref vvecsav, ivecsav
vvecsav = cells.o(0).vvec.c()
ivecsav = cells.o(0).ivec.c()
cells.o(0).vvec.resize(0)
cells.o(0).ivec.resize(0)
// Run CoreNEURON simulation
use_coreneuron = 1
stdinit()
prun("")
if(vvecsav.eq(cells.o(0).vvec) && ivecsav.eq(cells.o(0).ivec)) {
if(pc.id == 0) {
printf("Test netstimdirect passed. Voltage and current vectors are same.\n")
}
} else {
execerror("Voltage or current vectors are different")
}
spike2file("netstimdirect")
pc.barrier()
quit()