// Dorea Vierling-Claassen 2010
// Call all relevant processes and run sim for 600ms, note that simulations for paper were 15100 
// ms and then averaged over fifteen 1 second blocks
// (the first 100 ms were disregarded, see Vierling-Claassen et al., 2010 for further info on 
// processing)

tstop=600
//tstop=15100

// Sets dimensions of grid in which cells are placed 
// (in this case, 6X6, for a total of 36 pyramidal cells)

X_DIM = 6
Y_DIM = 6

// center of spatial decay for for drive 
FSx=2 
FSy=2

load_file("nrngui.hoc")

// This file defines cell morphology, intrinsic currents, and synaptic dynamics
load_file("lightgamma_network_DB.hoc")

// processes for wiring between populations, depends on files controlling random connectivity 
// in confiles folder, connectivity is fixed for all runs
load_file("lightgamma_wiring_DB.hoc")

// commands for light drive
load_file("lightgamma_wiring_proc_DB.hoc")


// Intra-cortical wiring
load_file("lightgamma_localconn_DB.hoc")

// Define light drive objects
objref FB

FB = new FeedX() // Feed-Back (eg. Pre-frontal input) 
FB.pp.MeanInterval=1000/8

// connect drive to cortex (needs to come after defn of FF)
load_file("lightgamma_drive_DB.hoc")

// add background noise to cells, modification of Destexhe et al 2001 noise
load_file("lightgamma_noise_DB.hoc")

//generate average over pyramidal cell voltages
load_file("lightgamma_LFP_DB.hoc")

// important to set temperature!
forall celsius=30