varsion 3.1     by Slava Chushak
*******************************************************************************
- implemented functionality to save agregated number of reaction events;
these numbers are saved into the snapshot files.
THERFORE - there 3.0 shapshot files will NOT work !!!!
- modify way the analysis tools are runing: new function write_analysis_parms.m 
creates analysis_constants.m file.
That file contains all information about the analysis data and parameters.
That file is used to run analysis. Now analysis can be run in batch mode or interactive mode.
- modified analysis tools to run with agregated numbers of reactions in the shanshot file.
- Parallelized analysis tools with MatlabMPI.
version 3.0     by Slava Chushak
*******************************************************************************
- Developed "stand-alone" C-cided engine. Rewrote mex_c engine to use stand-alone 
C-function. 
- Parallelization of stand-alone version is done using MPI library.
- Created structure "run_constants" to call gateway_erg.c from coordinate_erg.m.
- Output from both engines: snapshot-data - text format, eventlog-data - binary format,
  reactionsexecuted - text format.
- Modified analysis tools to work with new output files.
- Created functions create_batch_script_LSF.m and create_batch_script_PBS.m with the "template"
  batch scripts for these two gueueing systems.
- Usage:
  bns(0,0) - runs interactive mex_c engine, graph output;
  bns(0,1) - runs stand-alone engine, no graph output;  
  bns(1,0 - runs GUI:
     on PC:  "Interactive" mode runs mex_c engine;
             "Batch" mode runs stand-alone engine;
     on HPC:  "Interactive" mode runs mex_c engine;
              "Batch" mode creates batch_script and runs parallelized stand-alone engine;
  
Validation against bns2p5p4:
- to get the same results modifications need to be made in bns2p5p4:
    in file  init_rxn_grp.m comment line 17  %rand_seed - rand; and put instead
        rand_seed = randseed;
C-coded functions used randseed which is set in general_constants.m
- modified choose_directory.m in bns_analysis curdir box from "text" to "edit".
  It will allow to type the path to new directory, not just click.

********************************************************************************
version 2.5.4     by Slava Chushak

This version is based on bns2.5.2

Redesizned GUI:
 - separated default_directories info from the parameres of the model info;
 - moved output_filename from default_directories.m to plotting_and_storing.m
 BACKWARD comparitive version:
   if output_filename is defined only in default_directories.m - use it;
   if output_filename is defined only in plotting_and_storing.m - use it;
   if output_filename is defined in both default_directories.m and in 
    plotting_and_storing.m - use the last one;
   if output_filename is not defined at all - create default name "outfile";

 - moved removing old output_files (if exist) from clear_stuff.m to collect_rundata.m
 Fixed bug: if output directory doesn't exist in parameters folder - create it.

*********************************************************************************
version 2.5.3  by Brent FoY
-- modified from version 2.5.2, which was Slava's modification of 2.5.1 to work with Matlab version 6.5.

-- added capability use 'pure c' executable; i.e. non-mex compiled c code.  The windows compiled executable is called bns_mat_c.exe and is located in the root bns directory.  The c files for this executable are located in a subdirectory of the root directory called bns_mat_c_files.

-- how it works at the moment: bns writes a text file with all the required constants for the c executable.  The name of this constants file will be a concatenation of %output_filename% (from default_directories.m) and '_constants.txt'.  For example, if %output_filename% is 'out_a', then the constants filename will be out_a_constants.txt.  There will also be created a constants.txt file that has the name as its only data (i.e., constants.txt might contain the string out_a_constants.txt).  
-- The above two files are created in the root directory, but then moved into the output_directory (again based on the entry in default_directories.m).  The 'bns_mat_c.exe' file is also copied into the output_directory.
-- the c executable is then executed from within the bns program.  It reads the above files, performs all the simulations, then deletes the 'constants.txt' and 'bns_mat_c.exe' files from the output directory.

-- the output files generated by the c executable are NOT able to be used by the analysis tools yet
-- the undefined reaction type is NOT implemented yet for the c executable
-- the constants files described above are NOT created by bns_GUI yet, only by the bns(0,0) startup
-- this c executable DOES work with multiple runs and parameter sets

-- two new constants were added to general_constants.m.  The first one is called 'create_constants_textfile'.  If it is set to 1, then the %output_filename%_constants.txt file and the constants.txt file will be created and placed in the output_directory.
-- the second one is called 'use_constants_textfile'.  If it is set to 1 and 'create_constants_textfile' is also set to 1, then the c executable will actually be called and executed from within Matlab.  If create_constants_textfile equals 1 and use_constants_textfile is absent or zero, then the file will be created, but the c executable will not be called from Matlab.  
-- If 'create_constants_textfile' is absent or zero, then the old mex file implementation will be used.

-- the c executable can be called from outside Matlab.  Just place the files 'constants.txt', 'out_a_constants.txt' (for example), and bns_mat_c.exe into the same folder, and run bns_mat_c.exe.

-- the c executable creates 3 output files.  One called %output_filename%_snapshot.txt, one called %output_filename%_rundata.txt, and one called %output_filename%_evlog.bdat.  These files, plus the %output_filename%_constants.txt file, will be used in the future for plotting and analysis.  It creates just these 3 files, no matter how many runs were performed or how big the files are.  This is a change.

-- Sloppy_I_B was added to the models.

********************************************************************************
version 2.5.2     by Slava Chushak

Modified analysis GUI to make them compatible with MATLAB 6.5 on HPC.
Modified all analysis GUI *.fig files and some *.m files:
 - in files twa_analysis.m, sens_analysis.m, plot_from_data.m, plot_reaction_frequencies.m
   modified find(idxs == newval,1) to find(idxs == newval) - 6.5 gave an error.

 - modified in  twa_analysis.m, plot_reaction_frequencies.m, plot_from_data.m
              figlist = [figlist;num2str(numfigs+1)];
    to        figlist{numfigs+1} = num2str(numfigs+1);
Again, 6.5 doesn't accept that.


*********************************************************************************
version 2.5.1

-- modified the way first and last run choices operate in the 'plot_reaction_frequencies.m' and 'plot_from_data.m' files.  Now, for example, choosing a first run greater than last run will automatically bump up last run to the same value as first run, as long as both choices are within valid limits.

-- revamped the time-weighted average analysis gui window and calculations.  Added capability to plot binned compound averages vs. time (similar to reaction count bin plots).  There is now a single compound selection interface instead of two.  The ability to show the first 3 runs of exact (non-binned) plots of compound numbers vs. time was removed.  This data can be shown from the 'plot_from_data' window.  I figured the plots of binned average compound numbers would give sufficient sense of the time course.  Removing the 2nd compound selection interface made this overall window smaller.  The ability to create histograms of compound number averages (number of runs vs. compound number average) is now a checkbox.  Added ability to choose a subset of runs to this window.

-- did some profiling on the event log parser and the time-weighted average calculations.  Found several ways to speed up the execution of these files.  They should be several times faster.  There is still no checking for memory overflow in the analysis code, so caution with big files is advised.  NOTE:  For parsing, the user will be asked a question, IN THE MATLAB WINDOW (should make it a popup graphic window ... next time) about proceeding if the program detects large files.  Make sure you look at the matlab window at the beginning of a parse, or else the parser will just be sitting there waiting for your response.  In all of my test cases, proceeding was fine despite the warning, so perhaps the cutoff for the warning is overly conservative.

-- attempted to find a way to handle incomplete event logs in the event that the c code needed to store an event log that is larger than eventlog_maxelements.  The code worked, but made parsing very slow, so I removed it.  If you start to get this problem (usually noticeable by compound vs. time plots that are crazy or negative), either increase eventlog_maxelements or decrease monitor_interval. Increasing eventlog_maxelements might cause out-of-memory errors, but one is supposed to play with this to find the largest usable value for each computer system.  Decreasing monitor interval can make the simulation run more slowly.

-- fixed a bug where if you did not select to save the eventlog, then the snapshot data wouldn't be saved either.

-- adjusted a few button sizes and alignments in most bns_analysis gui windows

-- added John's sloppy model to the list of models distributed with the code.  I called it sloppy_full.  Sounds like somebody was a messy eater...

-- the following gui control files were changed: plot_from_data.m, plot_reaction_frequencies.m, and twa_analysis.m.


*********************************************************************************
version 2.5

Primarily an integration of version 2.3 which added updated mpi code, version 2.4 with minor changes mentioned below, and the new analysis GUI.  Used version 2.3 as a base, made the 2.4 changes mentioned below and added analysis GUI files.

Analysis GUI notes:
-- new files: (brackets show GUI .m/.fig file pairs) 
	[bns_analysis.m, bns_analysis.fig],
 	[analyze_olddata.m, analyze_olddata.fig], 
	[choose_directory.m, choose_directory.fig],
 	[choose_pset_for_plot.m, choose_pset_for_plot.fig], 
	[choose_single_analysis.m, choose_single_analysis.fig], 
	make_time_plots.m, 
	[plot_from_data.m, plot_from_data.fig],
 	plot_reaction_freq.m, 
	[plot_reaction_frequencies.m, plot_reaction_frequencies.fig], 
	plot_sens.m,
 	plot_twa.m, 
	reaction_freq_analysis.m, 
	[sens_analysis.m, sens_analysis.fig], 
	sens_calc.m,
 	[twa_analysis.m, twa_analysis.fig], 
	twa_calc.m, 
	twui_ave.m,
	[view_old_analysis.m, view_old_analysis.fig]


	[analyze_newsims.m, analyze_newsims.fig] are placeholders for future development.  They aren't accessed yet.

-- the analysis interface is started by typing bns_analysis when in the main bns folder.  The GUI used to perform simulations will be called bns_GUI, whereas the analysis interface will be called bns_analysis.

-- raw data used for analysis is stored in 3 different .mat files.  They are differentiated by name.  (1) xxx_data_#.mat.  These will be called _data_ files. (2) xxx_eventlog_#_#.mat.  These will be called _eventlog_ files. (3) xxx_parsed_#.mat.  These will be called _parsed_ files.  The xxx is the 'stub' used to prepend these files.  It is specified in default_directories.m as the output_filename.  It also can be specified in bns_GUI as Output file.  The first two data files are created by running a bns simulation.  

-- The _parsed_ data file is created by parsing an _eventlog_ file. Once an _eventlog_ file has been parsed, it should not needed for anything else.  So after parsing, _eventlog_ files won't show up in bns_analysis.  The parsing can be done from within bns_analysis.  Choose 'Plot or analyze and existing data set' from the opening bns_analysis screen, navigate to the folder where your _eventlog_ files are stored, select an _eventlog_ file, then press the 'Parse Event Log' button.  The _eventlog_ files will disappear from the list of files available to be analyzed, but the _parsed_ files will appear.

-- The _data_ files and the _parsed_ files will need to be stored in the same directory in order for bns_analysis to work.  They normally will be.  You would have to move things around to make this not so.

-- The _data_ files contain the snapshot data.  The _parsed_ files contain the event data.  If you perform an analysis on a _data_ file, the analysis will use the snapshot data.  If you select a _parsed_ file for analysis, it will use the event data.

-- There are 3 kinds of analysis available.  (1) average, (2) sensitivity, and (3) reaction frequency.  The 'average' and 'sensitivity' analyses can use either _data_ or _parsed_ files.  The 'reaction frequency' analysis is only available from _parsed_ files.

-- The "average" analysis calculates and plots time-weighted averages of any monitored compounds.

-- The "sensitivity" analysis calculates the sensitivity to any monitored compound to a perturbation in another parameter.  A sensitivity analysis will only be available if a set of simulations appropriate to sensitivity calculations has been performed.  The only way to perform a sensitivity simulation is via parameter sets.  See paramsets_g.m in the gshA_0p0_nomenA/param_cftt directory for an example.  

-- The "reaction frequency" analysis creates various plots of the frequency at which each reaction occurs.

-- The data used to create most analysis figures is saved as xxx_bnsan.mat or xxx_reaction_bnsan.mat.  These files are then available to be used to quickly recreate the plots (from the first screen that appears when you type bns_analysis, the 2nd option is "View plots and output data from previous analysis").

-- The majority of the analysis tools create matlab figures.  There is a way to get at the data used to create these figures.  From the first screen that appears when you type bns_analysis, the 2nd option is "View plots and output data from previous analysis".  In general this option is chosen to quickly recreate plots from a previous analysis.  An option within the "View Previous Analysis" screen that comes up is to save the data used to make such plots.  The files generated will each be text files with 2 columns.  The first column is the x axis values, and the 2nd column is y axis values.  It will create 1 text file for each plot, thus a figure with multiple plots will generate multiple text files.

-- Be aware that parsing large eventlog files and analyzing large parsed files can take considerable time.  Often much *longer* than the time required to run the simulation.

-- bns_posthoc.m was the old way of performing analysis.  It hasn't been tested with the new code.  bns_posthoc.m used analysis sets to run a series of analyses, which also may or may not work.

Other minor changes:
-- moved randseed code back into other_constants.m.  Added half a line to suppress display of long randseeds in bns_GUI.m.

-- created function update_parameters.m, which takes care of most of the parameter changes used with multiple parameter sets.  This is code that existed in identical form in 4 other places, so created a function to decrease code size and facilitate future code editing.


*********************************************************************************
version 2.4

-- modified clear_stuff.m to delete existing _parsed_ files that use the same output_filename.

-- other_constants.m now sets parameter_sets to empty matrix if use_paramset == 0.

-- added several options to paramsets_a.m files.  Namely pset(1).type, pset(1).set_group, and pset(1).perturbed_param. These don't affect running the simulation.  They will be used for analysis.

-- added a waitbar to bns_pe.m.

-- added calculation and saving of rxn_eventtimes to bns_pe.m.  This stores the times at which each reaction occurs.

-- added a file called default_analysis_locations.m, which functions similarly to default_directories.m, but for analysis.

-- added the .name field to rxn_grp.rxn in prepare_reactions.m.  This is so the gui can display reaction name.  Added this to read_sbml_model.m also, although the name will just be 'rxn#', where # is the reaction id.



*********************************************************************************

version 2.2

-- moved randseed into general_constants.m.  It didn't really belong in default_directories.m.  Modified all existing general_constants.m files to include this.
-- Set the random number generator seed other_constants.m.
-- a random seed between 0 and 1 is passed into the c engine now (via a single call to matlab's rand function in init_rxn_grp.m).
-- enabled a command line randseed (randseed_cl) to supercede the randseed from general_constants.m
-- enabled gui randseed to supercede all the other randseeds
-- modified gateway_erg.c to pass this randseed through to erg.c
-- erg.c now calls srand at the beginning of a run
-- drand function within update_rxn_prob_erg.c written and used to provide greater range of random numbers between 0 and 1 (i.e. very small random numbers near zero are now possible)
-- wrote something to enable mpi random number seeding to work (hopefully).  A randseed is used/generated in other_constants.m.  This is then used by master cpu to generate a (predictable) sequence of seeds that are passed to worker cpus.  Worker cpus (and master cpu) then each use this seed and then generate a (predictable) random number between 0 and 1 that is passed to c engine (see above).  The idea is to have the use of a single random number seed enable identical mpi runs, if so desired and if the number of cpus used is identical.  The outputs from each cpu should be different from other cpus for each 'set', but running a 'set' again with the same randseed should give the same results.

-- eventlog_maxelements added to all storing_and_plotting.m files.
-- eventlog_arraysize is added internally to handle case of user specifying 0 elements or very few elements.  Under normal circumstances, one should keep eventlog_maxelements to a 'large' number (but smaller than available memory), in which case eventlog_arraysize = eventlog_maxelements.  But c-code needs to have non-zero array size, thus the need for eventlog_arraysize.  See collect_rundata.m for details.
-- eventlog_arraysize passed from bns.m through runsim.m through coordinate_erg.m and into the c engine.
-- modified coordinate_erg.m to handle randseed and eventlog_arraysize
-- runsim.m modified to check the size of snapshot data.  If it exceeds eventlog_maxelements, data will start to overwrite itself (rather than exceed eventlog_maxelements and possibly exceed memory cap).

-- created mex_makefile.m, so that it can be called either from within the program, or as standalone when one is programming the c files.
-- resplit gateway_erg.c into smaller files that are easier to edit
-- moved mex_makefile.m into the sbml part of the code, since the c files only need to be re-compiled when using sbml models.

-- moved a section of bns.m into bns_input_setup.m, to make bns.m easier to follow.

-- created sbml_check.m, since this code was identical in both non-MPI and MPI sections of bns.m.

-- created bns_nonmpi.m and bns_usempi.m, moved big chunks of bns.m into these files.

-- eventlog_flag moved to storing_and_plotting.m files.  It also didn't belong in default_directories.m.  Modified all existing storing_and_plotting.m files
-- removed references to dir_info.event_log_plot flag.  It was redundant with plot_info.eventlog_flag.  Fixed bns_gui.m to use eventlog flag from storing_and_plotting.m
-- moved section of bns_gui.m that saved eventlog_flag and randseed to default directories.m so that now eventlog flag is saved to storing_and_plotting.m and randseed is saved to general_constants.m.

-- put save_event_log back into runsim.m (also see below where save_event_log functionality was merged into a unified disk saving system).  This means runsim has to be called with dir_info and i_mainloop again.  This is necessary to enable the ability to save parts of eventlog to disk, thus enabling eventlogs larger than memory size.  At the moment, this breaks mpi.  Primarily because not sure what to pass as dir_info to worker cpu.  Worker CPU doesn't need any dir_info at the moment, so can pass dummy variables if needed.  But this will help mpi ultimately.  Without such data, the workers won't be able to save event logs.  runsim.m no longer passes eventlog back to bns.m (which is good, the less passing of huge matrices the better).  Once we know how to get workers to save data to disk, we can finalize this process.  Created parameter called mpi_eventlog_param (which is passed as plot_info.mpi_eventlog_param) to assist with helping runsim decide how to handle saving eventlog data to disk.  For example, mpi_eventlog_param = 0 can be save as in single cpu mode.  mpi_eventlog_param = 1 can be master cpu in mpi, and mpi_eventlog_param = 2 can be worker cpu in mpi.

-- recopied prepare_transcv2_rxn.m into the main bns folder

-- implemented disk saving of times_reactions_executed.

-- changed from the saving of a single .mat file to the saving of multiple .mat files.  Output_filename in default directories.m is now prepended to each file to identify a batch of runs.  There are 2 types of .mat files saved from each run.  
		(1) The data file has the core name 'data' and contains variables randseed, plot_info, run_info, cmpd_info, data_time, data_cmpds, and times_rxns_executed
		(2) The event log has core name of 'eventlog' and contains variable event_log
	The run_id is appended to the core type.  Then multiples of the eventlog are appended to that.  So if output_filename in default_directories.m is 'simA' and the run_id is 34, the typical simulation run would produced the following files: 
			simA_data_34.mat
			simA_eventlog_34_1.mat
	If eventlog was too large to fit in a single file, there would be simA_eventlog_34_1.mat, simA_eventlog_34_2.mat, etc.
	If output_filename isn't changed between batches of simulations, the previous data is overwritten.
	This is done with a new function called save_mat.m, which replaces various save commands in code and replaces save_event_log.m.
	
-- plot_info and time_info structure tags were removed from general_constants.m and storing_and_plotting.m.  It wasn't necessary for the user to see those.  Tried to fix up references to these wherever necessary throughout the code.  collect_rundata.m is the (new) file that puts data from the user files into plot_info and run_info structures.

-- changed name of time_info structure to run_info to better reflect what it contains
-- moved stoch_algor and randseed into run_info structure, so we don't need to handle these variables as special cases when passing information

-- bns_plot.m is now a function that is called when snapshot plots are to be made after the simulation is done.

-- implemented snapshot interval, the time spacing between snapshots, in storing_and_plotting.m.  The data is captured in the c part of the code (the kernel) and passed back to the matlab part.
-- explanation of snapshot_interval, monitor_interval, and plot_interval:  
		Snapshot_interval is the time spacing between saved snapshots.  
		Monitor_interval is the amount of (simulated) time the code will spend in the c kernel before exiting out to the matlab part for various maintenance functions.
		Plot_interval is the time spacing between simulated times that the code will try to display a plot (try because it can only show plots at monitor_interval intervals).  
		
	So the code can take many snapshots between monitor_intervals, and can do several monitor_intervals between showing of new plots, if so desired.  All of these functions used to be tied to a single variable called timestep.  In general, you will want to set snapshot interval to whatever you feel like, and set monitor_interval to the largest value that satisifies memory limitations and/or your desire to see plots.

 -- maintenance functions performed at monitor_interval intervals: 
 		show intermediate snapshot plots from Matlab (if desired)
 		dump a big eventlog to hard disk to free up memory for more eventlog
 		reduce size of snapshot files (by deleting older data) if they grow too large
 		multiple reaction group maintenance (not really utilized in most models, which just use a single reaction group)
 		
 -- implemented parameter sets.  default_directories.m contains a new variable, parameter_sets.  This variable points to a new m file that exists in the parameters directory.  See paramsets_a.m in the gshA_0p0_nomenA_2p2/param_cftt directory for an example.  This feature lets you simulations with different sets of parameters.  For example, you can perform 100 runs with one set of parameters, then perform 300 runs with a different set of parameters.
 
 -- implemented analysis sets.  This is used to perform analysis on a set of parsed event logs.  The analysis files are placed within the parameters directory.  See analysis files in gshA_0p0_nomenA_2p2/param_cftt directory for examples.  Currently two kinds of analysis are implemented -- average and sensitivity.  Analysis sets only work in conjunction with parameter sets at the moment.  You have to specify time range, which parameter, etc.
 -- wrote bns_posthoc to use the analysis sets.  Can pass it the name of the analysis set you want to use and the directory where the output is stored, or it can grab directory from default_directories.m.  It makes some histogram plots and bar plots (for sensitivities).  It calls a new file called tw_ave.m which is based on Tabor's work.
 -- sensitivity analysis changed to percent changes.

 -- overnight.m contains a trivial 3 line script file I use for overnight runs.  It can be used to run the simulations (from a parameter set specified in default directories), parse the event log, then perform an analysis.

-- the five commands that the user is meant to type at the command line, currently, are bns, bns_pe, bns_plot, bns_plot_pe, and bns_posthoc.
 

****************************************************************************************************


version 1.6

- implementation of event logging for c code.  This was combined with re-implementation of memory overflow checking for event logging. At the moment, mpi mode is not compatible with event logging.

- changed make_plots, bns_plot, and bns.m so that multi-run plots don't display each run.  Only the final plot is displayed after all data has been added to it.

- added detailed transcription reaction type, called 'transcv2'.  See the model called test for an example.


**************************************************************************************************

version 1.4.4

- introduction of c code for core engine.


***************************************************************************************************
version 1.4

- restored ability to run the user dialogue via using no parameters on command line

- fixed bns_plot

- scaling constant will again multiply the number of molecules for each compound (well, found the error, didn't test it though...)

- split the other_constants.m file into clear_stuff.m and other_constants.m.

- when changing the model directory via the GUI, the presence or absence of a parameters directory under the chosen model directory will be handled better.  Now it looks for the presence of the initial_compound_numbers subdirectory and the reaction_constants subdirectory.  If both are not found, it will put "No parameters" in the parameter list.  Should probably add checks for the general constants.m file and the storing_and_plotting.m file.

- added 2 reaction types, uni-uni and uni-multi.  See model 'test' for examples on how to use.

- binding reaction type will now use correct probability for homo-dimerization reactions

- changed default_directories.txt to default_directories.m

- the event parser and plotter, bns_pe.m, now works with multiple runs.  We really need a GUI for this to help choose the output file to use for plots.  Right now bns_pe uses default_directories.m, which can be overridden by command line arguments.

- bns_pe now makes plots that show step-changes in compound numbers

- fixed the 'feature' with legends on plots that make characters after an underscore become subscripts.  Now these characters appear as they do in the compound name.  The fix only works in Matlab v7.0+.

- changed name of cftt_new.  Trying to get something going on naming conventions.  Name is now gshA_0p0_nomenA_1p4.  gshA is general name of model, in this case indicating it is for the single gene gshA.  0p0 indicates detail level of the model.  I forget what the 2nd zero is for, but John was using it for something.  nomenA is for the nomenclature style, where nomenA is "my" style (no P1, etc).  Maybe we don't need it, but for now it helps me.  1p4 is for engine version.  Parameter set names are the name of the parameter subfolder, in this case param_cftt.

- put in the 2 gene model, 0.0 version.  My former name was model_gclgs_0.0.  It came back from Slava after he adapted it to bns1p2 as gsh_01.  My proposed name is gshA-gshB_0p0_nomenB_1p4.  nomenB is JMF style, using P1 etc.  param_FOSBE05 was the parameter set used for our FOSBE poster in 2005, although the results will differ at least a little since the omo-dimerization probability has been fixed.

- put in a 20 gene model, version 0.0.  This is really the 2 gene v0.0 model, but multiplied by 10.  So there are 20 distinct genes and all the other gene specific compounds have distinct names (e.g. P1_a, Prot1_a).  Amino acids, nucleotides-TP, -DP, and -MP, PI, IPP, Ribosomes, and RNA polymerase are in common though.  The name of this model is gshA-gshB-10x_0p0_nomenB_1p4.  This version uses 10 reaction groups (reaction groups = my idea to parallelize internally to a simulation).

- put in the 2 gene model, 1.0 version.  Name is gshA-gshB_1p0_nomenB_1p4. This is from a handout from JMF labeled GC-GSH Version 1.0.  I never had the digital version of this.  It adds a couple steps to the transcription and translation reactions, and adds several steps to the enzymatic reactions.


***************************************************************************************************
version 1.3
 
-- created a default_directories.txt file in the root code directory.  It has 5 entries, for models directory, specific model directory, parameters directory, output directory, and output filename.  The models directory is a parent directory which can contain many specific model directories.  One can put the models folder anywhere.  I like the idea of populating the gui - and the command line choices - with some default, but easily editable, choices.  Previously, the gui opened up with essentially nothing selected except the root code directory.
 
-- As indicated above, one can put the models directory anywhere.  This isn't necessarily tied to the default directories.txt idea, although it would require some code rewriting to implement it without the default_directories.txt.
 
-- the plot_info.output_directory and output_filename choices in the storing_and_plotting.m file were removed, since they now are taken care of by default_directories.txt.  The stochastic option in general_constants.m was removed, since it was unnecessary.  The section of bns.m dealing with running the simulation non-stochastically was removed, since it wasn't up-to-date.
 
-- the bns.m file has been altered, partly to account for the above change, partly to implement starting up the program a bit differently.  It now has 6 potential command line parameters.  First is whether to use gui, 2nd is whether to use MPI (although MPI version is not integrated yet, so not even sure if this will work), 3rd through 6th are the same 4 as before, although they are now optional since the .txt file mentioned above presents default values for them.  The way the code works, it first grabs all the directories from the .txt file.  Then it either enters into an interactive mode (my old way) if no parameters are specified, or it uses command line parameters.  Then if use_gui was specified (by calling it with bns(1,0), or bns(1,0,dirname, dirname, filename, randseed)), then it opens up the gui.  The gui choices then overide the command line parameters before running.
 
-- the engine now saves every event in an event log, although the plots and data stored during and immediately after a run are unchanged from the previous version. That is, their granularity is set by the init_timestep and max_timestep for the most part.
 
-- wrote an event parser bns_pe.m to read the event log and create plots.  It uses the same plotting choices as are stored in storing_and_plotting.m.
 
 
other comments for version 1.3
-- The integration of the command line and the gui versions didn't really help reduce the code size or complexity.  You still need to call many of the same functions from the gui that you call when not using the gui, so there is still duplication.  There could be a little less duplication, but I felt the gui might want to have access to stuff like read_cmpds and read_reactions, etc. for future capabilities.
-- I had to make several changes to the gui files.  The insertion of the default_directories.txt approach forced such changes.  I felt bad about my changes impacting the gui files so much, thereby causing more work, so I went ahead and fixed them to work with the proposed approach.
-- I think the event parser is going to be the dominant way we view and analyze the data.  This relegates the currrent plot viewing and data storage somewhat obsolete, really just useful for progress monitoring during a simulation.
-- I looked into making the code more efficient by removing "reaction group" (multi-cpu within a run) capabilities, but the quick solution would improve the speed less than 5%.  I'm pretty sure that the complete removal of this capability (involving extensive code changes) would be of similarly minimal gain unless one sets max_timestep very low.  And with the event parser, I don't see any reason to do that.

***************************************************************************************************

 


