hello sir,
i am a new learner of neuron. I use comsol to get the voltage distribution along the nerve and saved in a txt file, now i want to use this voltage distribution as the stim for a existed model. but i dont know how to add this to the model.
nomally, in the model the way to add stimulation to the nerve is like
" objef stim
stim= new IClamp(.5)
stim.dur=.12
stim.amp=1"
so how should i do if the stim is saved in a txt file which is the voltage function of time for a given point of the nerve or voltage for different points at a given time?
thanks a lot.
how to add a stimulation signal from a txt file to the model

 Posts: 38
 Joined: Fri Aug 27, 2010 7:23 am

 Site Admin
 Posts: 5841
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: how to add a stimulation signal from a txt file to the model
If "voltage distribution along the nerve" means extracellular potential, the answer involves using NEURON's extracellular mechanismseemelissamou wrote:I use comsol to get the voltage distribution along the nerve
http://www.neuron.yale.edu/neuron/stati ... racellular
The basic idea is
1. During model setup, set extracellular's parameters so that each segment's vext node is effectively connected directly to that segment's e_extracellular, and isolated from the vext nodes of the neighboring segments.
2. During a simulation, force each segment's e_extracellular to follow the corresponding voltage waveform that you previously calculated with comsol.
This requires that either (A) you know the location in space of the center of each segment of your model nerve, before you do your comsol calculations, or (B) you compute the potential in space with comsol for an arbitrary grid, and from those results you interpolate the potentials that you need for your NEURON simulation.
Step 2 is easiest if the extracellular medium is linear and ohmic, so that the potential at any point in space is the weighted sum of the currents applied to the stimulating electrodes.
Let me know if this makes sense to you, and our discussion can then proceed.

 Posts: 38
 Joined: Fri Aug 27, 2010 7:23 am
Re: how to add a stimulation signal from a txt file to the model
Hi Ted,
I am very sorry for a delay reply and many thanks for your quick and detailed reply.
yes, "the voltage distribution along the nerve" means extracellular potential.
now my neuron model is Xenopus Myelinated Neuron , and i found a example model in the modelDB:http://senselab.med.yale.edu/modeldb/Sh ... model=3507. however, it uses IClamp function to stimulate the axon and i want to use extracellulr potential to stimulate the axon, the extracellular potential should be read from a txt file which is the result of the comsol.
so i think there should be two points need to be changed. 1 is the coordinate of the neuron, which should corresponding to the coordinate of the point in the comsol model. 2 is to read potential from the txt file, it canbe realised by vec.play(&rangevar, tvec) as far as i know. and i saw a guy have writen a program as following,
"proc SetStim() { localobj tmp,tmpvec
i = 1
veclist = new List()
f = new File()
tmp = new Matrix()
tvec = new Vector()
tmpvec = new Vector()
f.ropen("G:/NEURON/MyFile/Model2/information/NewLocaBase67.txt")
// f.ropen("information/ExpDecA0511.txt")
tmp.scanf(f, n_row, n_col)
tvec = tmp.getcol(0)
// tvec = tvec.div(1000)
forsec neurite {
for(x) {
tmpvec = tmp.getcol(i)
tmpvec = tmpvec.mul(1)
tmpvec.play(&e_extracellular(x), tvec)
veclist.append(tmpvec)
i +=1
}
}
}
NewLocaBase67.txt is the result of comsol.
and in his program there is also a function which i don't understand, what is it used for?
proc GetSL() { local d_temp, n localobj tmp
tmp = new SectionList()
forall {
tmp.append()
}
forsec"hill" tmp.remove()
forsec"iseg" tmp.remove()
forsec"myelin" tmp.remove()
forsec"node" tmp.remove()
dendritic = new SectionList()
forsec tmp {
d_temp = diam
n = L/50
nseg = n+1
if (n3d() == 0) {
diam = d_temp
}
dendritic.append()
}
neurite = new SectionList()
forsec dendritic neurite.append()
forsec"hill" neurite.append()
forsec"iseg" neurite.append()
forsec"myelin" neurite.append()
forsec"node" neurite.append()
sorry for disturbing you, i just dont know how to add the potential from my comsol to the Xenopus Myelinated Neuron model.
any advice is appreciated to me, thanks a lot
I am very sorry for a delay reply and many thanks for your quick and detailed reply.
yes, "the voltage distribution along the nerve" means extracellular potential.
now my neuron model is Xenopus Myelinated Neuron , and i found a example model in the modelDB:http://senselab.med.yale.edu/modeldb/Sh ... model=3507. however, it uses IClamp function to stimulate the axon and i want to use extracellulr potential to stimulate the axon, the extracellular potential should be read from a txt file which is the result of the comsol.
so i think there should be two points need to be changed. 1 is the coordinate of the neuron, which should corresponding to the coordinate of the point in the comsol model. 2 is to read potential from the txt file, it canbe realised by vec.play(&rangevar, tvec) as far as i know. and i saw a guy have writen a program as following,
"proc SetStim() { localobj tmp,tmpvec
i = 1
veclist = new List()
f = new File()
tmp = new Matrix()
tvec = new Vector()
tmpvec = new Vector()
f.ropen("G:/NEURON/MyFile/Model2/information/NewLocaBase67.txt")
// f.ropen("information/ExpDecA0511.txt")
tmp.scanf(f, n_row, n_col)
tvec = tmp.getcol(0)
// tvec = tvec.div(1000)
forsec neurite {
for(x) {
tmpvec = tmp.getcol(i)
tmpvec = tmpvec.mul(1)
tmpvec.play(&e_extracellular(x), tvec)
veclist.append(tmpvec)
i +=1
}
}
}
NewLocaBase67.txt is the result of comsol.
and in his program there is also a function which i don't understand, what is it used for?
proc GetSL() { local d_temp, n localobj tmp
tmp = new SectionList()
forall {
tmp.append()
}
forsec"hill" tmp.remove()
forsec"iseg" tmp.remove()
forsec"myelin" tmp.remove()
forsec"node" tmp.remove()
dendritic = new SectionList()
forsec tmp {
d_temp = diam
n = L/50
nseg = n+1
if (n3d() == 0) {
diam = d_temp
}
dendritic.append()
}
neurite = new SectionList()
forsec dendritic neurite.append()
forsec"hill" neurite.append()
forsec"iseg" neurite.append()
forsec"myelin" neurite.append()
forsec"node" neurite.append()
sorry for disturbing you, i just dont know how to add the potential from my comsol to the Xenopus Myelinated Neuron model.
any advice is appreciated to me, thanks a lot

 Site Admin
 Posts: 5841
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: how to add a stimulation signal from a txt file to the model
That is a computational model of the node of Ranvier. It contains only a single electrical compartment. It is not a model of a myelinated axon.melissamou wrote:my neuron model is Xenopus Myelinated Neuron , and i found a example model in the modelDB:http://senselab.med.yale.edu/modeldb/Sh ... model=3507.
Much more needs to be done before getting anywhere close to the question of "how to compute the extracellular field with Comsol" let alone "how to read values from a text file generated by Comsol." If your conceptual model is a myelinated axon, it must involve nodes and internodes, so the computational implementation of your conceptual model must also have nodes and internodes. And until you have created a computational implementation of your conceptual model, you don't know the coordinates in space at which to compute the extracelluar field with Comsol.i think there should be two points need to be changed. 1 is the coordinate of the neuron, which should corresponding to the coordinate of the point in the comsol model. 2 is to read potential from the txt file
Hints
A. In a NEURON model, the coordinates will be the centers of segments.
B. In my previous message I pointed you to source code for a program that, among other things, computes the locations of segment centers. The program also computes the extracellular potentials generated by a monopolar stimulating electrode in an infinite isotropic resistive medium.
If you prefer to use potentials computed by Comsol, the program can be modified to do that. However, your tasks at this point are:
1. come up with a conceptual model of a myelinated axon
2. implement it with NEURON
3. use the source code to which I pointed you, with your computational model of a myelinated axon, in order to make sure that your model is working properly AND to discover the coordinates at which Comsol should compute the local extracellular potential
4. use Comsol to compute the time course of local extracellular potential at those points
Only after step 4 will it be time to dive into the details of how to use the computed extracellular potentials to drive your model. In brief outline, the key steps are reading the extracellular waveforms from text files into one or more Vectors, then using the Vector(s) to drive e_extracellular along the model axon during a simulation. Implementational details depend on whether or not the extracellular medium is ohmic. But first things firstuntil you have done steps 14, this last part is a distraction.

 Posts: 38
 Joined: Fri Aug 27, 2010 7:23 am
Re: how to add a stimulation signal from a txt file to the model
hello Ted,
Thanks very much for your advice which is really very usefull to me, by the way, what do you mean the
insert extracellular
vext[2]  mV
i_membrane  mA/cm2
xraxial[2]  MOhms/cm
xg[2]  mho/cm2
xc[2]  uF/cm2
e_extracellular  mV
Thanks very much for your advice which is really very usefull to me, by the way, what do you mean the
is it themelissamou wrote:B. In my previous message I pointed you to source code for a program that, among other things, computes the locations of segment centers. The program also computes the extracellular potentials generated by a monopolar stimulating electrode in an infinite isotropic resistive medium.
but there is only these code:ted wrote:If "voltage distribution along the nerve" means extracellular potential, the answer involves using NEURON's extracellular mechanismsee
http://www.neuron.yale.edu/neuron/stati ... racellular
insert extracellular
vext[2]  mV
i_membrane  mA/cm2
xraxial[2]  MOhms/cm
xg[2]  mho/cm2
xc[2]  uF/cm2
e_extracellular  mV

 Site Admin
 Posts: 5841
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: how to add a stimulation signal from a txt file to the model
My mistake. My previous msg only contained a link to the Programmer's Reference documentation of the extracellular mechanism. Instead I should have pointed you to the topic
Extracellular stimulation and recording
in the "Hot tips" area viewforum.php?f=28 of the NEURON Forum
Extracellular stimulation and recording
in the "Hot tips" area viewforum.php?f=28 of the NEURON Forum