Simulate a Toy Autocatalytic Network
Source:R/autocatalytic_network.R, R/chemistry.R
autocatalytic_network.RdCreates a random network of molecular types where some molecules catalyze the production of others. This simplified model is useful for visualizing how mutually reinforcing chemical systems may grow.
Creates a random network of molecular types where some molecules catalyze the production of others. This simplified model is useful for visualizing how mutually reinforcing chemical systems may grow.
Usage
autocatalytic_network(
n_types = 10,
steps = 100,
catalysis_probability = 0.15,
base_rate = 0.05,
catalytic_boost = 0.1,
decay_rate = 0.02,
seed = NULL
)
autocatalytic_network(
n_types = 10,
steps = 100,
catalysis_probability = 0.15,
base_rate = 0.05,
catalytic_boost = 0.1,
decay_rate = 0.02,
seed = NULL
)Arguments
- n_types
Number of molecular types.
- steps
Number of simulation steps.
- catalysis_probability
Probability that one molecule type catalyzes another.
- base_rate
Baseline production rate.
- catalytic_boost
Additional production rate from catalysts.
- decay_rate
Fraction of each molecule type lost per step.
- seed
Optional random seed.
Value
A list containing a time-series tibble and the catalysis matrix.
A list containing a time-series tibble and the catalysis matrix.
Examples
net <- autocatalytic_network(n_types = 5, steps = 20, seed = 2)
head(net$time_series)
#> # A tibble: 6 × 3
#> step molecule abundance
#> <int> <chr> <dbl>
#> 1 0 M1 0.540
#> 2 0 M2 0.234
#> 3 0 M3 0.421
#> 4 0 M4 0.966
#> 5 0 M5 0.219
#> 6 1 M1 0.579
net <- autocatalytic_network(n_types = 5, steps = 20, seed = 2)
head(net$time_series)
#> # A tibble: 6 × 3
#> step molecule abundance
#> <int> <chr> <dbl>
#> 1 0 M1 0.540
#> 2 0 M2 0.234
#> 3 0 M3 0.421
#> 4 0 M4 0.966
#> 5 0 M5 0.219
#> 6 1 M1 0.579