## Ion Current (part 1)

The basics of how to develop, test, and use models.
dparker

### Ion Current (part 1)

Hi there,

In order to understand how the ionic current works I have built the following files:
mechanism.hoc
mechanism1.mod
mechanism2.mod

Mechanism1 and mechanism2 are basically the same mechanism, the only difference is that:
in 1 I am adding to the ionic current while in 2 I am subtracting from the ionic current.
Below are also the results of running mechanism1.hoc and mechanism2.hoc

My question is why is the soma.v roughly the same for both mechanisms?

My understanding is that the "density" ionic current (mA/cm2) is added to the voltage
(after multiplying it with area() section and scale cm2->um2) in order to get the total
membrane current.

Any help would be greatly appreciated.

mechanism1 result

Code: Select all

``````area=886.68311 um2
---------------------------------------
soma { nseg=1  L=16.8  Ra=210
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=16.8}
insert capacitance { cm=1}
insert object {}
insert tca_ion { etca=130}
}
BREAKPOINT        t=0 v=-64.999 itca=0 etca=130
.......................
BREAKPOINT        t=19.95 v=-24.4036 itca=403 etca=130
``````
mechanism2 result

Code: Select all

``````......................
BREAKPOINT        t=0 v=-64.999 itca=0 etca=130
......................
BREAKPOINT        t=19.95 v=-24.4044 itca=-403 etca=130
``````
mechanism1.mod

Code: Select all

``````TITLE object

UNITS {
(mA) = (milliamp)
(mV) = (millivolt)

R = 8.3134 (joule/degC)
KTOMV = .0853 (mV/degC)
}

PARAMETER {
v (mV)
celsius = 6.3	(degC)
}

NEURON {
SUFFIX object
USEION tca READ etca WRITE itca VALENCE 2
RANGE itca, etca, I0
}

STATE {
I0
}

ASSIGNED {
itca (mA/cm2)
etca (mV)
}

INITIAL {
I0 = 0
itca = 0
}

BREAKPOINT {
printf("BREAKPOINT        t=%g v=%g itca=%g etca=%g \n", t, v, itca, etca)
SOLVE states METHOD derivimplicit
itca = itca + 1
}

DERIVATIVE states {
I0' = I0
}
``````
dparker

### Ion Current (part 2)

mechanism2.mod

Code: Select all

``````TITLE object

UNITS {
(mA) = (milliamp)
(mV) = (millivolt)

R = 8.3134 (joule/degC)
KTOMV = .0853 (mV/degC)
}

PARAMETER {
v (mV)
celsius = 6.3	(degC)
}

NEURON {
SUFFIX object
USEION tca READ etca WRITE itca VALENCE 2
RANGE itca, etca, I0
}

STATE {
I0
}

ASSIGNED {
itca (mA/cm2)
etca (mV)
}

INITIAL {
I0 = 0
itca = 0
}

BREAKPOINT {
printf("BREAKPOINT        t=%g v=%g itca=%g etca=%g \n", t, v, itca, etca)
SOLVE states METHOD derivimplicit
itca = itca - 1
}

DERIVATIVE states {
I0' = I0
}
``````
mechanism.hoc

Code: Select all

``````create soma

soma {
nseg = 1
L = 16.8
diam = 16.8
Ra = 210
cm = 1

insert object
gcatbar_object = 0.000037
etca = 130
}

a=0
forall for (x) a += area(x)
print "area=", a, "um2"

print "---------------------------------------"
forall psection()

v_init = -60
celsius = 6.3

objref contrl

contrl = new VBox()

contrl.intercept(1)

contrl.intercept(0)

contrl.map("Control",0,75,-1,-1)	// left, top, width, height

proc init() {

finitialize(v_init)

fcurrent()

tstop = 20
dt = 0.1

t = 0

}

proc run() {

stdinit()

continuerun(tstop)

}

run()
``````
Thank you.

Regards,
David
ted
Posts: 5819
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: Ion Current (part 1)

The NMODL code is invalid and will not generate meaningful results. Every call to fadvance() (the procedure in NEURON's standard run system that advances a simulation from one point in time to the next) calls the BREAKPOINT block of each mechanism twice, with a slightly different membrane potential on each call. It does this to discover the effective conductance of each mechanism. Doing anything inside a BREAKPOINT block that changes a variable on each evaluation of the block's code is OK if that variable is merely a count of the number of times the code has been evaluated, but it can be a source of multiple errors if that variable has any "real" role in the model or the simulation.

derivimplicit is not necessary for numerical integration of linear ODEs. cnexp will do just fine.

This mechanism has no gcatbar parameter, so assigning a value to gcatbar_object in the hoc file will have no effect.

There is absolutely no need to define your own proc init() or run(). Among the many other things that it does, load_file("nrngui.hoc") reads NEURON's standard run library, which contains its own definitions of init() and run(). Just call
run()
and NEURON will initialize and launch a simulation. The standard run library also defines default values for tstop and dt, which you can change to any values you like. Just make sure to assign the values you want before you call run().
dparker

Thank you Ted.
ted