/* reaction_output.mdl" */

 

/* This MDL statement block specifies the content and timing of simulation reaction statistics to be counted and output for plotting.  Each output file is given a user-specified name and contains ASCII text data in columnar format.  In general, the syntax for each statement is:

 

  {COUNT[molecule_name,count_where,count_how,…]…} => file_name

 

where "molecule_name" indicates an explicitly defined molecule or one defined implicitly as a reaction mechanism state; or,

 

  {COUNT[state[>adjacent_state],count_where,count_how,

…]…} => file_name

 

if molecular transitions from "state" to "adjacent_state" are being counted.  The "count_where" parameter can be used to restrict the spatial locale in which counting takes place, and one or more "count_how" parameters are used to specify whether counting is done on a time- and/or molecule-dependent basis (see MCell website for further details).  Count statements themselves can be treated as numerical expressions, so that different quantities can be added, subtracted, or otherwise manipulated as illustrated below to obtain the output data for book Fig.’s 4.4G and 4.6B-I.  Figures 4.6B-I include data averaged across 2000 simulations run with different random number seeds.  If such simulations are run without specifying unique output file names, each successive simulation overwrites the results output from the preceding simulation.  To automatically avoid this problem, each output file name created below incorporates the seed index value used for the simulation. */

 

sprintf(simulation_number,"%04g",SEED)    /* An example of a "low level" MDL statement that uses syntax similar to that of the C programming language.  The keyword SEED yields the random number seed index used for the simulation (currently can range from 1 to 3000), and the value then is placed in a string variable named "simulation_number".  The "%04g" format string forces the value to be padded with leading zeroes so that "simulation_number" always contains 4 characters (i.e., "0001" to "3000"). */

 

REACTION_DATA_OUTPUT {

  STEP = 0.5e-6    /* Time-dependent data is output according to STEP, which is specified in seconds (usually some multiple of TIME_STEP).  With STEP equal to TIME_STEP (as in this example), time-dependent data output will include a value for each time-step iteration. */

 

  {COUNT[ACh,WORLD,FOR_EACH_TIME_STEP]}  =>

    simulation_number & ".ACh"    /* The time-dependent number of ACh molecules is counted throughout the entire simulation space (e.g., book Fig. 4.4G).  The resulting values are written into a data file at intervals of STEP (or the next greater simulation time if STEP is not an even multiple of TIME_STEP).  The output file contains 2 columns, one for simulation time and one for the corresponding data values.  To form the output file name, the "simulation_number" text variable defined above is concatenated with a suffix of quoted text using the ampersand operator.  For example, if the first random number seed index is used for the simulation (index 1), the resulting output file name would be "0001.ACh". */

  {

    COUNT[ACh,nmj.sampling_boxes.box_1,FOR_EACH_TIME_STEP] +

    COUNT[ACh,nmj.sampling_boxes.box_2,FOR_EACH_TIME_STEP] +

    COUNT[ACh,nmj.sampling_boxes.box_3,FOR_EACH_TIME_STEP] +

    COUNT[ACh,nmj.sampling_boxes.box_4,FOR_EACH_TIME_STEP]

  } => simulation_number & ".primary.ACh"    /* ACh molecules are counted within individual sampling boxes 1-4 (named according to the same convention outlined in "visualization_output.mdl" for the assignment of physical object STATE_VALUES).  Each of these boxes lies close to the ACh release site in the primary cleft space (book Fig. 4.6A), and so the results are added together and output into one file.  From these values and the volume of the boxes, the local concentration of ACh can be calculated (book Fig. 4.6B). */

  {

    COUNT[ACh,nmj.sampling_boxes.box_5,FOR_EACH_TIME_STEP]

  } => simulation_number & ".secondary.ACh"    /* ACh molecules are counted within sampling box 5, which lies below boxes 1-4 at the entrance into a junctional fold (book Fig. 4.6A).  The results are used to compute the local ACh concentration (book Fig. 4.6B). */

  {

    COUNT[Ch,nmj.sampling_boxes.box_1,FOR_EACH_TIME_STEP] +

    COUNT[Ch,nmj.sampling_boxes.box_2,FOR_EACH_TIME_STEP] +

    COUNT[Ch,nmj.sampling_boxes.box_3,FOR_EACH_TIME_STEP] +

    COUNT[Ch,nmj.sampling_boxes.box_4,FOR_EACH_TIME_STEP]

  } => simulation_number & ".primary.Ch"    /* Ch molecules are counted within sampling boxes 1-4.  The results are added together and output into one file as explained above for ACh molecules. */

  {

    COUNT[Ch,nmj.sampling_boxes.box_5,FOR_EACH_TIME_STEP]

  } => simulation_number & ".secondary.Ch"    /* Ch molecules are counted within sampling box 5, and the results are output as above for ACh molecules. */

 

/* Results from the next 4 output files are shown in book Fig. 4.6E). */

  {COUNT[AChR.R0,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".R0"    /* The time-dependent number of effector sites in the "AChR.R0" state (implicitly defined molecules, see ADD_EFFECTOR blocks in "muscle_membrane.mdl") are counted throughout the entire simulation space. */

  {

    COUNT[AChR.AR1,WORLD,FOR_EACH_TIME_STEP] +

    COUNT[AChR.AR2,WORLD,FOR_EACH_TIME_STEP]

  } => simulation_number & ".AR1_2"    /* Effector sites in the "AChR.R1" or "AChR.R2" state are counted, and the results are added together and output into one file. */

  {COUNT[AChR.A2R3,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".A2R3"

  {COUNT[AChR.A2R4,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".A2R4"

 

/* Results from the next 4 output files are shown in book Fig. 4.6C). */

  {COUNT[AChE.E,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".E"

  {COUNT[AChE.AE,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".AE"

  {COUNT[AChE.AcE,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".AcE"

  {COUNT[AChE.AAcE,WORLD,FOR_EACH_TIME_STEP]} => simulation_number & ".AAcE"

 

/* Results from the next 4 output files are shown in book Fig. 4.6F. */

  {

    COUNT[AChR.R0[>AChR.AR1],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS] +

    COUNT[AChR.R0[>AChR.AR2],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".R0-AR1_2"    /* The total number of transitions from "AChR.R0" to "AChR.R1" is counted throughout the entire simulation space during each time-step.  The results are added to the number of transitions from "AChR.R0" to "AChR.R2".  The sum therefore gives the binding rate of ACh molecules to unbound AChR effector sites as a function of time, and is output to one file. */

  {

    COUNT[AChR.AR1[>AChR.R0],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS] +

    COUNT[AChR.AR2[>AChR.R0],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".AR1_2-R0"    /* As immediately above, except that unbinding (rather than binding) transitions are counted. */

  {

    COUNT[AChR.AR1[>AChR.A2R3],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS] +

    COUNT[AChR.AR2[>AChR.A2R3],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".AR1_2-A2R3"    /* All binding transitions from single- to double-bound AChRs are counted. */

  {

    COUNT[AChR.A2R3[>AChR.AR1],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS] +

    COUNT[AChR.A2R3[>AChR.AR2],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".A2R3-AR1_2"    /* All unbinding transitions from double- to single-bound AChRs are counted. */

 

/* Results from the next 5 output files are shown in book Fig. 4.6F. */

  {

    COUNT[AChE.E[>AChE.AE],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".E-AE"

  {

    COUNT[AChE.AE[>AChE.AcE],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".AE-AcE"

  {

    COUNT[AChE.AcE[>AChE.E],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".AcE-E"

  {

    COUNT[AChE.AcE[>AChE.AAcE],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".AcE-AAcE"

  {

    COUNT[AChE.AAcE[>AChE.AE],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".AAcE-AE"

 

/* Results from the next 3 output files are shown in book Fig.’s 4.6G and I. */

  {

    COUNT[AChR.A2R3[>AChR.A2R4],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".A2R3-A2R4"    /* The total number of transitions from "AChR.A2R3" to "AChR.A2R4", i.e., AChR channel opening events, is counted during each time-step. */

  {

    COUNT[AChR.A2R3[>AChR.A2R4],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,INITIAL_EVENTS]

  } => simulation_number & ".initial-A2R3-A2R4"    /* A subset of AChR channel opening transitions (INITIAL_EVENTS, as defined in the legend for Fig. 4.6I) is counted during each time-step. */

  {

    COUNT[AChR.A2R4[>AChR.A2R3],WORLD,SUM_OVER_ALL_EFFECTORS,

      FOR_EACH_TIME_STEP,ALL_EVENTS]

  } => simulation_number & ".A2R4-A2R3"    /* The total number of AChR channel closing events is counted during each time-step. */

}