Ion Current (part 1)

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

Ion Current (part 1)

Post by dparker »

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)

	FARADAY = 96520 (coul)
	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)

Post by dparker »

mechanism2.mod

Code: Select all

TITLE object

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

	FARADAY = 96520 (coul)
	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

load_file("nrngui.hoc")

objref contrl

contrl = new VBox()

contrl.intercept(1)

nrncontrolmenu()

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
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Ion Current (part 1)

Post by ted »

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.

A few other comments:

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

Re: Ion Current (part 1)

Post by dparker »

Thank you Ted.
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Ion Current (part 1)

Post by ted »

You might want to try one of the examples in the first part of chapter 9 of The NEURON Book, or if you don't have the book the first part of this article on NMODL
Hines, M.L. and Carnevale, N.T.
Expanding NEURON's repertoire of mechanisms with NMODL.
Neural Computation 12:995-1007, 2000.
(the preprint available at http://www.neuron.yale.edu/neuron/nrnpubs is more extensive than the published version in the journal)
Post Reply