Devlog #70 – Wave 50: Complement Cascade, Spin Precession & Galvanic Cell

Wave 50 brings three underrepresented categories — immunology, magnetism, and electrochemistry — each a third simulation: animated complement pathway cascade with three activation routes and MAC pore formation; Larmor spin precession on an isometric Bloch sphere with Bloch-equation relaxation; and a galvanic cell with Nernst-equation electrochemistry and five metal-pair presets. Platform total reaches 523 live simulations.

Wave 50 at a Glance

3
New simulations
6
HTML files (EN+UK)
523
Total simulations
3
Blog posts
🦠

Complement Cascade

Three activation pathways, C3 convertase assembly, C3b opsonization deposits on a bacterium surface, MAC pore formation, and anaphylatoxin release.

Launch →
🧲

Spin Precession

Larmor precession on an isometric Bloch sphere, T1/T2 relaxation curves, FID signal, four nucleus presets, and an RF-pulse button for MRI physics experiments.

Launch →

Galvanic Cell

Daniell cell and four other metal pairs with animated ion flow, electron current on the external wire, salt bridge, and real-time Nernst equation output.

Launch →

Complement Cascade — Three Pathways to Immunity

The complement system comprises more than 30 plasma proteins that form a self-amplifying proteolytic cascade. All three activation pathways — classical, alternative, and lectin — converge on the cleavage of C3:

Every pathway produces a C3 convertase that cleaves C3 into C3a (anaphylatoxin) and C3b. C3b deposits on the pathogen surface (opsonization) and, with additional cleavage steps, assembles C5 convertase. C5 cleavage releases C5a (potent chemoattractant) and C5b, which nucleates the Membrane Attack Complex (MAC: C5b-6-7-8-9). The MAC inserts into the bacterial membrane as a ~10 nm transmembrane pore, causing osmotic lysis.

Animation Architecture

The canvas is divided into three visual zones: a floating pool of C3 proteins and initiator particles in the fluid phase, a bacterium body at center-right representing the target surface, and a drift layer where anaphylatoxins escape upward after cleavage. Particle state transitions follow a probabilistic finite-state machine:

Temperature enters via a multiplicative factor k_T = exp(0.035 × (T − 37)) applied to all reaction rates, reflecting approximate Q⊂10; ≈ 1.3 for most complement reactions.

Try it: set Inhibitor (DAF/CD55) to 80%, fire the Alternative Pathway, and watch opsonization stall. DAF accelerates decay of C3 convertase; high levels essentially block the amplification loop.

Spin Precession — Bloch Equations and MRI Physics

Nuclear magnetic resonance (NMR) and MRI rest on a single quantum mechanical fact: nuclei with non-zero spin possess a magnetic moment μ that precesses around an applied field B0 at the Larmor frequency:

ω0 = γ B0

For ¹H (proton), γ = 42.577 MHz/T, so a 3 T clinical scanner resonates at 127.7 MHz. Other nuclei span a wide range: ⁰4¹3C at 10.708 MHz/T is used for carbon-13 spectroscopy; ¹9F (40.078) and ³¹P (17.235) are important in drug-metabolism and phosphate-energy research respectively.

Bloch Equations

The macroscopic magnetisation vector M obeys the phenomenological Bloch equations, which add exponential relaxation to the torque equation:

dMz/dt = −(Mz − M0) / T1

dMxy/dt = −Mxy / T2

T1 (longitudinal, spin-lattice) governs recovery of Mz toward equilibrium M0; T2 (transverse, spin-spin) governs de-phasing of the rotating Mxy component. In tissue, T1 and T2 vary enough between tissue types to generate MRI contrast: grey matter has T1≈1.3 s, white matter T1≈0.95 s; CSF has T2≈2 s while muscle has T2≈50 ms.

Isometric Bloch Sphere and FID

The challenge in visualising the Bloch sphere on a flat canvas is rendering three-dimensional axes legibly without a WebGL context. The simulation uses a simple isometric projection: a 3D point (x, y, z) maps to canvas coordinates via cx = px + (x − z) × cos(30°), cy = py − (x + z) × sin(30°) + y × 0.85. The M vector trail is stored as a circular buffer of 80 points and drawn with decreasing opacity, tracing the precession helix as Mxy decays. After an RF pulse, the Free Induction Decay (FID) panel shows the damped sinusoidal signal that MRI scanners digitise and Fourier-transform to produce the frequency-domain spectrum.

Try it: set flip angle to 90°, then adjust T2 between 10 ms and 500 ms. Short T2 causes rapid de-phasing (broad NMR linewidth); long T2 gives a sharp, long-lived FID — the basis of T2-weighted MRI contrast.

Galvanic Cell — Nernst Equation and Electrode Dynamics

A galvanic (voltaic) cell converts spontaneous chemical redox energy into electrical work. In the classic Daniell cell, zinc is oxidised at the anode and copper is deposited at the cathode:

Zn(s) → Zn²⁺(aq) + 2e⁻   E° = −0.76 V

Cu²⁺(aq) + 2e⁻ → Cu(s)   E° = +0.34 V

The standard cell potential E°cell = E°cathode − E°anode = 1.10 V. Under non-standard concentrations the Nernst equation corrects for the reaction quotient Q:

E = E° − (RT / nF) · ln Q

where R = 8.314 J/(mol·K), T is absolute temperature, n is the number of electrons transferred, and F = 96485 C/mol. For the Daniell cell with Q = [Zn²⁺]/[Cu²⁺]:

The Gibbs free energy ΔG = −nFE; when ΔG < 0 the reaction is spontaneous. The simulator displays both ΔG° (standard) and the real-time Nernst E and current I = E/(Rload).

Particle Animation Strategy

Two half-cells are drawn side-by-side with a U-shaped salt bridge between them. Anions (NO⊂3;&sup0; from the salt bridge) drift left and cations (K¹) drift right to maintain charge neutrality as the reaction proceeds. Metal ions dissolving from the anode drift rightward through the solution; ions depositing at the cathode drift leftward and disappear on contact with the electrode surface. Electrons are represented as small charged particles pulsing along the external wire from anode to cathode. Animation speed scales with the computed current I so that a low-resistance load produces visually faster electron flow.

Try it: switch to the Mg/Cu pair (E° = 2.71 V), then set anode concentration to 0.001 M. Watch the Nernst voltage drop and ΔG become less negative — even a very active metal can be partially “suppressed” by extreme dilution.

Implementation Notes

Complement: Managing Cascade State

The simulation maintains a global state object tracking c3bCount, macCount, c5aCount, and active convertase assemblies. Each animation frame, all free particles are checked against the current activation probability: P_bind = baserate × k_T × (1 − inhibitorFraction). This keeps the cascade responsive to slider changes without restarting the simulation.

Spin Precession: Numerical Integration

The Bloch equations are integrated using a simple Euler step with dt capped at 5 ms to prevent instability at high ω0 values. The precession angle advances by Δφ = ω0 × dt each frame, while Mz and Mxy follow their respective exponential responses analytically within each step.

Galvanic Cell: Nernst Clamp

At very low concentrations (Q → 0) ln Q diverges. The simulator clamps Q to a minimum of 10³⁽&sup0;⁾ to avoid NaN values in the Nernst calculation, which represents the practical diffusion-limited concentration near electrode surfaces.

Next Steps

Wave 51 will continue expanding underrepresented categories. Candidates include additional immunology simulations (T-cell activation, antibody kinetics), additional electrochemistry topics (electrolysis, concentration cells), and quantum magnetism (exchange interaction, Heisenberg model). As always, suggestions via the contact page are welcome.