How to record variables of SEClamp adding to a soma?

Moderator: wwlytton

Post Reply
lining
Posts: 4
Joined: Tue May 09, 2023 12:13 am

How to record variables of SEClamp adding to a soma?

Post by lining »

I have created a simple soma,adding pas and seclamp(i_i in the code) to it, using play() to specify the seclamp.rs. I try to record all the seclamp variables,such as ,i,rs,vc,amp1. finally, I plot the variables using matlab, however, the value does not match the one that is specified in the code. As I specified the seclamp.rs using play() as 1e2, however the recorded rs is all 1, meanwhile,the seclamp.i is not specified in the code , the recorded seclamp shows -5,-0.5016,-0.0521.....how is the seclamp.i computed?I have posted my code in NEURON below.

Code: Select all

{
	load_file("nrngui.hoc")
}
create soma
soma{
    nseg =1
    diam = 18.8
    L = 18.8
    
}
Rm = 2.62e-5
global_ra = 100
Vleak = -50
soma {
	insert pas  g_pas=1/(Rm)  Ra=global_ra  e_pas=Vleak
}
objref i_i
soma {
    i_i = new SEClamp(0.5)
}

tstop = 1000
objref tvec
vecsize = tstop
tvec = new Vector( vecsize , 0 )
for i=0, vecsize-2 {
    tvec.x[i+1] = tvec.x[i] + 1
}
objref condvec_i
vecsize = tvec.size()
condvec_i = new Vector( vecsize , 0 )
for i=0, vecsize-1 {
        t = tvec.x[i]
        condvec_i.x[i] = 1e2
}
i_i.amp1 = -70
i_i.dur1 = 100
condvec_i.play(&i_i.rs, tvec, 1)
objref vm_trace, time_trace
vm_trace = new Vector()
time_trace = new Vector()

objref se_amp, se_rs,se_vc,se_i
se_amp = new Vector()
se_rs = new Vector()
se_vc = new Vector()
se_i = new Vector()



objref f1, ftime1,f_seamp,f_sers,f_sevc,f_sei
f1 = new File()
f1.wopen("./results/vm_trace_sample_soma.dat")

ftime1 = new File()
ftime1.wopen("./results/time_trace_sample_soma.dat") 

f_seamp = new File()
f_seamp.wopen("./results/seamp_trace_sample_soma.dat") 

f_sers = new File()
f_sers.wopen("./results/sers_trace_sample_soma.dat") 
f_sevc = new File()
f_sevc.wopen("./results/sevc_trace_sample_soma.dat") 
f_sei = new File()
f_sei.wopen("./results/sei_trace_sample_soma.dat") 




vm_trace.record( &soma.v(0.1) )
time_trace.record( &t )
se_amp.record( &i_i.amp1 )
se_rs.record( &i_i.rs )
se_vc.record( &i_i.vc )
se_i.record( &i_i.i )
v_init = -65 

{
    tstop = 1000

    dt = 0.1
    steps_per_ms = 10

    init()

    run()
}
vm_trace.printf(f1)
time_trace.printf(ftime1)
se_amp.printf(f_seamp)
se_rs.printf(f_sers)
se_vc.printf(f_sevc)
se_i.printf(f_sei)


ftime1.close()
f1.close()
f_seamp.close()
f_sers.close()
f_sei.close()
f_sevc.close()
quit()
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: How to record variables of SEClamp adding to a soma?

Post by ted »

First, let me thank you for your interest in using NEURON in your work. It looks like you already have significant experience with MATLAB.

Now the good news. While your code isn't a "textbook example of best usage of hoc," it _is_ running properly--including recording the time course of variables--and that's what counts.

The "bad" news is that I can't reproduce your observations.
the value does not match the one that is specified in the code.
The value of what variable? Everything is working exactly as you specified, and the numerical results are correct. Everything that happens in the course of a simulation agrees with predictions based on a careful walkthrough of your code, and analysis of the properties and behavior of the model that your code specifies.
As I specified the seclamp.rs using play() as 1e2, however the recorded rs is all 1
No, I just ran your code and examined the contents of sers_trace_sample_soma.dat. SEClamp.rs is exactly 100 megohms throughout the entire stimulation.
the recorded seclamp shows -5,-0.5016,-0.0521
No, I just ran your code and examined the contents of sei_trace_sample_soma.dat. SEClamp.i is -0.05 nA at t == 0 ms, and -0.2 nA for the rest of the simulation.
how is the seclamp.i computed?
Ohm's law. It's
(command potential - membrane potential) / clamp series resistance

Your code assigned a very large value to g_pas: almost 40000 S/cm2. This is at least 10^7 times larger than the specific membrane conductance of any biological neuron. Consequently your model cell has a negligible membrane time constant, and is a close approximation to an ideal -50 mV voltage source in series with an extremely small resistor (many orders of magnitude smaller than a megohm). This is why the SEClamp, with its 100 megohm series resistance, has no effect on membrane potential.

During a simulation, the model cell's membrane potential soma.v(0.5) starts at -65 mV at t == 0 ms because that's the default initial membrane potential (your code didn't specify a different value).

The membrane time constant is so small that soma.v(0.5) settles to -50 mV by the end of the first time step (t == 0.1 ms), and stays there for the rest of the simulation.

What about SEClamp.i? The command potential is -70 mV for the first 100 ms, and soma.v(0.5) starts at -65 mV, so SEClamp.i starts at -0.05 nA at t == 0 ms. But by t == 0.1 ms, soma.v(0.5) is -50 mV, so SEClamp.i stays at -0.2 nA from 0.1 ms until t == 100 ms.

t == 100 ms is when the SEClamp turns off--stops delivering current. Why? because t == 100 ms is the end of SEClamp.dur1, and both dur2 and dur3 are 0 ms. And this is why SEClamp.i falls to 0 at t == 100 ms and stays there for the rest of the simulation.
Post Reply