Trouble with creating ions

NMODL and the Channel Builder.
Post Reply
Posts: 27
Joined: Fri Sep 07, 2012 1:02 pm

Trouble with creating ions

Post by Annik »

I've created a few new ions using ion_style, but it seems that they're not working correctly.

Code: Select all

// register the new ions with NEURON
cltype    = ion_register("cl",-1)
hco3type  = ion_register("hco3",-1)
catype    = ion_register("ca",2)

forall {
	kstyle      = ion_style("k_ion",1,2,1,0,1)     
	nastyle     = ion_style("na_ion",1,2,1,0,1)          
	clstyle     = ion_style("cl_ion",3,2,1,1,1)
	hco3style   = ion_style("hco3_ion",1,2,1,0,1)
	castyle     = ion_style("ca_ion",3,2,1,0,1)
However, when I try to set the initial concentrations (in a set parameters hoc file that is called right after I make the ions), it doesn't work. It uses ion concentrations specified in the mod files instead.
My setParameters.hoc file says:

Code: Select all

	// ions from makeIons.hoc  
ki0_k_ion      = 120   // mM 												
ko0_k_ion      = 3   // mM 												
nai0_na_ion      = 5   // mM 												
nao0_na_ion      = 120   // mM 												
cli0_cl_ion           = 6   // mM 												
clo0_cl_ion         = 125   // mM 												
hco3i0_hco3_ion      = 10   // mM 												
hco3o0_hco3_ion      = 25   // mM 												
cai0_ca_ion          = 45.5E-6   // mM = 32-59 nM (as given in Maravall, et al. 2000, J Biophys.)
cao0_ca_ion 	  = 0.546   // mM
Am I naming the ions wrong? I did this according to the specifications in ... #ion_style
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Trouble with creating ions

Post by ted »

Annik wrote:I've created a few new ions using ion_style
Yes, but why? If your model cell uses mechanisms specified in NMODL or with the Channel Builder, hoc will automatically have the necessary ions. Yes, I know that ion_register() is documented in the Programmer's Reference, but I have never had the need to use it in code that I write, nor does it appear in any human-written code for any of the published NEURON models in ModelDB. The only time I have ever seen it in any code is in the computer-generated code that is written to a Channel Builder session file.

As far as ion_style statements are concerned, most models don't need them because NEURON has a set of rules by which it automatically adopts a default "style" for each ionic species that is present in a section, based on the Channel Builders that are inserted intl the section and the USEION statements for all NMODL-specified mechanisms that are present in a section. These rules (you'll find them in the Programmers' Reference of ion_style) make the correct guess more than 95% of the time--ModelDB has > 800 NEURON models, each of which has at least 1 hoc file, but only 46 of them contain an ion_style statement.

So you don't need to write ion_register statements--in fact you should get rid of any that you have written. And you don't need to write any ion_charge statements either. Also, there's a good chance that you don't need any ion_style statements*, so you should at the very least convert all of those to comments. Then see if your code allows you to set initial ionic concentrations, and verify that you get the results that you want.**

*--When might you actually need ion_style statements? Suppose a model has some channels that WRITE ica, and a calcium accumulation mechanism that READs ica and WRITES cai. By default, eca would be calculated from the Nernst equation at every time step, but believe it or not, there are modelers who want cai to change but also want eca to be a parameter that remains constant throughout the simulation. To force this non-default treatment of calcium in the currently accessed section, you'd need an ion_style statement like this:
ion_style("ca_ion", 3, 1, 0, 0, x)
where x = 1 if you want initialization to set cai and cao equal to cai0_ca_ion and cao0_ca_ion, respectively,
or 0 if you want cai and ca0 to be specified by code in the calcium accumulation mechanism's INITIAL block.

**--Be very careful to check results. Initialization of ionic concentrations is a complex topic, and the correct strategy to use in any given situation depends on the modeler's intention and the details of the model's channel and accumulation mechanisms. Simply assigning the "default" concentrations to cai and cao is not always the proper choice. This is discussed in more detail in chapter 8 of The NEURON Book.
Post Reply