Code: Select all

```
COMMENT
This file is used to calculate the axial currents between the defined node(N) and the previous (N-1) node
ENDCOMMENT
NEURON {
SUFFIX iax
RANGE x, i
POINTER vprev, vnext
}
ASSIGNED {
i (milliamp)
vprev (millivolt)
vnext (millivolt)
}
PARAMETER {
x = 0 (1)
}
AFTER INITIAL {: during a call to finitialize()
i = (1e-6) * (vprev - vnext)/ri(x)
}
AFTER SOLVE { : after each solution step compute
i = (1e-6) * (vprev - vnext)/ri(x)
}
```

Code: Select all

```
load_file("nrngui.hoc")
tstart = 0
tstop = 500
dt = 0.01
v_init = -70 // mV
celsius = 37
create axon
access axon
// axon
axon {
cm = 0.75
diam = 1
L = 1000
Ra = 150
nseg = int((L/(0.1*lambda_f(100))+.999)/2)*2 + 1
insert hh
insert iax
}
// Caution: Such a treatment will not take joined sections into account i.e., if there are two
// sections (soma & axon) then for nseg > 1, only axial currents as a function of time, in internal nodes'll be computed
forall {
if (ismembrane("iax")) {
xold = 0
for (x, 0) {
setpointer vprev_iax(x), secname().v(xold)
setpointer vnext_iax(x), secname().v(x)
xold = x
}
}
}
// code for accounting for axial currents through the edges of various sections
run()
```