//Created by Paulo Aguiar [pauloaguiar@fc.up.pt]

// CREATE WDR NEURON

begintemplate WDR

public soma, dendrite, hillock, axon

create soma, dendrite, hillock, axon

proc init() {
    
    create soma    
    soma {    
			nseg = 3  
			L = 20.0
			diam = 20.0
	
			//HH channels: iNat and iK
			insert HH2 {
	  	  gnabar_HH2 = 0.08
	 		  gkbar_HH2 = 0.02
	 	  	vtraub_HH2 = -55.0
			}
	
	//intracellular Ca dynamics
	insert CaIntraCellDyn {
	    depth_CaIntraCellDyn = 0.1
	    cai_tau_CaIntraCellDyn = 1.0
	    cai_inf_CaIntraCellDyn = 50.0e-6
	}
	
	//high-voltage activated long-lasting calcium current, L-type
	insert iCaL {
	    pcabar_iCaL = 0.0001 //0.0001 - IMPORTANT: this current drives the (activity control) somatic iKCa current
	}       
	
	//non-specific current dependent on intracellular calcium concentration 
	insert iCaAN {
	    gbar_iCaAN = 0.0 //0.0
	}    
	
	//potassium current dependent on intracellular calcium concentration 
	insert iKCa {
	    gbar_iKCa = 0.0001 //0.0001
	}
	
	//sodium persistent current
	insert iNaP {
	    gnabar_iNaP = 0.0001 //0.0001
	}    
	
	ek = -70.0
	
	Ra = 150.0
	
	insert pas
	g_pas = 4.2e-5
	e_pas = -65.0
    }
    
    create dendrite
    dendrite {    
	nseg = 5    
	L = 500.0        
	diam = 4.0
	
	//intracellular Ca dynamics
	insert CaIntraCellDyn {
	    depth_CaIntraCellDyn = 0.1
	    cai_tau_CaIntraCellDyn = 2.0
	    cai_inf_CaIntraCellDyn = 50.0e-6
	}
	
	//high-voltage activated long-lasting calcium current, L-type
	insert iCaL {
	    pcabar_iCaL = 3.0e-5 //3.0e-5 IMPORTANT: this current is important for activity control (drives the iKCa current)
	}                 
	
	//non-specific current dependent on intracellular calcium concentration 
	insert iCaAN {
	    gbar_iCaAN = 0.00007 //0.00007; This is a sensible parameter
	    //higher values of gbar_iCaAN produce graphs similar to Silviloti et al 93
	}        
	
	//potassium current dependent on intracellular calcium concentration 
	insert iKCa {
	    gbar_iKCa = 0.001 //0.001; higher values place "holes" in the scatter plot, resulting from the cai bump after synaptic activation);
		//naturally, lower values will lead to increased firing
	}
	
	ek = -70.0
	
	Ra = 150.0
	
	insert pas
	g_pas = 4.2e-5
	e_pas = -65.0
    }
    
    
    create hillock
    hillock {   
	nseg = 3  
	L = 3
	diam(0:1) = 2.0:1.0
	
	//HH channels: iNa,t and iK
	insert HH2 {
	    gnabar_HH2 = 0.1
	    gkbar_HH2 = 0.04
	    vtraub_HH2 = -55.0
	}
	
	Ra = 150.0
	
	insert pas
	g_pas = 4.2e-5
	e_pas = -65.0
    }
    
    create axon
    axon {    
	nseg = 5
	L = 1000.0
	diam = 1.0
	
	//HH channels: iNa,t and iK
	insert HH2 {
	    gnabar_HH2 = 0.1
	    gkbar_HH2 = 0.04	//0.04
	    vtraub_HH2 = -55
	}
	
	Ra = 150.0
	
	insert pas
	g_pas = 4.2e-5
	e_pas = -65.0
    }
    
    
    //CONNECTIONS
    soma connect hillock(0),1
    hillock connect axon(0),1
    soma connect dendrite(0),0 
    
}


endtemplate WDR





//************************************************************************************
//UNITS	    
//Category									Variable			Units
//Time											t							[ms]
//Voltage										v							[mV]
//Current										i							[mA/cm2] (distributed)	[nA] (point process)
//Concentration							ko, ki, etc.	[mM]
//Specific capacitance			cm						[uf/cm2]
//Length										diam, L				[um]
//Conductance								g							[S/cm2] (distributed)	[uS] (point process)
//Cytoplasmic resistivity		Ra						[ohm cm]
//Resistance								Ri						[10E6 ohm]