Page 1 of 1

conductance distribution

Posted: Mon Dec 10, 2007 12:55 pm
by thats_karlo
Hi,
I'm going to set different values for conductance in each compartment as follow:

Code: Select all

create A
A {L=100 diam=20 nseg=7}
insert pas
insert hh

A {                
      for (x){
            
                if (x==0){ 
                          gnabar_hh(x)= exp(-x*L+L)                          
                          print "x=",x,"          ",gnabar_hh(x)
                }else if (x==1){
                          gnabar_hh(x)= exp(-x*L+L/2)
                          print "x=",x,"          ",gnabar_hh(x)
                }else{  
                          gnabar_hh(x)= exp(-x*L+2*L)
                          print "x=",x,"          ",gnabar_hh(x)      
                }
                        
             }
    }
            
print "============================="

A {for (x) print "x=",x,"          ",gnabar_hh(x)  }     
but the results in the first loop and second one is not the same. do you have any idea why? did i make a mistake?

Re: conductance distribution

Posted: Tue Dec 11, 2007 7:13 am
by csh
thats_karlo wrote:

Code: Select all

create A
A {L=100 diam=20 nseg=7}
By specifying nseg=7, section A will have exactly 7 segments, no more and no less. Each of these segments will have one node at its midpoint "at which the voltage of the segment is defined", to cite from chapter 5 of the NEURON book. Although there are also terminal nodes at the 0 and 1 ends, "no membrane properties are associated with them so the voltage at these terminal nodes is defined by a simple algebraic equation (the weighted average of the potential at adjacent internal nodes) ..." (again, chapter 5). Hence, by specifying a range variable at a terminal node, you will in fact specify its value for the whole segment that this terminal end belongs to. In your example, you first specified gnabar_hh for the first segment (x == 0):

Code: Select all

if (x==0){ 
    gnabar_hh(x)= exp(-x*L+L)                          
    print "x=",x,"          ",gnabar_hh(x)      
}
and then, you overwrote this assignment during the next iteration of the loop (x == 0.5/7):

Code: Select all

} else {
    gnabar_hh(x)= exp(-x*L+2*L)
    print "x=",x,"          ",gnabar_hh(x)      
}
This means that gnabar_hh in the first segment had changed between the two calls to

Code: Select all

print "x=",x,"          ",gnabar_hh(x)
, which is why the second loop gave you a different output.
Christoph

Posted: Tue Dec 11, 2007 9:39 am
by ted
Thank you, Christoph, that was an exellent explanation.

Posted: Tue Dec 11, 2007 10:31 am
by thats_karlo
Thank you so much!