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)

  1. Diffusion — Molecules undergo Brownian motion in 3D space with periodic boundary conditions.
  2. Energy — Energy sources (thermal, redox, UV, lightning) update their spatial fields and accumulate available energy.
  3. Chemistry — Reaction encounters are sampled via spatial hashing; viable reactions fire stochastically based on Gibbs free energy coupling.
  4. Assembly — Amphiphilic molecules cluster into micelles, promote to vesicles, accrete lipids, and dissolve if unstable.
  5. Replication — RNA templates on mineral surfaces or inside vesicles copy with error-prone fidelity.
  6. Metrics — Population counts, diversity indices, complexity scores, and fitness values are recorded.

Module Map

ModulePurposeKey Details
chemistry.pyPrebiotic chemistry engine27 molecule types, 27 reactions, pH/temp Gaussian modifiers, mineral catalysis, confinement catalysis
energy.pyEnergy couplingThermal gradients, FeS redox, UV Beer-Lambert, stochastic lightning
assembly.pySelf-assembly engineMicelle formation → vesicle promotion, lipid accretion, membrane permeability, dissolution
replication.pyInformation chemistryTemplate-directed RNA copying, Watson-Crick pairing, mutations, recombination
world.py3D environmentSpatial hashing grid, thermal/pH/mineral gradients, periodic boundary
simulation.pyMain loopOrchestrates diffusion → energy → chemistry → assembly → replication → metrics
config.pyConfiguration~30 parameters via dataclass, JSON scenario overlay
metrics.pyScoring & exportComplexity score, Shannon diversity, CSV/JSON export
sweep.pyParameter sweepsScenario, single-param, 2D grid sweep modes
visualization.pyDesktop 3DVispy 0.16.1 GPU-rendered particle visualization
web/server.pyWeb dashboardFlask 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

  1. Free amphiphiles — Lipids and fatty acids diffuse in the 3D world.
  2. Micelle formation — When amphiphile concentration exceeds the critical micelle concentration (CMC analog), nearby molecules cluster into micelles via spatial proximity detection.
  3. Vesicle promotion — Micelles that accumulate enough lipids (≥ vesicle_threshold) undergo a phase transition to form bilayer vesicles with interior volume.
  4. 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.
  5. Lipid accretion — Free amphiphiles near existing vesicles join the membrane, growing the vesicle.
  6. 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.
  7. 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

RoutePageDescription
/HomeLanding page with overview, capabilities, and quick start guide
/dashboardDashboardReal-time KPI cards, Chart.js charts, simulation controls, event log; shows project badge when running a project
/projectsProjectsCreate, import, and manage custom experiment projects
/projects/<id>Project EditorMolecule picker (25 types), environment config, run panel, download/upload, PDF report
/scenariosScenariosVisual scenario picker with descriptions and configuration details
/sweepParameter SweepBatch parameter exploration with tabular results
/microscopeMicroscopeProcedural Canvas 2D microscope with 9 magnification levels (1x–10Bx), 4 illumination modes, 7 stains, hover tooltips
/model3D ModelThree.js WebGL particle viewer with vesicle shells and thermal gradients
/chemistryChemistryLive reaction monitor — all 27 reactions grouped by pathway with firing counts, activity bars, and live feed
/timelineComplexity TimelineMilestone swimlane + 4 animated charts tracking molecular evolution
/lineageLineage TreeSVG phylogenetic tree of protocell lineages with fitness colouring
/energyEnergy FlowDepth-resolved energy profile (thermal, redox, UV, lightning) with coupling diagram
/networkReaction NetworkForce-directed graph of molecule types and reaction edges with live counts
/ai/prebioticPrebiotic Chemistry AIPathway discovery, yield analysis, thermodynamic audit, mineral screening
/ai/autocatalysisAutocatalytic Discovery AIRAF set detection, cycle enumeration, growth dynamics
/ai/membraneMembrane Assembly AICMC analysis, vesicle stability, division dynamics
/ai/replicationReplication & Heredity AITemplate fidelity, error threshold, ribozyme evolution, heredity tracking
/ai/metabolismProto-Metabolism AIEnergy coupling, proto-TCA search, chemiosmotic modelling
/ai/selectionSelection & Evolution AIFitness landscape, group selection, major transitions
/ai/environmentEnvironment Optimiser AIParameter sensitivity, scenario comparison, cycle analysis
/ai/synthesisFull Synthesis AIFull pipeline, bottleneck finder, hypothesis generator, summary report
/softwareExisting SoftwareSurvey of 20 related origin-of-life projects
/documentationDocumentationThis page — comprehensive reference
/profileProfileUser profile management — sign in, register, preferences
/securitySecuritySecurity architecture and access model documentation
/usersUser ManagementAdmin panel for managing registered users

REST API Endpoints

MethodEndpointDescription
Simulation
POST/api/startStart a new simulation run (accepts optional project_id)
POST/api/stopStop the running simulation
POST/api/pauseToggle pause on running simulation
GET/api/stateCurrent simulation state (includes project_id and project_name)
GET/api/historyMetrics history time series
GET/api/eventsRecent event log entries
GET/api/scenariosList available scenarios with metadata
POST/api/sweepRun parameter sweep and return results
Data
GET/api/particles3D particle positions for viewers
GET/api/moleculesAvailable molecule types and their properties
GET/api/reactionsLive reaction firing counts and feed
GET/api/reaction_rulesReaction rule metadata (temp, pH, rate, ΔG)
GET/api/lineageProtocell lineage tree data
GET/api/energyEnergy profile data for depth visualisation
GET/api/networkReaction 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/projectsList projects owned by the current user
POST/api/projectsCreate 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>/runRun synchronous simulation with project config
GET/api/projects/<id>/downloadDownload project as JSON file
POST/api/projects/uploadImport a project from JSON file upload
GET/api/projects/<id>/reportGenerate and download PDF report
User Accounts
GET/api/profileGet current user profile and auth status
POST/api/profile/registerRegister a new user account
POST/api/profile/loginAuthenticate and create session
POST/api/profile/logoutEnd current session
POST/api/profile/updateUpdate profile information
POST/api/profile/passwordChange password
GET/api/usersList 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

ModulePageActionsDescription
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

  1. Create — New project from the Projects page, or import an existing JSON file.
  2. Configure — Molecule picker (25 types across 6 categories), environment settings (temperature, pH, pressure), energy source toggles, world size, reaction parameters, and replication error rate.
  3. Run — Two modes: Run (synchronous, saves results to project) or Run & Watch Live (starts background simulation and opens the Dashboard with a project badge).
  4. Review — Run history table shows timestamp, steps, seed, complexity, molecules, vesicles, diversity, and fitness for each run.
  5. Export — Download as JSON for backup/sharing, or generate a PDF report with full configuration and summary statistics.

Features

FeatureDescription
Molecule Picker25 molecule types in 6 categories (Inorganic, Organic Intermediates, Sugars, Building Blocks, Amphiphiles, Polymers) with toggles and quantity inputs
Download JSONExport the full project (config + runs) as a JSON file
Import JSONUpload a previously exported project; a new project is created with fresh ID and the importer as owner
PDF ReportGenerate a multi-page PDF with project config, run history table, and summary statistics (no external dependencies)
CLI SupportRun a saved project from the terminal: python -m bol --project "Project Name"
User OwnershipProjects are scoped to the authenticated user; all API endpoints enforce owner check
Glossary of Terms
TermDefinition
AmphiphileA 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).
MicelleA spherical aggregation of amphiphilic molecules — precursor to vesicle formation.
ProtocellA vesicle (membrane compartment) that encapsulates functional molecules — a minimal precursor to a living cell.
RibozymeAn RNA molecule with catalytic activity. Evidence that RNA can serve as both genetic material and enzyme.
VesicleA bilayer membrane compartment that encapsulates molecules, creating an interior environment distinct from the outside.
Watson-Crick PairingComplementary base pairing: Adenine↔Uracil, Guanine↔Cytosine. Enables template-directed RNA copying.
Complexity ScoreA composite metric (0-100) combining polymer diversity, vesicle fitness, catalytic activity, and information content.
Shannon DiversityAn information-theoretic measure of the evenness and richness of molecule type distribution.
FitnessA vesicle's ability to accumulate catalytic RNA and peptides — determines growth rate and division probability.