Keivan wrote:I didn't know ek can be a parameter itself.
It all depends on what the modeler assumes. Many models ignore the fact that ionic currents can change concentrations. Such models lack ion accumulation mechanisms (an ion accumulation mechanism has a USEION statement that WRITEs the intra- and/or extracellular concentration of an ion). For such models, NEURON automatically treats that ion's equilibrium potential as a parameter that you can specify with a hoc statement, not a state variable that requires integration.
Other models allow concentrations to change; they have one or more accumulation mechanisms that WRITE the concentration of one or more ions. The equilibrium potentials of those ions are automatically calculated from the Nernst equation.
But some models allow concentrations to change but assume that equilibrium potentials remain constant. Most often this happens in a model that involves calcium accumulation, where cai can change but eca is fixed. NEURON would automatically treat eca as an ASSIGNED variable (assigned from the Nernst equation), but that wouldn't be what the modeler wants. This is a case in which the ion_style() function is helpful, because it can be used to specify that eca remains a parameter but cai is a state variable.
I didn't know my potassium channel have to WRITE ki or ko itself!!!!!
It doesn't. Only an ion accumulation mechanism would WRITE an ionic concentration--like the Frankenhaeuser-Hodgkin model of extracellular potassium accumulation.
This statement
doesn't tell me anything about how ek or ki or ko get their values. They could be parameters, assigned variables, or (in the case of ki or ko) states.
It means my potassium channel do not write ko, ki and ek. As I said before I want neuron to calculate ki, ko and ek for me. is it possible?
Then you need to implement a potassium accumulation mechanism that WRITEs ki and ko. Then NEURON will automatically calculate ek, and you won't need any ion_style() statements.
How I can calculate ki or ko (to calculate ek), when I have different types of potassium channels (each one them potentially can change the ki or ko)?
Your potassium accumulation mechanism would have a
USEION k READ ik, ki, ko WRITE ki, ko
statement. The "READ ik" part of this statement means that NEURON will tell this mechanism the total transmembrane potassium current from all sources--from every mechanism that exists in the section that has a "WRITE ik" statement. And NEURON would automatically use the Nernst equation to calculate ek from ki and ko. The Frankenhaeuser-Hodgkin mechanism would be a good place to start; with just a little change it would do exactly what you want.