 
        
        Reaction Network Monte Carlo
Implementation of Gillespie’s next reaction simulator appropriate for applications in a well mixed region. GMC has been used to study solid-electrolyte interphase (SEI) formation in Li-ion batteries.
As a starting point, a simple example of using GMC for homogeneous catalysis is shown in Examples.
Sqlite is used for input, output, and checkpointing. Before running GMC, two necessary .sqlite files must be generated - The Reaction Network Database and State Database. An example of Python code used to generate these files is available in the  examples directory . Below is an outline of each .sqlite file and its necessary tables. Each .sqlite file must follow this format exactly.
There are two tables in the reaction network database both of which must be created and filled in by the user:
CREATE TABLE metadata (
      number_of_species   INTEGER NOT NULL,
      number_of_reactions INTEGER NOT NULL
);
 CREATE TABLE reactions (
        reaction_id         INTEGER NOT NULL PRIMARY KEY,
        number_of_reactants INTEGER NOT NULL,
        number_of_products  INTEGER NOT NULL,
        reactant_1          INTEGER NOT NULL,
        reactant_2          INTEGER NOT NULL,
        product_1           INTEGER NOT NULL,
        product_2           INTEGER NOT NULL,
        rate                REAL NOT NULL
);
There are five tables in the initial state database all of which must be created by the user:
GMC will initalize its quantity to zero. This table must be filled in by the user.
CREATE TABLE initial_state (
      species_id             INTEGER NOT NULL PRIMARY KEY,
      count                  INTEGER NOT NULL
);
CREATE TABLE trajectories (
      seed                INTEGER NOT NULL,
      step                INTEGER NOT NULL,
      reaction_id         INTEGER NOT NULL,
      time                REAL NOT NULL
);
CREATE TABLE factors (
      factor_zero      REAL NOT NULL,
      factor_two       REAL NOT NULL,
      factor_duplicate REAL NOT NULL
);
CREATE TABLE interrupt_state (
      seed                    INTEGER NOT NULL,
      species_id              INTEGER NOT NULL,
      count                   INTEGER NOT NULL
);
CREATE TABLE interrupt_cutoff (
      seed                    INTEGER NOT NULL,
      step                    INTEGER NOT NULL,
      time                    REAL NOT NULL       
);
CREATE TABLE interrupt_cutoff (
      seed                    INTEGER NOT NULL,
      step                    INTEGER NOT NULL,
      time                    REAL NOT NULL,
      energy_budget           REAL NOT NULL     
);
To access the makefile, enter the GMC folder:
$ cd GMC
Next create an executable with the makefile. The executable will be located in the build folder.
$ make GMC
For further help on the makefile and to view other commands:
$ make help
GMC requires six input arguments (either step_cutoff or time_cutoff must be specified):
base_seed, base_seed+1, ..., base_seed+number_of_simulations-1.When running GMC ensure that your input file paths are correct considering the executable is inside the build folder. Below is an example of how GMC can be run using the input files inside the  examples directory  (here step_cutoff is specified):
build/GMC --reaction_database=examples/GMC/end-to-end-test/rn.sqlite --initial_state_database=examples/GMC/end-to-end-test/initial_state_copy.sqlite --number_of_simulations=1000 --base_seed=1000 --thread_count=8 --step_cutoff=200 --energy_budget=0 --checkpoint=1
Running this command does not generate any new files or directories but will populate the initial_state_database with trajectory data.