nrniv error during calculation of ca_ion

Anything that doesn't fit elsewhere.
Post Reply
Posts: 127
Joined: Sat Apr 22, 2006 4:28 am

nrniv error during calculation of ca_ion

Post by Keivan » Thu Apr 12, 2007 5:05 pm

I'm trying to combine two available models from model database.
One of them (my main model) is a detailed morphological model of CA1 pyramidal cell created by Poirazi et al. ... odel=20212
this model has calcium channels beside different other mechanisms.

The other one is a one compartment model of a presynaptic axon created by Destexhe et al which models the release process and calculates amount of neurotransmitter in the synaptic cleft based on cai. ... odel=18198
I'm using the nmda5.hoc file from this model.

Each of these models has their own ion_style dealing with ca_ion.
They works properly when they are separate from each other. When I add the presynaptic axon to the poirazi et al model, the axon does not work after running the simulation. However, my main cell works properly. The error message is as follow:

Code: Select all

A math function was called with argument out of domain
errno=33 during call to mechanism ca_ion
nrniv: errno set during calculation of currents
 near line 97
I think I should separate the calculation of ca_ion in each cell. But I don't know how and I'm not sure this is the main reason.

My Template of the presynaptic axon

Code: Select all

begintemplate Pre_Cell

public axon
create axon

public pSet

proc init() {
	v_init  = $1

	axon {
  		nseg = 1
  		insert pas
		insert hh2
			ek = -90
			gnabar_hh2 = 0.1
			gkbar_hh2 = 0.03
		insert caL3d
		insert rel		// transmitter release
			Ves_rel = 0.01	// conc of vesicles (mM)
			Fmax_rel = 0.001 	// tot conc of proteins (F and V) (mM)
			b_rel	= 1e16  	// rate cst for Ca++ binding to fusion factor
			u_rel	= 0.1		// rate cst for Ca++ unbinding
			k1_rel	= 1000	// rate cst for activation of vesicle
			k2_rel	= 0.1		// rate cst for deactivation of vesicle
			k3_rel	= 4		// rate cst for exocytosis
			nt_rel	= 10000	// number of transmitter molecule per vesicle
			kh_rel	= 10		// transmitter hydolysis constant
			kd_rel = 1e-5
			kt_rel = 1e-3		// fast Ca++ removal
			depth_rel = 1
			taur_rel = 1e10
		ion_style("ca_ion", 3, 2, 1, 1, 1)
		cai0_ca_ion = kd_rel

proc pSet() {		//sets the calculated neurotransmiter in the presynaptic region to the postsynaptic receptors
	setpointer $o1.C, axon.T_rel(0.5)	

endtemplate Pre_Cell
My Experiment

Code: Select all

// The goal of this experiment is to evaluate the effect of 
//10 random synapses at different locations of the dendritic tree


strdef accstr        // not confuse experimental variable bindings with neurophysiological variable bindings
objref econ          // Create an experiment object
econ=new ExperimentControl(show_errs,debug_lev)
econ.self_define(econ) // points the object at itself		// Why we should point the object to itself? 
										// Answer: We want to use the objects defined in the ExperimentControl template in the template itself later
econ.morphology_dir = "../../morphology/n123"			// Setup morphology directory
econ.generic_dir = "../../experiment/"                      // Setup directory with cell-setup file
econ.add_lib_dir("Terrence","../../lib")                    // Setup directory with library functions 

if (unix_mac_pc() ==1 ) {
	econ.data_dir       = "data"                       // Define directory to save produced data 
	sprint(econ.syscmd, "mkdir -p %s", econ.data_dir)  // make the data directory

// Setup cell

econ.xopen_geometry_dependent("cell")              // load the raw cell morphology
econ.xopen_geometry_dependent("cell-analysis")     // load user-defined semantics on morphology 

printf("Opening cell setup\n")
econ.xopen_generic("cell-setup")                   // load the cell-setup file (define specific 
printf("Opened. Setting up cell\n")                // channels, membrane properties etc)

// Set simulation parameters for the experiment 

econ.defvar("Simulation Control", "tstop", "200", "Defines when the simulation stops.")
econ.defvar("Simulation Control", "dt", "0.1", "Timestep")
econ.defvar("Simulation Control", "steps_per_ms", "1", "How many points are plotted per ms")

// Create basic graphics
econ.xopen_library("Terrence","basic-graphics")                            // open graphics library file   

	//sections used in BPAP figure
	addgraph_2("soma.v(0.5)",              0,tstop,-72,-68)
	addgraph_2("apical_dendrite[46].v(0.5)",0,tstop,-72,-65)    // 156.96 um from soma
	addgraph_2("apical_dendrite[104].v(0.5)", 0,tstop,-72,-62)   // 423 um from soma

// Define directories for different cases tested
strdef data_dir
data_dir       = "../../experiment/Synaptic-Summation"          // Define directory to save produced data for dendrite 64 stimulation

if (unix_mac_pc() ==1 ) {
	sprint(econ.syscmd,  "mkdir -p %s", data_dir)                               // make directory

//Insert synaptic inputs

//  insert postsynaptic mechansisms

NMDA_AMPA_RATIO = 1/5			//AMPA conductance 5X NMDA conductance
synaps_numbers = 10			//Total amount of synapses


objectvar ampa[synaps_numbers], nmda[synaps_numbers]

objectvar random_sec, random_x
random_sec = new Random()	//random # generator used to select the sections
random_x = new Random()		//random # generator used to select the position of synpase of each section
random_sec.ACG(.5,98)		//we used different seeds for randomness

for i=0, (synaps_numbers-1) {
	ampa[i] = new AMPA5()
	nmda[i] = new NMDA10()
	str_lm_sec = int(random_sec.uniform(0, n_str_lm_list-0.001))
	x = random_x.uniform(0,1)

	str_lm_ref[str_lm_sec].sec ampa[i].loc(x)
	str_lm_ref[str_lm_sec].sec nmda[i].loc(x)
	ampa[i].gmax = AMPA_GMAX			//(pS)
	nmda[i].gmax = NMDA_GMAX

//control panel of nmda10 channel
Rb_NMDA10	= 5000e-3	//(/mM /ms)	: binding 		
Ru_NMDA10	= 5.5e-3  	//(/ms)		: unbinding		
Rd_NMDA10	= 8.4e-3   	//(/ms)		: desensitization
Rr_NMDA10	= 1.8e-3   	//(/ms)		: resensitization 
Ro_NMDA10	= 46.5e-3	//(/ms)		: opening
Rc_NMDA10	= 91.6e-3	//(/ms)		: closing
RBb_NMDA10	= 5000e-3	//(/mM /ms)		: Blocked binding
RBu_NMDA10	= 82e-3		//(/ms)		: Blocked unbinding
RBd_NMDA10	= 8.4e-3   	//(/ms)		: Blocked desensitization
RBr_NMDA10	= 1.8e-3		//(/ms)		: Blocked resenditization
RBo_NMDA10	= 46e-3		//(/ms)		: Blocked opening
RBc_NMDA10	= 270e-3		//(/ms)		: Blocked closing	

//Creating Presynaptic Cell
objref PRE, stim
PRE = new Pre_Cell(v_init)

//would enable the synapse to observe the amount of neurotransmiter in the synaptic cleft
//thus this functon connects the postsynaptic mechanism with presynaptic cells
for i=0, (synaps_numbers-1) {

PRE.axon stim = new IClamp(.5)
	stim.del = 10
	stim.dur = 190	// increase stim.dur to get a burst of presynaptic spikes
	stim.amp = 0.01
the ion_style of the experiment is located in the "cell-setup.hoc" file

Code: Select all

forall if(ismembrane("ca_ion")) {
      eca = 140
      vshift_ca = 0

Site Admin
Posts: 5628
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Post by ted » Fri Apr 13, 2007 9:48 am

Except in those happy instances where cause and cure are readily apparent, there is one
essential prerequisite to diagnosis: localization. That is, you must identify where the problem
arises. Complexity is the deadly enemy of debugging because it interferes with localization.
You must pare down the complexity of your model implementation if you are to discover
the cause of the error message. It seems reasonable to postulate that the problem arises
from attaching the Destexhe model, as a presynaptic element, to some part of the Poirazi
model, as a postsynaptic element, so your first step should be to isolate a piece of the
Poirazi model and make a single synaptic connection to it from a single instance of the
Destexhe model.

A couple of comments:
1. Code development and debugging are easier when code has a modular structure. Use
procs and funcs instead of long stretches of "top-level" hoc code. Try to keep model
specification code separate from code that accomplishes other tasks, e.g. user interface
simulation control, etc.
2. ACG is not a terribly good pseudorandom sequence generator. MCellRan4 has better
statistical properties.

Post Reply