I'm just starting to wrap my head around LFPs, the extracellular mechanism, and the role the extracellular mechanism can play in calculating a local field potential (LFP).
I looked through its entry in the old reference, but I can't find a proper entry for it in the new documentation, nor can I find the actual mechanism definition in my NEURON tree (searching for 'SUFFIX extracellular' or an extracellular.mod file). I was looking for the definition to get a better idea of how i_membrane works.
I also just downloaded the sample code from the Extracellular stimulation and recording post, which looks quite helpful. But for that, I see that it is calculating an LFP for a cell that is being stimulated by an intracellular current injection or an extracellular current injection. Now I'm trying to figure out what I would do differently for a detailed model of a single real cell, that is being stimulated by 100s or 1000s of netstims connected to various synapses on the cell. Note that even though I am using parallel code, for now I am just running this model for onecell on oneprocessor and haven't yet considered how I would need to modify things if I have multiple cells and/or multiple processors.
My first attempt at using the example code in my model resulted in all 0s for vrec. Looking through the forum*, I saw Ted's comment in this post that
But I *think* I got all of the necessary functionality for considering the spatial distribution of the model cell compartments from the example into my model code, namely the calcrx and grindaway functionality, and I call "define_shape()" on my model after specifying L and diam for each compartment, so it should have all the 3d point info necessary. I also checked my cell's position, which at (1.17,0,0) seems close enough to the recording electrode's location of (50,0,0). But just in case I tried moving the electrode to (5,0,0) and the vrec was still always 0.A more important one is that the spatial distribution of current sources and sinks must also be taken into consideration. Simply adding up all transmembrane currents at any time in the simulation will produce a net result of 0.
Then, I wondered if the i_membrane actually knows about synaptic currents. From another post, I saw that Ionic and capacitive current are included:
But then I found this post that says thatUse extracellular's i_membrane, which includes all ionic currents and membrane capacitive current.
NONSPECIFIC_CURRENTs, such as those in my model synapses, are also included:
I added print statements to my xtra mechanism to confirm that xtra's er was non-zero during the simulation and it was. Since I am not using an extracellular stimulating electrode, I guess I won't be playing anything into is, and therefore the is and ex within xtra should always be 0.Then membrane current density will be available to you as i_membrane, and this value will include contributions from membrane capacitance plus all all ionic species and all NONSPECIFIC_CURRENTs.
Then I realized that the problem was in redefining the advance() proc to include the calculation step:
Because I am running the simulation using pc.psolve(), which never calls advance(). The recommended alternative was to create a mod file that performs the necessary calculation after every SOLVE. In my case, looking through the fieldrec() function, I think I can accomplish its calculations by adding the following lines to my xtra mechanism:proc advance() {
fadvance()
fieldrec()
}
Code: Select all
GLOBAL lfp : added to the NEURON block
lfp (microvolts) : added to the ASSIGNED block
lfp = 0 : added to the BEFORE BREAKPOINT block
lfp = lfp + er : added to the end of the INITIAL and AFTER SOLVE blocks
Code: Select all
myvrec.record(&lfp_xtra)
1. Set up an event handler that calls the fieldrec() function every so often during psolve(), and then, for several values of t, compared the values generated from the fieldrec() function with those recorded into my vector from lfp_xtra:
Code: Select all
objref fihw
fihw = new FInitializeHandler(2, "midbal()")
proc midbal() {local wt, thisstep
print "at time t = ", t, ", the vrec was ", fieldrec()
cvode.event(t+10, "midbal(0)")
}
Code: Select all
cvode.cache_efficient(0) // 0 off, 1 on
* the search function of the forum doesn't return anything if I search for "LFP" though I see a lot of posts with that abbreviation. I was still able to access a bunch of relevant ones with "local field potential" anyway.