ELECTRODE_CURRENT does not work in my clamp

NMODL and the Channel Builder.
Post Reply
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

ELECTRODE_CURRENT does not work in my clamp

Post by einsinghaf »

I have mod file like this:

Code: Select all

NEURON {
        POINT_PROCESS MyClamp
        RANGE  del, dur, amp, curr
        ELECTRODE_CURRENT curr
}

UNITS {
        (nA) = (nanoamp)
             }

PARAMETER {
        del=0   (ms)
        dur=25   (ms)
        amp=22 (nA)
}

ASSIGNED {
        curr (nA)
}

BREAKPOINT {
	curr=11
}
and a procedure like this

Code: Select all

proc inject_curret(){
stim = new MyClamp(.5)
}
The main code is

Code: Select all

inject_current()
while (t < tstop) {
    fadvance()
    printf("AMPLITUDE=%.2f",stim.amp)
    printf("ELECTRODE_CURRENT=%.2f",stim.curr)
}
and the result is this

AMPLITUDE=22.00000
ELECTRODE_CURRENT=0.000000
...........................

What is the problem?
ted
Site Admin
Posts: 5793
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: ELECTRODE_CURRENT does not work in my clamp

Post by ted »

You haven't shown all your code, but my guess is that it specifies the properties of a model but doesn't do anything that causes execution of the contents of BREAKPOINT blocks. Until you execute finitialize(), fadvance(), or run(), the BREAKPOINT blocks are not executed.
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

Re: ELECTRODE_CURRENT does not work in my clamp

Post by einsinghaf »

It is not my code!
I want to add an electrode to the Carl Gold 2007 code.
http://senselab.med.yale.edu/modeldb/sh ... odel=84589
1-copy my model in mod folder

Code: Select all

NEURON {
        POINT_PROCESS MyClamp
        RANGE amp, i
        ELECTRODE_CURRENT i
}

UNITS {
        (nA) = (nanoamp)
             }

PARAMETER {
        amp=10 (nA)
}

ASSIGNED {
        i (nA)
}

BREAKPOINT {
      i=23
}
2- a reference in ref.hoc file

Code: Select all

objref stim
3-define a procedure in cell_util.hoc

Code: Select all

proc inject_current(){
soma stim = new MyClamp(.5) 
}
4- call the proc in the main program

Code: Select all

inject_current()
while (t < tstop) {
    fadvance()
	print "-----------------------------------------------------------------------------------------------"	
	printf("ELECTRODE_AMP=%.2f\n",stim.amp)
	printf("ELECTRODE_CURRENT=%.2f\n",stim.i)    
}
5- which results
ELECTRODE_AMP=10.00
ELECTRODE_CURRENT=0.00
--------------------------------------------------------------------------------
ted
Site Admin
Posts: 5793
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: ELECTRODE_CURRENT does not work in my clamp

Post by ted »

It is not my code!
It's "yours" in the sense that it is the code that you are using.
I want to add an electrode to the Carl Gold 2007 code.
So why invent some new mechanism? Why can't you just add an IClamp, a mechanism that is built in and thoroughly debugged?
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

Re: ELECTRODE_CURRENT does not work in my clamp

Post by einsinghaf »

ted wrote:So why invent some new mechanism? Why can't you just add an IClamp, a mechanism that is built in and thoroughly debugged?
I have to add an electrode with specified function and beyond that I have tested IClamp, but I can not define the amp parameter in parameters files like what he did!

Code: Select all

define_param("stim.amp","10")
and when I define it in the proc

Code: Select all

proc inject_current(){

soma stim = new IClamp(.5)
stim.amp=10
}
no change in the results
---------------
ELECTRODE_AMP=10.00
ELECTRODE_CURRENT=0.00
ted
Site Admin
Posts: 5793
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: ELECTRODE_CURRENT does not work in my clamp

Post by ted »

I'm sorry you have to work with that particular model. There are a few models that are examples of "egregiously methodical organization" and this is one of them. Also it has things that interfere with using NEURON's GUI to analyze the model; to overcome this difficulty, I put a copy of main.hoc aside (called the copy original_main.hoc), then edited main.hoc to do the following:

1. insert the statement
load_file("nrngui.hoc")
just before this statement
print "\n-> Setting file roots..."

2. comment out the block of code that starts with
num_steps = 0
and ends just before
//----------------------------------------------------------------
// CLEANUP

3. comment out these two lines
cleanup_detail_print()
cleanup_times_print()

Also it was necessary to put aside a copy of mechdesc.hoc (called it original_mechdesc.hoc), then edit mechdesc.hoc to comment out the template that defines their String class (which conflicts with the String template in NEURON's own stdlib.hoc).

After that I was able to
mod/i686/special hoc/src/refs.hoc cells/d151.hoc hoc/src/file_util.hoc hoc/src/main.hoc -
(notice the hyphen at the end of that command line--very important because without it NEURON would exit immediately after parsing their code)
and use the NEURON Main Menu toolbar to bring up a Model View tool for analyzing the model's properties. Turns out that there were no IClamps or other point processes. The PointProcessManager let me attach an IClamp to the model.

The model has a serious problem in that it is not initialized to its steady state. Indeed, over the first 30 ms somatic membrane potential dropped quickly from -65 to about -66 mV, then stayed relatively flat until about 150 ms when it began to hyperpolarize slowly. After 8000 ms of model time (26 seconds of my time) v had fallen from its initial value of -65 mV to -71.6 mV and was still hyperpolarizing. This is characteristic of poorly initialized models that contain ion accumulation mechanisms, especially calcium accumulation plus calcium dependent potassium channels. I suppose it can be used in simulations that do nothing to the model cell for the first 30 ms, then perform whatever stimulation is necessary and terminate the run after a total of 100-150 ms.

A 0.1 ms x 4 nA current pulse injected into the soma at t=30 ms triggers a spike.
I have to add an electrode with specified function and beyond that I have tested IClamp, but I can not define the amp parameter in parameters files like what he did!
Well, do you have to do everything the way whoever wrote these files did? Looks like he's doing things the hard way. You have to do it the same way? Simply doing this

Code: Select all

objref stim
soma stim = new IClamp(0.5) // or reference whatever section you like
stim.del = 30
stim.dur = 0.1
stim.amp = 4
in main.hoc (or wherever it might make sense) isn't allowed? Why can't your hoc file that sets parameters just contain a plain old assignment statement like this

Code: Select all

stim.amp = 5 // or whatever you want it to be
?
Inventing new mechanisms just for the sake of adhering to somebody else's kludgy coding scheme is a surefire way to create problems for yourself and everybody else who might be interested in using your code.
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

Re: ELECTRODE_CURRENT does not work in my clamp

Post by einsinghaf »

Thank you indeed, Ted!
I have just changed the basements of my opinion!
Post Reply