def step(self, mcs):

        # #### Write bionetwork state variable names of external oscillators to output file
        bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorA",
                                             "SimpleExample",
                                             self.oscillatorAFileName, "a")
        bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorB",
                                             "SimpleExample",
                                             self.oscillatorBFileName, "a")

        # ######### Update integrator(s) for all bionetworks ###########
        bionetAPI.timestepBionetworks()

        # ######## Modify k1 and k2 as a function of time (MCS) ##########
        k1 = self.k1_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod))
        k2 = self.k2_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod))
        bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorA")
        bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorA")

        k1 = self.k1_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod))
        k2 = self.k2_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod))
        bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorB")
        bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorB")

        # ####### Set "Blue-Blue" and "Green-Green" adhesion energies #########
        BB_offset = bionetAPI.getBionetworkValue("SE_S1",
                                                 "ExternalOscillatorA")
        GG_offset = bionetAPI.getBionetworkValue("SE_S1",
                                                 "ExternalOscillatorB")
        self.modifyContactEnergies(BB_offset, GG_offset, self.steadyState)

        # ############## Write adhesion data to an output file ################
        self.writeContactEnergies(mcs, self.contactEnergyOutputFile, "a")
 def step(self, mcs):
     
     # #### Write bionetwork state variable names of external oscillators to output file
     bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "a" )
     bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "a" )
     
     
     # ######### Update integrator(s) for all bionetworks ###########
     bionetAPI.timestepBionetworks()
     
     
     # ######## Modify k1 and k2 as a function of time (MCS) ##########
     k1 = self.k1_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
     k2 = self.k2_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
     bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorA" )
     bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorA" )
     
     k1 = self.k1_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
     k2 = self.k2_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
     bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorB" )
     bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorB" )
     
     
     # ####### Set "Blue-Blue" and "Green-Green" adhesion energies #########
     BB_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorA" )
     GG_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorB" )
     self.modifyContactEnergies( BB_offset, GG_offset, self.steadyState )
     
     
     # ############## Write adhesion data to an output file ################
     self.writeContactEnergies( mcs, self.contactEnergyOutputFile, "a" )
 def step(self, mcs):
     
     # ######### Update all bionetwork integrator(s) ###########
     bionetAPI.timestepBionetworks()
     
     print "\n"; print bionetAPI.getBionetworkValue( "dii", "CellTypeB" )
     print "\n"; print bionetAPI.getBionetworkValue( "di", "CellTypeB" )
     print "\n"; print bionetAPI.getBionetworkValue( "DN_di", "CellTypeB" )
     print "\n"; print bionetAPI.getBionetworkValue( "DeltaNotchModel_di", "CellTypeB" )
     
     bionetAPI.setBionetworkValue( "SE_k1", 0.1, "CellTypeD" )
     bionetAPI.setBionetworkValue( "SE_k2", 0.3, "CellTypeD" )
     
     cellType = "CellTypeD"; propertyName = "SE_S1"
     S1 = bionetAPI.getBionetworkValue( propertyName, cellType )
     print "Value of %s in %s: %s" % ( propertyName, cellType, S1 )
     
     
     if( mcs >= 20 ):
         
         if( mcs == 40 ):
             if self.cellTypeMap[bionetAPI.getCC3DCellByID(1).type] == "CellTypeB":
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "CellTypeA", 1 )
             elif self.cellTypeMap[bionetAPI.getCC3DCellByID(1).type] == "CellTypeA":
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "CellTypeB", "CellTypeA" )
         
         if( mcs < 120 ):
             cell1_di = bionetAPI.getBionetworkValue( "di", 1 )
             
             if( cell1_di > 0.0 ):  newPropertyValue = 4.0 / cell1_di
             else:  newPropertyValue = 10.0
             
             for cell in self.cellList:
                 if self.cellTypeMap[cell.type] == "CellTypeB":
                     cell.targetVolume = newPropertyValue
 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" )
Ejemplo n.º 5
0
    def step(self, mcs):

        # #### Write bionetwork state variable names of external oscillators to output file
        bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorA",
                                             "SimpleExample",
                                             self.oscillatorAFileName, "a")
        bionetAPI.writeBionetworkStateToFile(mcs, "ExternalOscillatorB",
                                             "SimpleExample",
                                             self.oscillatorBFileName, "a")

        # ######### Update integrator(s) for all bionetworks ###########
        bionetAPI.timestepBionetworks()

        # ######## Modify k1 and k2 as a function of time (MCS) ##########
        k1 = self.k1_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod))
        k2 = self.k2_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod))
        bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorA")
        bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorA")

        k1 = self.k1_init * (1 - math.sin(2 * math.pi * mcs / self.mcsPeriod))
        k2 = self.k2_init * (1 + math.sin(2 * math.pi * mcs / self.mcsPeriod))
        bionetAPI.setBionetworkValue("SE_k1", 0.2 * k1, "ExternalOscillatorB")
        bionetAPI.setBionetworkValue("SE_k2", 0.2 * k2, "ExternalOscillatorB")

        # ####### Set "Blue-Blue" and "Green-Green" adhesion energies #########
        BB_offset = bionetAPI.getBionetworkValue("SE_S1",
                                                 "ExternalOscillatorA")
        GG_offset = bionetAPI.getBionetworkValue("SE_S1",
                                                 "ExternalOscillatorB")
        self.modifyContactEnergies(BB_offset, GG_offset, self.steadyState)

        # ############## Write adhesion data to an output file ################
        self.writeContactEnergies(mcs, self.contactEnergyOutputFile, "a")
        if not (mcs % 10):
            for cell in self.cellList:
                pixelList = self.getCellPixelList(cell)
                for pixelTrackerData in pixelList:
                    self.cellField.set(pixelTrackerData.pixel, None)

                break

        if mcs > 200:

            for cell in self.cellList:
                cell.targetVolume = 0.0
                cell.lambdaVolume = 200.0
                cell.targetSurface = 0.0
                cell.lambdaSurface = 200.0
Ejemplo n.º 6
0
    def step(self, mcs):

        # ######### Update bionetwork integrator(s) for all cells ###########
        bionetAPI.timestepBionetworks()

        # ######## Implement cell growth by increasing target volume ##########
        for cell in self.cellList:
            if cell.id > self.initialNumberOfCells:
                ## All new cells are assigned a target volume of 0 to force cell death
                cell.targetVolume = 0.
                cell.lambdaVolume = 2.
                cell.targetSurface = 0.
                cell.lambdaSurface = 2.
            else:
                dictionaryAttrib = CompuCell.getPyAttrib(cell)
                cell.targetVolume = cell.volume + 0.15 * dictionaryAttrib[
                    "InitialVolume"]

        # ###### Retrieve delta values and set cell type according to delta concentration ########
        for cell in self.cellList:
            currentDeltaValue = bionetAPI.getBionetworkValue("DN_di", cell.id)
            if (currentDeltaValue > 0.5):
                if (self.cellTypeMap[cell.type] == "LowDelta"):
                    print "ID of cell to undergo type change %s" % cell.id
                    print "Type of cell to undergo type change %s" % bionetAPI.getBionetworkValue(
                        "TemplateLibrary", cell.id)
                    bionetAPI.setBionetworkValue("TemplateLibrary",
                                                 "HighDelta", cell.id)
            else:
                if (self.cellTypeMap[cell.type] == "HighDelta"):
                    bionetAPI.setBionetworkValue("TemplateLibrary", "LowDelta",
                                                 cell.id)

        # ####### Set all cell dbari values as a function of neighbor delta values #########
        for cell in self.cellList:
            weightedSumOfNeighborDeltaValues = 0.0
            neighborContactAreas = bionetAPI.getNeighborContactAreas(cell.id)
            neighborDeltaValues = bionetAPI.getNeighborProperty(
                "DN_di", cell.id)

            for neighborID in neighborContactAreas.keys():
                weightedSumOfNeighborDeltaValues += (
                    neighborContactAreas[neighborID] *
                    neighborDeltaValues[neighborID])

            bionetAPI.setBionetworkValue(
                "DN_dbari", weightedSumOfNeighborDeltaValues / cell.surface,
                cell.id)
 def step(self, mcs):
     
     # ######### Update all bionetwork integrator(s) ###########
     bionetAPI.timestepBionetworks()
     
     bionetAPI.printBionetworkState(1)
     
     # ######## Implement cell growth by increasing target volume ##########
     for cell in self.cellList:
         dictionaryAttrib = CompuCell.getPyAttrib( cell )
         cell.targetVolume = cell.volume + 0.1*dictionaryAttrib["InitialVolume"]
     
     
     # ###### Retrieve delta values and set cell bionetwork template libraries according to delta concentration ########
     for cell in self.cellList:
         currentDelta = bionetAPI.getBionetworkValue( "DN_di", cell.id )
         if( currentDelta > 0.5 ):
             if self.cellTypeMap[cell.type] == "LowDelta":
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "HighDelta", cell.id )
         else:
             if self.cellTypeMap[cell.type] == "HighDelta":
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "LowDelta", cell.id )
     
     
     # ####### Set all cell dbari values as a function of neighbor delta values #########
     for cell in self.cellList:
         weightedSumOfNeighborDeltaValues = 0.0
         neighborContactAreas = bionetAPI.getNeighborContactAreas( cell.id )
         neighborDeltaValues = bionetAPI.getNeighborProperty( "DN_di", cell.id )
         
         for neighborID in neighborContactAreas.keys():
             weightedSumOfNeighborDeltaValues += (neighborContactAreas[neighborID] * neighborDeltaValues[neighborID])
         
         bionetAPI.setBionetworkValue( "DN_dbari", weightedSumOfNeighborDeltaValues/cell.surface, cell.id )
    def step(self, mcs):
        
        # #### Write bionetwork state variable names of external oscillators to output file
        bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorA", "SimpleExample", self.oscillatorAFileName, "a" )
        bionetAPI.writeBionetworkStateToFile( mcs, "ExternalOscillatorB", "SimpleExample", self.oscillatorBFileName, "a" )
        
        
        # ######### Update integrator(s) for all bionetworks ###########
        bionetAPI.timestepBionetworks()
        
        
        # ######## Modify k1 and k2 as a function of time (MCS) ##########
        k1 = self.k1_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
        k2 = self.k2_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
        bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorA" )
        bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorA" )
        
        k1 = self.k1_init * ( 1 - math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
        k2 = self.k2_init * ( 1 + math.sin( 2*math.pi*mcs/self.mcsPeriod ) )
        bionetAPI.setBionetworkValue( "SE_k1", 0.2*k1, "ExternalOscillatorB" )
        bionetAPI.setBionetworkValue( "SE_k2", 0.2*k2, "ExternalOscillatorB" )
        
        
        # ####### Set "Blue-Blue" and "Green-Green" adhesion energies #########
        BB_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorA" )
        GG_offset = bionetAPI.getBionetworkValue( "SE_S1", "ExternalOscillatorB" )
        self.modifyContactEnergies( BB_offset, GG_offset, self.steadyState )
        
        
        # ############## Write adhesion data to an output file ################
        self.writeContactEnergies( mcs, self.contactEnergyOutputFile, "a" )
        if not (mcs %10):
            for cell in self.cellList:
                pixelList=self.getCellPixelList(cell)
                for pixelTrackerData in pixelList:
                   self.cellField.set(pixelTrackerData.pixel,None)
                   
                break
        
        if mcs >200:

            for cell in self.cellList:
                cell.targetVolume=0.0
                cell.lambdaVolume=200.0
                cell.targetSurface=0.0
                cell.lambdaSurface=200.0            
Ejemplo n.º 9
0
    def step(self, mcs):

        # ######### Update all bionetwork integrator(s) ###########
        bionetAPI.timestepBionetworks()

        print "\n"
        print bionetAPI.getBionetworkValue("dii", "CellTypeB")
        print "\n"
        print bionetAPI.getBionetworkValue("di", "CellTypeB")
        print "\n"
        print bionetAPI.getBionetworkValue("DN_di", "CellTypeB")
        print "\n"
        print bionetAPI.getBionetworkValue("DeltaNotchModel_di", "CellTypeB")

        bionetAPI.setBionetworkValue("SE_k1", 0.1, "CellTypeD")
        bionetAPI.setBionetworkValue("SE_k2", 0.3, "CellTypeD")

        cellType = "CellTypeD"
        propertyName = "SE_S1"
        S1 = bionetAPI.getBionetworkValue(propertyName, cellType)
        print "Value of %s in %s: %s" % (propertyName, cellType, S1)

        if (mcs >= 20):

            if (mcs == 40):
                if self.cellTypeMap[bionetAPI.getCC3DCellByID(
                        1).type] == "CellTypeB":
                    bionetAPI.setBionetworkValue("TemplateLibrary",
                                                 "CellTypeA", 1)
                elif self.cellTypeMap[bionetAPI.getCC3DCellByID(
                        1).type] == "CellTypeA":
                    bionetAPI.setBionetworkValue("TemplateLibrary",
                                                 "CellTypeB", "CellTypeA")

            if (mcs < 120):
                cell1_di = bionetAPI.getBionetworkValue("di", 1)

                if (cell1_di > 0.0): newPropertyValue = 4.0 / cell1_di
                else: newPropertyValue = 10.0

                for cell in self.cellList:
                    if self.cellTypeMap[cell.type] == "CellTypeB":
                        cell.targetVolume = newPropertyValue
 def step(self, mcs):
     
     # ######### Update bionetwork integrator(s) for all cells ###########
     bionetAPI.timestepBionetworks()
     
     # ######## Implement cell growth by increasing target volume ##########
     for cell in self.cellList:
         if cell.id > self.initialNumberOfCells:
             ## All new cells are assigned a target volume of 0 to force cell death
             cell.targetVolume = 0.
             cell.lambdaVolume = 2.
             cell.targetSurface = 0.
             cell.lambdaSurface = 2.
         else:
             dictionaryAttrib = CompuCell.getPyAttrib( cell )
             cell.targetVolume = cell.volume + 0.15*dictionaryAttrib["InitialVolume"]
             
     # ###### Retrieve delta values and set cell type according to delta concentration ########
     for cell in self.cellList:
         currentDeltaValue = bionetAPI.getBionetworkValue( "DN_di", cell.id )
         if( currentDeltaValue > 0.5 ):
             if( self.cellTypeMap[cell.type] == "LowDelta" ):
                 print "ID of cell to undergo type change %s" % cell.id
                 print "Type of cell to undergo type change %s" % bionetAPI.getBionetworkValue( "TemplateLibrary", cell.id )
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "HighDelta", cell.id )
         else:
             if( self.cellTypeMap[cell.type] == "HighDelta" ):
                 bionetAPI.setBionetworkValue( "TemplateLibrary", "LowDelta", cell.id )
     
     # ####### Set all cell dbari values as a function of neighbor delta values #########
     for cell in self.cellList:
         weightedSumOfNeighborDeltaValues = 0.0
         neighborContactAreas = bionetAPI.getNeighborContactAreas( cell.id )
         neighborDeltaValues = bionetAPI.getNeighborProperty( "DN_di", cell.id )
         
         for neighborID in neighborContactAreas.keys():
             weightedSumOfNeighborDeltaValues += (neighborContactAreas[neighborID] * neighborDeltaValues[neighborID])
             
         bionetAPI.setBionetworkValue( "DN_dbari", weightedSumOfNeighborDeltaValues/cell.surface, cell.id )
Ejemplo n.º 11
0
    def step(self, mcs):

        # ######### Update all bionetwork integrator(s) ###########
        bionetAPI.timestepBionetworks()

        bionetAPI.printBionetworkState(1)

        # ######## Implement cell growth by increasing target volume ##########
        for cell in self.cellList:
            dictionaryAttrib = CompuCell.getPyAttrib(cell)
            cell.targetVolume = cell.volume + 0.1 * dictionaryAttrib[
                "InitialVolume"]

        # ###### Retrieve delta values and set cell bionetwork template libraries according to delta concentration ########
        for cell in self.cellList:
            currentDelta = bionetAPI.getBionetworkValue("DN_di", cell.id)
            if (currentDelta > 0.5):
                if self.cellTypeMap[cell.type] == "LowDelta":
                    bionetAPI.setBionetworkValue("TemplateLibrary",
                                                 "HighDelta", cell.id)
            else:
                if self.cellTypeMap[cell.type] == "HighDelta":
                    bionetAPI.setBionetworkValue("TemplateLibrary", "LowDelta",
                                                 cell.id)

        # ####### Set all cell dbari values as a function of neighbor delta values #########
        for cell in self.cellList:
            weightedSumOfNeighborDeltaValues = 0.0
            neighborContactAreas = bionetAPI.getNeighborContactAreas(cell.id)
            neighborDeltaValues = bionetAPI.getNeighborProperty(
                "DN_di", cell.id)

            for neighborID in neighborContactAreas.keys():
                weightedSumOfNeighborDeltaValues += (
                    neighborContactAreas[neighborID] *
                    neighborDeltaValues[neighborID])

            bionetAPI.setBionetworkValue(
                "DN_dbari", weightedSumOfNeighborDeltaValues / cell.surface,
                cell.id)
    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")