# BNGManual:Simulating a Network

3.7.1. Generating a Network | 3.7.2. Simulating a Network | 3.7.3. Viewing the Simulation Results | 3.7.4. Simulating a Previously-Generated Network

### simulate_pla

Once a network has been generated, a simulation can be specified using the simulate_ode or simulate_ssa commands. The simulation specified in the example in BNGManual:Model 1 consists of three phases, which we now summarize and will be described in detail below. The first phase is equilibration, in which reactions that can occur prior to the introduction of the EGF ligand are allowed to reach steady state. Time courses produced by the first simulate_ode command, which terminates when the species concentrations pass a numerical check for convergence, are written to the files egfr_simple_equil.gdat ("groups", or "observables") and egfr_simple_equil.cdat ("concentrations") (assuming the input file is named egfr_simple.bngl). Before the second phase of simulation, ligand is introduced (using setConcentration), the concentrations at the end of equilibration are saved (using saveConcentrations), and the network is written to a SBML file (using writeSBML). The second simulate_ode command then initiates a simulation of the dynamics following introduction of EGF ligand into the system. The results are written to the files egfr_simple.gdat and egfr_simple.cdat. The third phase is then preceded by a resetConcentrations command, which restores the concentrations to the initial values used in the second phase, i.e., following equilibration and introduction of EGF. The simulate_ssa command then initiates the third and final phase of simulation, a kinetic Monte Carlo simulation using the Gillespie algorithm (Gillespie1976, Gillespie1977), and results are written to the files egfr_simple_ssa.gdat and egfr_simple_ssa.cdat.

In the equilibration phase the population level of the ligand (EGF(R)) is zero, as specified in the seed species block of BNGManual:Model 1. Network generation is unaffected by the population levels of the seed species, but in the absence of ligand the only reactions with nonzero flux are the binding and unbinding reactions of Grb2 and Sos1 in the cytosol, which are defined by rule 6. The purpose of the equilibration phase is then to allow the concentrations of free Grb2, free Sos1, and the cytosolic Grb2-Sos1 complex to reach steady-state levels, which we would expect to find in the resting state of the cell.

The first simulate_ode command propagates the simulation forward in time (in large time steps) and checks for convergence to a steady state. By going over each of the options used in this command, we will provide an overview of the operation and capabilities of the simulate_ode command. The "suffix=>equil" appends "_equil" to the basename for output files of the simulation, which becomes here "egfr_simple_equil". This prevents output files from the equilibration phase from being overwritten by subsequent simulation commands. The end time (t_end) for the simulation is given a sufficiently large value to ensure that steady state is reached prior to the end of the simulation (see Note 36). The number of steps at which results are written to the output files is specified by the n_steps parameter, which is set to a relatively small value here because we are only interested in reaching steady state and not in tracking the time course. The interval between reporting of results is given by (t_end$\div$n_steps), which is 10,000 s in this case. (Note that the n_steps parameter controls only the reporting interval and not the step size used by the CVODE solver, which uses adaptive time stepping). Results can also be reported at unevenly spaced intervals using the sample_times argument (see Note 37). The sparse option invokes fast iterative methods in the CVODE solver that can greatly accelerate the simulations (see Note 38). The steady_state flag causes a check for the convergence of the species population levels to be performed following each report interval, with the propagation terminating if the root mean square of the relative change in the population levels falls below a threshold, which is taken to be 10*atol, the absolute integration tolerance. Note that the basic operation of the simulate_ssa command is the same as that of the simulate_ode command. A summary of options available for the simulation commands is given in Table 1. Of the options discussed above, only steady_state and sparse are not available for use with simulate_ssa.

After completion of a simulation, the final population levels of all species in a network are saved and used by default as the initial population levels for subsequent simulation commands. In the example, we have modified or overridden this behavior by using the setConcentration (see Note 39) or resetConcentrations commands (see Note 40). Additional options are discussed in Subheading 3.7.4.