Documentation

More documentation coming soon.

Overview

Getting started is easy


# eGFRD sample script
# This shows how to implement a simple reaction A+B -> C
# in a cubic world with periodic boundary conditions.
# Lengths are measured in [m], times in [s], i.e. rates in [1/s].
from egfrd import *
from gfrdbase import *
import model

# Define a reactions model with chemical species and reaction rules
m = model.ParticleModel(world_size=1e-6)

A = model.Species('A', D=1e-12, radius=2.5e-8)
B = model.Species('B', D=1e-12, radius=2.5e-8)
C = model.Species('C', D=1e-12, radius=5.0e-8)

m.add_species_type(A)
m.add_species_type(B)
m.add_species_type(C)

R = model.create_binding_reaction_rule(A, B, C, k=1e-18)
m.network_rules.add_reaction_rule(R)

# Create a simulation world and assign the reactions model
# Note: matrix_size defines the number of cells per dimension of the neighborhood matrix
w = create_world(m, matrix_size=3)

# Create an eGFRD simulator and assign a random number generator
myrandom.seed(123)
s = EGFRDSimulator(world=w, rng=myrandom.rng)

# Set up initial condition
throw_in_particles(w, A, 100)
throw_in_particles(w, B, 100)

# Run!
while s.t < 100:
    s.step()

Learn more

More documentation, including Green’s functions and pseudocode for the algorithm can be found in the doc directory of the code.