Reaction Network Monte Carlo
A kMC implementation coupling a homogeneous (Gillespie-like) region with a lattice, enabling simulations with reactions occurring in multiple phases and capable of electrochemical reactions. Either Marcus of Butler-Volmer electron transfer theory (specified at runtime, see ‘Running LGMC’ below) can be used when calculating rates for electrochemical reactions. The lattice is periodic in the x, y direction and non-periodic in the z direction. The lattice may be static (no sites can be added or deleted) or dynamic (sites are added through adsorption and deleted through desorption reactions).
As a starting point two examples of LGMC
uses are shown in Examples - LGMC
with a static lattice to model CO Oxidation on Cu and LGMC
with a dynamic lattice to simulate the formation and evolution of the solid electrolyte interphase in a lithium-ion battery.
Sqlite is used for input, output, and checkpointing. Before running LGMC two necessary .sqlite files must be generated - The Lattice Reaction Network Database and State Database. Examples of Python code used to generate these files are available in 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 lattice 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,
phase_reactant_1 CHAR(1) NOT NULL,
phase_reactant_2 CHAR(1) NOT NULL,
phase_product_1 CHAR(1) NOT NULL,
phase_product_2 CHAR(1) NOT NULL,
dG REAL NOT NULL,
prefactor REAL NOT NULL,
rate REAL NOT NULL,
electron_tunneling_coefficient REAL NOT NULL,
reorganization_energy REAL NOT NULL,
charge_transfer_coefficient REAL NOT NULL,
type CHAR(1) NOT NULL
);
There are five tables in the initial state database all of which must be created 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,
time REAL NOT NULL,
reaction_id INTEGER NOT NULL,
site_1_mapping INTEGER NOT NULL,
site_2_mapping INTEGER 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,
quantity INTEGER NOT NULL,
site_mapping INTEGER NOT NULL,
edge INTEGER NOT NULL
);
CREATE TABLE interrupt_cutoff (
seed INTEGER NOT NULL,
step INTEGER NOT NULL,
time REAL NOT NULL,
maxk INTEGER NOT NULL
);
To access the makefile, enter the LGMC folder:
$ cd LGMC
Next create an executable with the makefile. The executable will be located in the build
folder.
$ make LGMC
For further help on the makefile and to view other commands:
$ make help
LGMC requires seven input arguments (either step_cutoff
or time_cutoff
must be specified):
base_seed, base_seed+1, ..., base_seed+number_of_simulations-1
.When running LGMC ensure that your input file paths are correct considering the executable is inside the build
folder. Below is an example of how LGMC can be run using the input files inside the examples directory (here step_cutoff
is specified):
build/LGMC --lattice_reaction_database=examples/LGMC/CO_oxidation/rn.sqlite --initial_state_database=examples/LGMC/CO_oxidation/initial_state.sqlite --number_of_simulations=1000 --base_seed=1000 --thread_count=8 --step_cutoff=200 --checkpoint=1 --parameters=examples/LGMC/CO_oxidation/LGMC_params.txt
Running this command does not generate any new files or directories but will populate the initial_state_database
with trajectory data.