BOL Documentation
Comprehensive reference for the Beginning of Life simulator — architecture, chemistry, assembly, replication, and the web platform.
System Architecture
BOL is a modular Python application with a simulation core and a web-based frontend. The simulation runs server-side in a background thread while the Flask web server provides real-time updates to the browser via polling APIs.
Simulation Pipeline (each step)
- Diffusion — Molecules undergo Brownian motion in 3D space with periodic boundary conditions.
- Energy — Energy sources (thermal, redox, UV, lightning) update their spatial fields and accumulate available energy.
- Chemistry — Reaction encounters are sampled via spatial hashing; viable reactions fire stochastically based on Gibbs free energy coupling.
- Assembly — Amphiphilic molecules cluster into micelles, promote to vesicles, accrete lipids, and dissolve if unstable.
- Replication — RNA templates on mineral surfaces or inside vesicles copy with error-prone fidelity.
- Metrics — Population counts, diversity indices, complexity scores, and fitness values are recorded.
Module Map
| Module | Purpose | Key Details |
|---|---|---|
chemistry.py | Prebiotic chemistry engine | 27 molecule types, 27 reactions, pH/temp Gaussian modifiers, mineral catalysis, confinement catalysis |
energy.py | Energy coupling | Thermal gradients, FeS redox, UV Beer-Lambert, stochastic lightning |
assembly.py | Self-assembly engine | Micelle formation → vesicle promotion, lipid accretion, membrane permeability, dissolution |
replication.py | Information chemistry | Template-directed RNA copying, Watson-Crick pairing, mutations, recombination |
world.py | 3D environment | Spatial hashing grid, thermal/pH/mineral gradients, periodic boundary |
simulation.py | Main loop | Orchestrates diffusion → energy → chemistry → assembly → replication → metrics |
config.py | Configuration | ~30 parameters via dataclass, JSON scenario overlay |
metrics.py | Scoring & export | Complexity score, Shannon diversity, CSV/JSON export |
sweep.py | Parameter sweeps | Scenario, single-param, 2D grid sweep modes |
visualization.py | Desktop 3D | Vispy 0.16.1 GPU-rendered particle visualization |
web/server.py | Web dashboard | Flask server with page routes and REST API endpoints |
Prebiotic Chemistry — 27 Reactions
BOL models the key abiotic reaction pathways hypothesized to drive the origin of life. Each reaction rule specifies:
- Reactants & products — molecule types consumed and produced
- ΔG (Gibbs free energy) — thermodynamic barrier; negative = exergonic, positive = endergonic (needs energy coupling)
- Base rate — intrinsic reaction probability per encounter
- pH & temperature optima — Gaussian modifiers that peak at optimal environmental conditions
- Mineral requirement — whether the reaction requires mineral surface catalysis
Reaction Categories
C1 Fixation & Small Molecules
- CO₂ + H₂ → CO + H₂O (water-gas shift)
- CO + H₂ → formaldehyde (Fischer-Tropsch)
- CO₂ + H₂S → CO + H₂O (anaerobic)
- UV: CO₂ + H₂ → formaldehyde (photochemical)
- UV: 2H₂O → 2H₂ (water photolysis)
Formose & Sugar Chemistry
- 2 formaldehyde → glycolaldehyde
- glycolaldehyde + formaldehyde → simple_sugar
- simple_sugar → ribose (isomerization)
Nitrogen Chemistry
- CO + NH₃ → HCN + H₂O
- UV: 2HCN → nucleobase (polymerization)
- Discharge: N₂ + CH₄ → 2HCN
- Discharge: CH₄ + NH₃ → amino_acid (Miller-Urey)
Amino Acid & Peptide Synthesis
- HCN + formaldehyde + NH₃ → amino_acid (Strecker)
- 2 amino_acid → peptide (condensation)
- peptide + amino_acid → peptide (elongation)
Nucleotide & RNA Synthesis
- ribose + nucleobase + phosphate → nucleotide
- nucleotide → activated_nucleotide (activation)
- 2 activated_nucleotide → rna_strand (polymerization)
- rna_strand + activated_nucleotide → rna_strand (elongation)
Lipid & Metabolism
- CO₂ + H₂S → pyruvate (proto-metabolism)
- pyruvate + CO → acetyl_thioester
- glycerol + fatty_acid → lipid
- formaldehyde → glycerol (reduction)
Energy Sources & Thermodynamics
Thermal Gradient
The hydrothermal vent produces a continuous thermal gradient. Hot fluid at the bottom (up to 400°C in black smokers) drives endergonic reactions by coupling heat energy to chemical bonds. Temperature decreases linearly with height.
Redox Chemistry (FeS)
Iron-sulfide minerals (pyrite, mackinawite) at the vent surface provide electron transfer energy. This is strongest in the mineral-rich zone (bottom 67% of the world) and powers CO₂ fixation and thioester formation.
UV Radiation
Ultraviolet light penetrates the water column with Beer-Lambert exponential attenuation. UV drives photolysis (water splitting), HCN polymerization, and formaldehyde synthesis near the surface.
Lightning Discharge
Stochastic lightning events at the surface provide intense but brief energy pulses. Each strike has a blast radius and persists for 3 steps with decaying intensity. Drives Miller-Urey amino acid synthesis.
Gibbs Free Energy Coupling
Reactions only proceed when their ΔG barrier is overcome by available energy. Exergonic reactions (ΔG < 0) proceed spontaneously with rate modulated by temperature. Endergonic reactions (ΔG > 0) require energy coupling — the available thermal, redox, UV, or lightning energy at the molecule's position must exceed the ΔG barrier.
Self-Assembly & Protocells
Assembly Pathway
- Free amphiphiles — Lipids and fatty acids diffuse in the 3D world.
- Micelle formation — When amphiphile concentration exceeds the critical micelle concentration (CMC analog), nearby molecules cluster into micelles via spatial proximity detection.
- Vesicle promotion — Micelles that accumulate enough lipids (≥ vesicle_threshold) undergo a phase transition to form bilayer vesicles with interior volume.
- Encapsulation — At vesicle formation, all molecules inside the closing bilayer radius are trapped. This creates a compartment that isolates interior chemistry from the outside environment.
- Lipid accretion — Free amphiphiles near existing vesicles join the membrane, growing the vesicle.
- Membrane permeability — Small molecules (H₂O, CO₂, H₂, etc.) can cross the membrane. Semi-permeable molecules (amino acids, nucleotides) cross slowly, creating a net inward bias.
- Division — Vesicles exceeding a size threshold divide into two daughter cells, randomly partitioning contents and membrane lipids.
Selection Pressure
Vesicle fitness is computed from their interior contents: catalytic RNA strands and peptides contribute to fitness. Fitter vesicles grow faster via osmotic influx of nutrients, attract more membrane lipids at greater distances, and produce daughters that inherit their competitive advantages.
RNA Replication & Variation
Template-Directed Copying
RNA strands serve as templates for producing complementary copies. Watson-Crick base pairing (A↔U, G↔C) guides the copying process. Copying occurs on mineral surfaces (requiring mineral ≥ 0.1) or inside vesicles (where confinement provides the necessary concentration).
Mutation & Variation
- Point mutations — Random base substitutions at configurable error rate
- Insertions — Random base additions (length-scaled probability)
- Deletions — Random base removals (length-scaled probability)
- Segment duplication — 2-4 base segments duplicate within the strand
- Recombination — Single-point crossover between co-localized RNA strands (8% chance)
Ribozyme Emergence
RNA strands are checked for catalytic motifs (GUC, GAA, CCA, GCCA, GUCC, GAAC) — short sequences inspired by real ribozyme active sites. Strands with these motifs and sufficient length become catalysts that boost reaction rates inside their vesicle.
Web Platform & API
Pages
| Route | Page | Description |
|---|---|---|
/ | Home | Landing page with overview, capabilities, and quick start guide |
/dashboard | Dashboard | Real-time KPI cards, Chart.js charts, simulation controls, event log; shows project badge when running a project |
/projects | Projects | Create, import, and manage custom experiment projects |
/projects/<id> | Project Editor | Molecule picker (25 types), environment config, run panel, download/upload, PDF report |
/scenarios | Scenarios | Visual scenario picker with descriptions and configuration details |
/sweep | Parameter Sweep | Batch parameter exploration with tabular results |
/microscope | Microscope | Procedural Canvas 2D microscope with 9 magnification levels (1x–10Bx), 4 illumination modes, 7 stains, hover tooltips |
/model | 3D Model | Three.js WebGL particle viewer with vesicle shells and thermal gradients |
/chemistry | Chemistry | Live reaction monitor — all 27 reactions grouped by pathway with firing counts, activity bars, and live feed |
/timeline | Complexity Timeline | Milestone swimlane + 4 animated charts tracking molecular evolution |
/lineage | Lineage Tree | SVG phylogenetic tree of protocell lineages with fitness colouring |
/energy | Energy Flow | Depth-resolved energy profile (thermal, redox, UV, lightning) with coupling diagram |
/network | Reaction Network | Force-directed graph of molecule types and reaction edges with live counts |
/ai/prebiotic | Prebiotic Chemistry AI | Pathway discovery, yield analysis, thermodynamic audit, mineral screening |
/ai/autocatalysis | Autocatalytic Discovery AI | RAF set detection, cycle enumeration, growth dynamics |
/ai/membrane | Membrane Assembly AI | CMC analysis, vesicle stability, division dynamics |
/ai/replication | Replication & Heredity AI | Template fidelity, error threshold, ribozyme evolution, heredity tracking |
/ai/metabolism | Proto-Metabolism AI | Energy coupling, proto-TCA search, chemiosmotic modelling |
/ai/selection | Selection & Evolution AI | Fitness landscape, group selection, major transitions |
/ai/environment | Environment Optimiser AI | Parameter sensitivity, scenario comparison, cycle analysis |
/ai/synthesis | Full Synthesis AI | Full pipeline, bottleneck finder, hypothesis generator, summary report |
/software | Existing Software | Survey of 20 related origin-of-life projects |
/documentation | Documentation | This page — comprehensive reference |
/profile | Profile | User profile management — sign in, register, preferences |
/security | Security | Security architecture and access model documentation |
/users | User Management | Admin panel for managing registered users |
REST API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| Simulation | ||
POST | /api/start | Start a new simulation run (accepts optional project_id) |
POST | /api/stop | Stop the running simulation |
POST | /api/pause | Toggle pause on running simulation |
GET | /api/state | Current simulation state (includes project_id and project_name) |
GET | /api/history | Metrics history time series |
GET | /api/events | Recent event log entries |
GET | /api/scenarios | List available scenarios with metadata |
POST | /api/sweep | Run parameter sweep and return results |
| Data | ||
GET | /api/particles | 3D particle positions for viewers |
GET | /api/molecules | Available molecule types and their properties |
GET | /api/reactions | Live reaction firing counts and feed |
GET | /api/reaction_rules | Reaction rule metadata (temp, pH, rate, ΔG) |
GET | /api/lineage | Protocell lineage tree data |
GET | /api/energy | Energy profile data for depth visualisation |
GET | /api/network | Reaction network graph data |
| AI Laboratory | ||
POST | /api/ai/<module>/<action> | Run any of the 27 AI analysis functions against live simulation state |
| Projects | ||
GET | /api/projects | List projects owned by the current user |
POST | /api/projects | Create a new project |
GET | /api/projects/<id> | Get project details |
PUT | /api/projects/<id> | Update project configuration |
DELETE | /api/projects/<id> | Delete a project |
POST | /api/projects/<id>/run | Run synchronous simulation with project config |
GET | /api/projects/<id>/download | Download project as JSON file |
POST | /api/projects/upload | Import a project from JSON file upload |
GET | /api/projects/<id>/report | Generate and download PDF report |
| User Accounts | ||
GET | /api/profile | Get current user profile and auth status |
POST | /api/profile/register | Register a new user account |
POST | /api/profile/login | Authenticate and create session |
POST | /api/profile/logout | End current session |
POST | /api/profile/update | Update profile information |
POST | /api/profile/password | Change password |
GET | /api/users | List all registered profiles (admin) |
DELETE | /api/users/<username> | Delete a user profile |
AI Laboratory — 27 Analysis Functions
The AI Laboratory provides 27 deterministic analysis functions organised into 8 modules. Each function inspects live simulation state (molecules, reactions, vesicles, energy systems) and produces structured reports rendered with rich visual components (tables, bar charts, timelines, cards).
All actions are invoked via POST /api/ai/<module>/<action> and return JSON. Each module has a dedicated page accessible from the sidebar under AI Laboratory.
Modules & Actions
| Module | Page | Actions | Description |
|---|---|---|---|
| Prebiotic Chemistry | /ai/prebiotic |
pathway, yield, thermo, mineral | Synthesis pathway discovery, reaction yield optimisation, thermodynamic feasibility audit (ΔG landscape), mineral catalyst screening |
| Autocatalytic Discovery | /ai/autocatalysis |
raf, cycles, growth | Reflexively autocatalytic food-generated (RAF) set detection, autocatalytic cycle enumeration with ΔG rankings, network growth dynamics |
| Membrane Assembly | /ai/membrane |
cmc, stability, division | Critical micelle concentration analysis, vesicle population stability scoring (fitness, age, lipid count), division dynamics and generation distribution |
| Replication & Heredity | /ai/replication |
template, error, ribozyme, heredity | Template-directed polymerisation events, Eigen's error threshold calculation, ribozyme catalogue with sequences and motifs, position entropy analysis |
| Proto-Metabolism | /ai/metabolism |
coupling, tca, gradient | Energy coupling discovery (driver→driven→net ΔG), proto-TCA-like metabolic cycle search, chemiosmotic depth gradient modelling |
| Selection & Evolution | /ai/selection |
landscape, group, transitions | Fitness landscape mapping with NK model, group selection dynamics analysis, major evolutionary transitions detector |
| Environment Optimiser | /ai/environment |
sweep, compare, cycles | Multi-parameter sensitivity analysis, scenario comparison across all 4 hypotheses, day-night and seasonal cycle detection |
| Full Synthesis | /ai/synthesis |
full, bottleneck, hypothesis, report | Complete end-to-end pipeline assessment, rate-limiting step identification, testable hypothesis generation, comprehensive summary report |
Visual Renderers
Each action has a dedicated renderer in ai-results.js (27 renderers total) that transforms raw JSON into rich visual components:
- Summary cards — Key metric highlights with colour-coded values
- Data tables — Sortable tables for reactions, vesicles, ribozymes, etc.
- Bar charts — Horizontal charts for yields, sensitivities, fitness rankings
- Timelines — Evolutionary event cascades and emergence tracking
- Hypothesis cards — Generated hypotheses with predictions and confidence indicators
- Depth profiles — Stacked gradient visualisations for T, pH, mineral, and energy fields
Projects
Projects let users create custom experiments by selecting molecules, configuring environments, and running simulations. Each project saves its configuration and full run history.
Project Lifecycle
- Create — New project from the Projects page, or import an existing JSON file.
- Configure — Molecule picker (25 types across 6 categories), environment settings (temperature, pH, pressure), energy source toggles, world size, reaction parameters, and replication error rate.
- Run — Two modes: Run (synchronous, saves results to project) or Run & Watch Live (starts background simulation and opens the Dashboard with a project badge).
- Review — Run history table shows timestamp, steps, seed, complexity, molecules, vesicles, diversity, and fitness for each run.
- Export — Download as JSON for backup/sharing, or generate a PDF report with full configuration and summary statistics.
Features
| Feature | Description |
|---|---|
| Molecule Picker | 25 molecule types in 6 categories (Inorganic, Organic Intermediates, Sugars, Building Blocks, Amphiphiles, Polymers) with toggles and quantity inputs |
| Download JSON | Export the full project (config + runs) as a JSON file |
| Import JSON | Upload a previously exported project; a new project is created with fresh ID and the importer as owner |
| PDF Report | Generate a multi-page PDF with project config, run history table, and summary statistics (no external dependencies) |
| CLI Support | Run a saved project from the terminal: python -m bol --project "Project Name" |
| User Ownership | Projects are scoped to the authenticated user; all API endpoints enforce owner check |
Glossary of Terms
| Term | Definition |
|---|---|
| Amphiphile | A molecule with both hydrophilic (water-loving) and hydrophobic (water-fearing) portions. Forms micelles and vesicle membranes. |
| Gibbs Free Energy (ΔG) | The thermodynamic potential that determines whether a reaction is spontaneous (ΔG < 0) or requires energy input (ΔG > 0). |
| Micelle | A spherical aggregation of amphiphilic molecules — precursor to vesicle formation. |
| Protocell | A vesicle (membrane compartment) that encapsulates functional molecules — a minimal precursor to a living cell. |
| Ribozyme | An RNA molecule with catalytic activity. Evidence that RNA can serve as both genetic material and enzyme. |
| Vesicle | A bilayer membrane compartment that encapsulates molecules, creating an interior environment distinct from the outside. |
| Watson-Crick Pairing | Complementary base pairing: Adenine↔Uracil, Guanine↔Cytosine. Enables template-directed RNA copying. |
| Complexity Score | A composite metric (0-100) combining polymer diversity, vesicle fitness, catalytic activity, and information content. |
| Shannon Diversity | An information-theoretic measure of the evenness and richness of molecule type distribution. |
| Fitness | A vesicle's ability to accumulate catalytic RNA and peptides — determines growth rate and division probability. |