def start(self):
        
        # iterating over all cells in simulation        
        for cell in self.cellList:
            # you can access/manipulate cell properties here
            cell.targetVolume=25
            cell.lambdaVolume=2.0

        #bionet section        
        modelName = "OSCLI"
        modelNickname  = "OSC" # this is usually shorter version version of model name
        
        fileDir=os.path.dirname (os.path.abspath( __file__ ))
        
        modelPath=os.path.join(fileDir,"oscli.sbml") 
        print "Path=",modelPath        
        
        integrationStep = 0.02
        bionetAPI.loadSBMLModel(modelName , modelPath, modelNickname, integrationStep)
        
        bionetAPI.addSBMLModelToTemplateLibrary("OSCLI","NonCondensing")
        
        bionetAPI.initializeBionetworks()
        
        
        # iterating over all cells in simulation        
        state={}
        for cell in self.cellList:         
            if cell.type==self.NONCONDENSING:
                state['S1']=0.0
                state['S2']=1.0
                bionetAPI.setBionetworkState(cell.id,'OSCLI',state) 
 def start(self):
   #Loading model
   Name = 'DeltaNotch'
   Key  = 'DN'
   
   simulationDir=os.path.dirname (os.path.abspath( __file__ ))
   Path= os.path.join(simulationDir,'DN_Collier.sbml')
   Path=os.path.abspath(Path) # normalizing path
   
   IntegrationStep = 0.2
   bionetAPI.loadSBMLModel(Name, Path, Key, IntegrationStep)
   
   bionetAPI.addSBMLModelToTemplateLibrary(Name,'TypeA')
   bionetAPI.initializeBionetworks()
   
   #Initial conditions
   import random 
   
   state={} #dictionary to store state veriables of the SBML model
   
   for cell in self.cellList:
     if (cell):
       state['D'] = random.uniform(0.9,1.0)
       state['N'] = random.uniform(0.9,1.0)        
       bionetAPI.setBionetworkState(cell.id,'DeltaNotch',state) 
       
       
       cell.dict['D']=state['D']
       cell.dict['N']=state['N']
 def start(self):
     
     # #################### Create SBML models ######################
     
     ## Load a Bionetwork SBML model named "SimpleExample"
     sbmlModelPath =  "Simulation/SimpleExample.sbml"
     bionetAPI.loadSBMLModel( "SimpleExample", sbmlModelPath, "SE", 0.5 )
     
     
     # ################ Add SBML models to Bionetwork Template Libraries ##################
     
     ## Add SBML model to non-cell bionetwork template libaries called "ExternalOscillatorA" and "ExternalOscillatorB"
     bionetAPI.addSBMLModelToTemplateLibrary( "SimpleExample", "ExternalOscillatorA" )
     bionetAPI.addSBMLModelToTemplateLibrary( "SimpleExample", "ExternalOscillatorB" )
     
     
     # ####### Set initial conditions for Bionetwork properties #########
     
     ## Set initial conditions for "ExternalOscillatorA" and "ExternalOscillatorB" bionetwork template libraries
     self.k1_init = 0.1; self.k2_init = 0.1; self.mcsPeriod = 500
     
     bionetAPI.setBionetworkInitialCondition( "ExternalOscillatorA", "SE_k1", self.k1_init )
     bionetAPI.setBionetworkInitialCondition( "ExternalOscillatorA", "SE_k2", self.k2_init )
     bionetAPI.setBionetworkInitialCondition( "ExternalOscillatorA", "SE_X0", 10.0 )
     
     bionetAPI.setBionetworkInitialCondition( "ExternalOscillatorB", "SE_k1", self.k1_init )
     bionetAPI.setBionetworkInitialCondition( "ExternalOscillatorB", "SE_k2", self.k2_init )
     bionetAPI.setBionetworkInitialCondition( "ExternalOscillatorB", "SE_X0", 10.0 )
     
     
     # ######## Create Bionetworks (integrators) and initialize their states ##########
     bionetAPI.initializeBionetworks()
     
     
     # ######## Perform initialization tasks and calculations ##########
     
     k1 = bionetAPI.getBionetworkValue( "SE_k1", "ExternalOscillatorA" )
     k2 = bionetAPI.getBionetworkValue( "SE_k2", "ExternalOscillatorA" )
     X0 = bionetAPI.getBionetworkValue( "SE_X0", "ExternalOscillatorA" )
     print "k1=",k1," k2=",k2," X0=",X0 
     self.steadyState = k1 * X0 / k2
     
     
     # #### Write bionetwork state variable names of external oscillators to output file
     self.oscillatorAFileName = "Demos/BionetSolverExamples/OscillatingContactEnergies/oscillatorStateA.txt"
     bionetAPI.writeBionetworkStateVarNamesToFile( "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "w" )
     
     self.oscillatorBFileName = "Demos/BionetSolverExamples/OscillatingContactEnergies/oscillatorStateB.txt"
     bionetAPI.writeBionetworkStateVarNamesToFile( "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "w" )
     
     
     # ############## Write adhesion data to an output file ################
     self.contactEnergyOutputFile = "Demos/BionetSolverExamples/OscillatingContactEnergies/contactEnergies.txt"
     self.writeContactEnergies( 0, self.contactEnergyOutputFile, "w" )
 def start(self):
     
     # #################### Create SBML models ######################
     sbmlModelName = "DeltaNotchModel"
     sbmlModelKey = "DN"
     sbmlModelPath =  "Simulation/MinimalDeltaNotch.sbml"
     timeStepOfIntegration = 0.1
     bionetAPI.loadSBMLModel( sbmlModelName, sbmlModelPath, sbmlModelKey, timeStepOfIntegration )
     
     # ################ Add SBML models to cell types ##################
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "LowDelta" )
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "HighDelta" )
     
     ## Include this for a test
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "External" )
     
     # ####### Set initial conditions for SBML properties #########
     bionetAPI.setBionetworkInitialCondition( "LowDelta", "DN_di", 0.2 )
     bionetAPI.setBionetworkInitialCondition( "HighDelta", "DN_di", 0.8 )
     
     for cell in self.cellList:
         cell.targetVolume = 32.0
         cell.lambdaVolume = 1.0
         cell.targetSurface = 32.0
         cell.lambdaSurface = 1.0
     
     # ######## Create bionetworks and initialize their states ##########
     bionetAPI.initializeBionetworks()
     
     # ######## Set cell initial conditions by individual cell ##########
     for cell in self.cellList:
         dictionaryAttrib = CompuCell.getPyAttrib( cell )
         dictionaryAttrib["InitialVolume"] = cell.volume
         dictionaryAttrib["DivideVolume"] = 2.*cell.volume
     
     self.initialNumberOfCells = len(self.cellList)
     print "\n\nNumber of cells: %s\n\n" % self.initialNumberOfCells
     
     import CompuCellSetup
     self.cellTypeMap = CompuCellSetup.ExtractTypeNamesAndIds()
     del(self.cellTypeMap[0])
 def start(self):
     
     # #################### Load SBML models ######################
     
     ## Create a bionetwork SBML model named "DeltaNotchModel"
     sbmlModelName = "DeltaNotchModel"
     sbmlModelKey = "DN"
     sbmlModelPath =  "Simulation/MinimalDeltaNotch.sbml"
     timeStepOfIntegration = 0.1
     bionetAPI.loadSBMLModel( sbmlModelName, sbmlModelPath, sbmlModelKey, timeStepOfIntegration )
     
     
     # ################ Add SBML models to celltype-specific bionetwork template libraries ##################
     
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "LowDelta" )
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "HighDelta" )
     
     ## Include this for a test
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "External" )
     
     # ####### Set initial conditions for SBML properties #########
     bionetAPI.setBionetworkInitialCondition( "LowDelta", "DN_di", 0.2 )
     bionetAPI.setBionetworkInitialCondition( "HighDelta", "DN_di", 0.8 )
     
     
     # ######## Create bionetworks and initialize their states ##########
     bionetAPI.initializeBionetworks()
     
     
     # ######## Set cell initial conditions by individual cell ##########
     for cell in self.cellList:
         
         cell.dict["InitialVolume"] = cell.volume
         cell.dict["DivideVolume"] = 2.*cell.volume
         cell.targetVolume = 32.0
         cell.lambdaVolume = 1.0
     
     import CompuCellSetup
     self.cellTypeMap = CompuCellSetup.ExtractTypeNamesAndIds()
     del(self.cellTypeMap[0])
 def start(self):
     
     # #################### Create SBML models ######################
     ## Create a bionetwork SBML model named "DeltaNotchModel"
     sbmlModelName = "DeltaNotchModel"
     sbmlModelKey = "DN"
     sbmlModelPath =  "Simulation/MinimalDeltaNotch.sbml"
     timeStepOfIntegration = 0.05
     bionetAPI.loadSBMLModel( sbmlModelName, sbmlModelPath, sbmlModelKey, timeStepOfIntegration )
     
     ## Create a bionetwork SBML model named "CadherinCatenin"
     sbmlModelPath =  "Simulation/CadherinCatenin_RamisConde2008.sbml"
     bionetAPI.loadSBMLModel( "CadherinCatenin", sbmlModelPath, "CC", 0.05 )
     
     ## Create a bionetwork SBML model named "BloodLiverPK"
     sbmlModelPath =  "Simulation/PK_BloodLiver.sbml"
     bionetAPI.loadSBMLModel( "BloodLiverPK", sbmlModelPath, "BLPK", 0.05 )
     
     ## Create a bionetwork SBML model named "SimpleExample"
     sbmlModelPath =  "Simulation/SimpleExample.sbml"
     bionetAPI.loadSBMLModel( "SimpleExample", sbmlModelPath, "SE", 0.05 )
     
     
     # ################ Add SBML models to bionetwork template libraries ##################
     
     ## Add SBML model to CellTypeA
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "CellTypeA" )
     bionetAPI.addSBMLModelToTemplateLibrary( "BloodLiverPK", "CellTypeA" )
     
     ## Add SBML models to CellTypeB
     bionetAPI.addSBMLModelToTemplateLibrary( "DeltaNotchModel", "CellTypeB" )
     bionetAPI.addSBMLModelToTemplateLibrary( "CadherinCatenin", "CellTypeB" )
     
     ## Add SBML models to CellTypeC
     bionetAPI.addSBMLModelToTemplateLibrary( "CadherinCatenin", "CellTypeC" )
     
     ## Add SBML models to CellTypeD
     bionetAPI.addSBMLModelToTemplateLibrary( "BloodLiverPK", "CellTypeD" )
     bionetAPI.addSBMLModelToTemplateLibrary( "SimpleExample", "CellTypeD" )
     
     # ####### Set initial conditions for SBML properties #########
     
     ## Set global (for all bionetwork template libraries) SBML initial conditions
     bionetAPI.setBionetworkInitialCondition( "Global", "DN_di", 0.4 )
     bionetAPI.setBionetworkInitialCondition( "Global", "CC_beta", 24 )
     
     bionetAPI.setBionetworkInitialCondition( "Global", "Ab", 1.1 )
     
     ## Set SBML initial conditions for CellTypeA
     bionetAPI.setBionetworkInitialCondition( "CellTypeA", "DN_ni", 0.8 )
     
     ## Set SBML initial conditions for CellTypeB
     bionetAPI.setBionetworkInitialCondition( "CellTypeB", "CC_Ebeta", 33.333 )
     bionetAPI.setBionetworkInitialCondition( "CellTypeB", "BLPK_A1", 0.44444 )
     
     ## Set SBML initial conditions for CellTypeC
     bionetAPI.setBionetworkInitialCondition( "CellTypeC", "CC_Ebeta", 4.32111 )
     bionetAPI.setBionetworkInitialCondition( "CellTypeC", "SE_S1", 0.66666666 )
     bionetAPI.setBionetworkInitialCondition( "CellTypeC", "CLK_Nan1", 0.55555 )
     
     ## Set SBML initial conditions for CellTypeD
     bionetAPI.setBionetworkInitialCondition( "CellTypeD", "CC_Emem", 12.34567 )
     bionetAPI.setBionetworkInitialCondition( "CellTypeD", "CLK_Nan1", 0.77777 )
     bionetAPI.setBionetworkInitialCondition( "CellTypeD", "DN_ni", 0.88888888 )
     
     ## Setting SBML initial conditions for non-existent cell type
     bionetAPI.setBionetworkInitialCondition( "NonExistentCellType", "SE_S1", 0.62 )
     
     
     # ######## Create bionetworks and initialize their states ##########
     bionetAPI.initializeBionetworks()
     
     
     for cell in self.cellList:
         dictionaryAttrib = CompuCell.getPyAttrib( cell )
         dictionaryAttrib["InitialVolume"] = cell.volume
         dictionaryAttrib["DivideVolume"] = 280.
         cell.targetVolume = 100.0
         cell.lambdaVolume = 2.0
     
     import CompuCellSetup
     self.cellTypeMap = CompuCellSetup.ExtractTypeNamesAndIds()
     del(self.cellTypeMap[0])