Forward and inverse modes#
Forward simulation and inverse emulation share the spheroidal cell state described in Cells as spheroidal agents, and each defines its own dynamics. Coordinates, radii, timesteps, and coefficients are model-scale values. External calibration maps them to SI or biological scales when an application requires that interpretation.
Mechanics and diffusion in each mode#
Both modes use local pair interactions and graph-style molecular diffusion. The emulator keeps a fixed agent count and uses one uniform sticky-sphere force. For stabilized distance \(d=\lVert x_i-x_j\rVert_2+\epsilon_n\), direction \(u=(x_i-x_j)/d\), and \(s=r_i+r_j\),
where \(\epsilon_d=0.01\) in model units. The emulator’s Euler update adds
this force. The simulator subtracts a potential-gradient buffer, uses
K_REP=3, type-dependent attraction and ranges, and EPS_DIST=0.25 for
contact-local polarity and chemistry terms.
For emulator concentrations, the graph Laplacian is
Simulator chemistry stores activator and inhibitor abundances and converts them to concentrations using cell volume.
Forward mode: prescribed case study#
waxmorph.simulator implements a polarized epithelial-mesenchymal
aggregate with type-dependent mechanics, activator-inhibitor chemistry, growth,
and division. The case study defines a prescribed model; application-specific
calibration connects it to a biological system.
With \(a=A/(V+\epsilon)\), \(i=I/(V+\epsilon)\), and contact fluxes \(\ell_A=\sum_j(a_j-a_i)\) and \(\ell_I=\sum_j(i_j-i_i)\), one chemistry step is
Optional cell-type masking selects the cells that receive reaction and damping. The remaining cells follow an explicit diffusion path, and every output stays within the clamp bounds. The reacting-cell update includes the production cap and semi-implicit damping.
Physical radii below their targets grow monotonically up to those targets;
radii at or above target remain unchanged. Mesenchymal equilibrium radii are capped
at R_max. Epithelial equilibrium radii copy through while physical radii
approach R_ref. Division uses bounded atomic slot reservation, so the active
count remains within preallocated capacity. Both daughters split chemical
abundance; mesenchymal daughters rescale radius for half volume, while
epithelial daughters retain the parent radius.
Inverse mode: learned emulator with a fixed agent count#
The emulator infers a local rollout rule from source and target point clouds.
It combines GNS updates with its own sticky-sphere mechanics and graph diffusion
for a fixed particle population. The top-level API uses PyTorch;
waxmorph.jax provides a counterpart with backend-specific graph tuples,
loss families, PRNG, checkpoint, and runtime contracts.
Each model-evaluation step:
Builds a learned contact graph from the current state.
Predicts local position, polarity, and concentration increments with the GNS.
Applies the learned increments.
Applies configured differentiable mechanics and diffusion corrections.
Accumulates shape loss at selected target frames.