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.