Page 1 of 1

Changing parameter values doesn't work

Posted: Mon Dec 22, 2014 2:10 am
by breakwave922
Hi,
I have some problems in my single-cell model codes.
In order to make my tuning easily, I use nrnsecmenu to pull up all the range variables to GUI interface.
But among all the variables, changing two of them doesn't work, i.e. it didn't affect the outcome at all; the results always stay exactly the same, which shouldn't happen. However, if I directly change the variable values in template hoc file itself, it works, which means I can see the different outcomes with varied variable values.

Here is the cell template that I created:

Code: Select all

begintemplate Cell_B

public soma, connect2target, type
public all

create soma
access soma // declares soma as a membrane compartment object
	public ncl, synlist
	objref ncl, synlist
	strdef type	

     /////biophysical properties/////
proc init() {

	create soma // create soma in the initialization
	ncl = new List()
	synlist =new List()		
	type = "Cell_B"
	
	gUnf_Xsoma = 2.5e-05
	Rm = 80000 // decreased overall
	SpineScale = 1.76371308 //2
	SpineScale_leak = 1.763714578
	RaAll= 200
	RaSoma= 146.969697 //200 
	RaAxIs = 100//100//200
	Vpas = -65//-69 // -67
	gna =  0.039//.03*0.6*1.5 //.03*0.6*1.5 /* decreased from 0.03 */
	AXONM = 3 /*decrease from 2 */
	gkdr = 0.005*.6 /* decreased from 0.005 */
	ghd=0.000003 *.7
	nash=10
	Vrest = -67
	celsius = 31.0 
	gsAHP = 0.0014//0.0005
	GmC = 0.0096//0.0085//0.006 //0.0035 //0.0006

     /////geometrical properties/////
soma {nseg = 1 L = 117.77 diam = 24.5} // L = 55.2
	
	soma {
		
		insert leak el_leak=Vpas glbar_leak = 2e-5 Ra=RaAll cm=2.5 //different values in the thress compartment model
		insert nap  gbar_nap= 0.00113 ataum_nap = 1.6 vhalf_nap = -48//8e-4 //4.5e-4
		insert im gmbar_im = GmC ataun_im = 1//same value in the three compartment model
		ena = 45
		ek = -80
		if (ismembrane("kdr") || ismembrane("kap") || ismembrane("kad")) {ek=-80} //???
		if (ismembrane("hd") ) {ehd_hd=-43 } // change from -30 to -50 //???
		}
}
obfunc connect2target() { localobj nc
	soma nc = new NetCon(&v(0.5), $o1)
	nc.threshold = 0
	if (numarg() == 2) ($o2 = nc)
	return nc
	}
endtemplate Cell_B
The problem is in nap channel. Tuning gbar_nap works well in the GUI, but the other two, ataum_nap and vhalf_nap does not, unless I changed the values directly in the template.

Here is nap.mod:

Code: Select all

INDEPENDENT { t FROM 0 TO 1 WITH 1 (ms) }

UNITS { 
	(mV) = (millivolt) 
	(mA) = (milliamp) 
} 
NEURON { 
	SUFFIX nap
	USEION na READ ena WRITE ina
	RANGE gbar, ina, minf, mtau, gna, ataum, vhalf  :, vshift
}

PARAMETER { 
	gbar = 1e-4 	(mho/cm2)
	:vshift = 0
	v ena 		(mV)  
	ataum = 1
	vhalf = -48
} 
ASSIGNED { 
	ina 		(mA/cm2) 
	minf 		(1)
	mtau 		(ms) 
	gna		(mho/cm2)
} 
STATE {
	m
}

BREAKPOINT { 
	SOLVE states METHOD cnexp
	gna = gbar * m
	ina = gna * ( v - ena ) 
} 

INITIAL { 
	rate(v)  :-vshift
	m = minf
	:m = 0
} 

DERIVATIVE states { 
	rate(v) :-vshift
	m' = ( minf - m ) / mtau 
}
UNITSOFF
 
PROCEDURE rate(v) { 
	TABLE minf, mtau FROM -120 TO 40 WITH 641

	: minf  = 1 / ( 1 + exp( ( - v - 48 ) / 10 ) )
	minf  = 1 / ( 1 + exp( ( vhalf - v ) / 5 ) )
	if( v < -40.0 ) {
		mtau = ataum*100*(0.025 + 0.14 * exp( ( v + 40 ) / 10 ))
	}else{
		mtau = ataum*100*(0.02 + 0.145 * exp( ( - v - 40 ) / 10 ))
		}
		UNITSON
}
It's very weird, why only gbar_nap works in GUI interface, but ataum and vhalf are not.

Thanks in advance.

Re: Changing parameter values doesn't work

Posted: Tue Dec 23, 2014 11:36 pm
by ted
I don't have any problems changing any of nap's parameters via the nrnsecmenu panel. Have you verified what you're doing in a model that has only one cell, where that cell has only one segment? Make whatever changes you like with the parameter panel, then execute psection() and see if the parameter changes have indeed taken effect.

Re: Changing parameter values doesn't work

Posted: Fri Dec 26, 2014 2:13 am
by breakwave922
ted wrote:I don't have any problems changing any of nap's parameters via the nrnsecmenu panel. Have you verified what you're doing in a model that has only one cell, where that cell has only one segment? Make whatever changes you like with the parameter panel, then execute psection() and see if the parameter changes have indeed taken effect.
Hi, Ted,
Thanks for your time. I verified that, the model indeed has only one cell with one segment.
I still didn't see anything changed after I varied ataum_nap in nrnsecmenu panel. Do you mind if I send you the codes via email?

Re: Changing parameter values doesn't work

Posted: Sat Dec 27, 2014 10:40 pm
by ted
Sure. Follow the recommendations in
What to include in a zip file, and what to leave out
viewtopic.php?f=28&t=560
and send the file to
ted dot carnevale at yale dot edu

Re: Changing parameter values doesn't work

Posted: Mon Dec 29, 2014 4:45 pm
by ted
I see the problem, and should have seen it from the start. It's in the TABLE statement
TABLE minf, mtau FROM -120 TO 40 WITH 641
The problem is that the values in the tables for minf and mtau depend on vhalf and ataum, but NMODL has not been told that it needs to recompute those tables if vhalf or taum is changed. What happens is that NEURON computes the contents of these tables using whatever the values of vhalf and taum happen to be at the time the insert nap statement is executed, but it doesn't recompute them after you change vhalf or taum.

The fix is either to comment out the TABLE statement, or revise it so that the dependence is explicit, like this
TABLE minf, mtau DEPEND vhalf, taum FROM -120 TO 40 WITH 641

Re: Changing parameter values doesn't work

Posted: Mon Dec 29, 2014 6:49 pm
by breakwave922
Hi, Ted,

Yes. The problem is solved. Thanks for you time.