Skip to content

Replace the least-squares contact solve with a non-negative contact solve coupled to growth #53

Open

Description

@marpaia

Summary

Issue #51 records that the regularized least-squares contact solve cannot keep growing cells apart in a full space: pairs overlap by more than a radius, invert, and never separate, and no gamma setting suits both a free colony and a jam. This issue is the plan for the replacement: a contact solve with non-negative forces in which growth is part of the same convex problem, following the constraint-based literature for growing rod-shaped cells.

What the literature establishes

Source What it contributes Limits for our case
Yan, Zhang, Shelley 2019 [1] Contact between rigid spherocylinders as a complementarity problem: forces $\gamma \ge 0$, gaps $\Phi \ge 0$, $\gamma \perp \Phi$. Linearized over a step it is a convex QP, solved matrix-free with Barzilai–Borwein projected gradient descent (BBPGD). Reports steps 10–100× larger than repulsive potentials allow. Periodic 3D, no walls. Does not discuss a step that starts from overlap. Near close packing the solve needs O(1000) iterations.
Yan et al. 2020 [2] The same solver at scale. A wall contact is one more one-sided column of the constraint matrix. Stable with particles moving 10–20% of a radius per step. Minimum-map residual $\lVert \min(\gamma, A\gamma + b) \rVert$ as the stopping test. No warm-start or over-packing guidance.
Weady et al. 2024 [3] Growth that slows with axial compressive stress, $\frac{\mathrm{d}\ell}{\mathrm{d}t} = \frac{\ell}{\tau}\exp(-\lambda\sigma)$, with $\sigma$ expressed through the contact multipliers, so contact and growth are solved together as a nonlinear convex problem. Exact continuum solutions to validate against. 2D, unconfined. The discretization is in supplementary material.
Lerchner (TU Munich) [4] A full write-up and open implementation of the Weady scheme, compared with a Hertzian soft model in one framework. Hard model: packing fraction about 0.9 and worst overlap at the solver tolerance. Soft model: packing fractions above 5 in the colony centre. Student project report, not peer reviewed. 2D.
Palmer, Aktulga, Gao 2025 [5] ReLCP: one linearized solve leaves overlap from motion the constraint rows do not see. Re-detect contacts at the trial configuration, append rows without re-linearizing the old ones, re-solve. Typically under 10 rounds per step. Existence and termination proved only for strictly convex bodies starting overlap-free with a small step. Frictionless.
Winkle et al. 2017 [6] Trap-specific model: extension rate constant up to a compression threshold $T$, falling linearly to zero at $2T$. Compression is quadratic along a mother machine and along an open trap. 2D, built on a game-physics engine.
Doumic, Hecht, Peurichard 2020 [7] A soft (Hertzian) rod model with a displacement-limited adaptive step, as a point of comparison. Reports dense colonies of overlapping cells at measured diameters.
Rudge et al. 2012 [8] and CellModeller source [9] The origin of the current solver: regularized least-squares over seven degrees of freedom per cell, conjugate gradient, same defaults (gamma = 10, cgs_tol = 5e-3, muA = 1). CellModeller passes the growth increment through the solve and repeats contact detection on predicted positions up to max_substeps = 8 times per step, accumulating contacts. Constraints are equalities in a least-squares sense; nothing keeps contact forces non-negative.

Measured cost of the hard model in [4]: about 1,000 BBPGD iterations per step on average with peaks near 5,000, a step of about 3e-4 growth times at a tolerance of 0.1% of a cell diameter, a runtime minimum where cells move about two tolerances per step, and solver failure above about 3.7 tolerances per step.

On the biology, experiments disagree about how strongly pressure slows E. coli growth: [10] reports growth arrest at self-generated pressures near 300 kPa, while [11] reports growth nearly insensitive to an applied 34 kPa. The stress sensitivity is therefore a model parameter, not a measured constant.

Design

This section describes the solve as built in #54. The lasting description is docs/architecture/0026-contact-dynamics.md.

Each mechanics substep minimizes one convex energy over the contact multipliers:

$$\Huge \begin{gathered} \min_{\gamma \ge 0} E(\gamma),\\[10pt] E(\gamma) = \gamma^\top \left(\Phi + \Delta t\, D^\top u\right) + \frac{\Delta t}{2}\,\gamma^\top D^\top M^{-1} D\gamma + \frac{1}{2}\,\gamma^\top C\gamma - \Delta t \sum_i r_i\,G(\sigma_i). \end{gathered}$$

Here:

Symbol Meaning
$\gamma$ Contact multipliers: the force of each contact row along its normal.
$\Phi$ Current signed gap of every contact row.
$D$ Contact Jacobian: force and torque of each row on each cell.
$M$ Per-cell drag.
$u$ Velocity each cell has without contact: the flow, when flow drift is on.
$C$ Diagonal compliance of each row, the inverse of its contact stiffness.
$\Delta t$ Substep duration.
$r_i$ Nominal elongation rate of cell $i$: its growth rate times its length.
$\sigma = L\gamma$ Axial compressive load on each cell.
$G' = g$ $g$ is the growth load response, between 0 and 1 and non-increasing in $\sigma$.

The gradient $\nabla E(\gamma)$ is the predicted gap at the end of the substep,

$$\Huge \nabla E(\gamma) = \Phi + \Delta t\, D^\top\!\left(u + M^{-1} D\gamma\right) - \Delta t\, L^\top\!\left(r \odot g(L\gamma)\right) + C\gamma,$$

so the optimality conditions are exactly

$$\Huge \gamma \ge 0,\qquad \nabla E(\gamma) \ge 0,\qquad \gamma \perp \nabla E(\gamma).$$

In a full space the multipliers rise until growth stops.

  • Rows. Pair rows, including the two rows emitted for near-parallel rods, and one-sided rows for planes, spheres, boxes and cylinders. A box or cylinder that cells live inside contributes one row per face a cell end is near, so a cell end in a corner is held by every wall that meets there.
  • Drag. For a capsule of full length $L$: $\mathrm{drag} \cdot L$ in translation and the finite-radius rod inertias in rotation. A fixed cell has no mobility. Length is not a solved unknown.
  • Compliance. A contact is a unilateral spring solved implicitly: under force $\gamma$ it overlaps by $\gamma / k$. This keeps the problem well posed when a space holds more than it can, where rigid constraints have no solution. Walls use a larger stiffness than cells, a hundred times by default.
  • Growth law. Models keep setting each cell's nominal growth rate. The engine multiplies it by $g(\sigma)$: 1 (no response), $e^{-s\sigma}$ as in [3], or linear from 1 at a free load to 0 at a stall load as in [6]. Any non-increasing $g$ keeps $E$ convex.
  • Flow. With flow drift on, the velocity and Jeffery rotation the flow gives each cell enter as $u$, so contacts resist the flow pressing cells together.
  • Solver. BBPGD with the minimum-map residual, which reads as worst overlap. The iteration is shared by CPU, Metal and CUDA; each backend supplies the gap evaluation and reductions.
  • Re-detection. After the move, contacts that overlap beyond the tolerance are appended as new rows, linearized where they were found, and the solve repeats from the current multipliers. Rows are never rebuilt, as in [5].
  • Stepping. A step is divided so that no cell end elongates by more than a set fraction of its radius, and no cell is carried further than a quarter of a grid spacing, in one substep. A substep that fails is retried at half its length. Each substep starts from the previous substep's forces. Nothing is carried between steps, so a resumed run repeats an uninterrupted one.
  • Overlapped starts. Division and hand-placed cells can begin a step in overlap. A pair free to move recovers at most a set distance per substep; a pair that cannot move still meets the full spring force of its overlap.

What differs from the first plan: contacts have a stiffness rather than being rigid, walls have their own stiffness, flow is inside the solve, the wall projection and the least-squares relaxation are removed rather than kept as a fallback, and mu_a and gamma no longer exist.

Work plan

  1. CPU reference solver: energy, BBPGD, ReLCP loop, substepping, stress-coupled growth.
  2. Acceptance tests:
    • a closed 4×4×1.2 chamber fills to about one layer and holds, worst overlap at the tolerance;
    • a free colony with no stress sensitivity matches $R = R_0 e^{t/2}$ and pressure $\frac{R^2-r^2}{4}$ [3];
    • with sensitivity on, the pressure profile and expansion speed follow the continuum solution [3];
    • an open trap shows compression rising from the mouth toward the back [6];
    • two collinear daughters spanning a box buckle.
  3. Metal and CUDA implementations with the shared conformance fixtures. CUDA is held to compiling; running it needs hardware and does not block this issue.
  4. Migration: every example and tutorial uses the new solve, and the least-squares relaxation is removed along with everything that only served it. No compatibility with the removed solve is kept.

Correctness is the requirement here. Cost at scale and performance work, including starting each step's solve from the previous step's forces, are future tasks and not part of this issue.

Risks

  • Cost. The published hard models take small steps and about a thousand iterations per step. Contact stiffness is the lever between overlap and cost.
  • Overlapped starts are outside what the cited papers analyse.
  • Confined 3D monolayers. [3] and [4] are 2D; a chamber 1.5 diameters deep with a floor and ceiling is new ground.

References

  1. W. Yan, H. Zhang, M. J. Shelley, "Computing collision stress in assemblies of active spherocylinders: applications of a fast and generic geometric method", J. Chem. Phys. 150, 064109 (2019). https://arxiv.org/abs/1811.04736
  2. W. Yan, E. Corona, D. Malhotra, S. Veerapaneni, M. Shelley, "A scalable computational platform for particulate Stokes suspensions", J. Comput. Phys. 416, 109524 (2020). https://arxiv.org/abs/1909.06623
  3. S. Weady, B. Palmer, A. Lamson, T. Kim, R. Farhadifar, M. J. Shelley, "Mechanics and morphology of proliferating cell collectives with self-inhibiting growth", Phys. Rev. Lett. (2024). https://arxiv.org/abs/2405.10158
  4. M. Lerchner, "Proliferating Cell Collectives: A Comparison of Hard and Soft Collision Models", Technical University of Munich. https://home.cit.tum.de/~ler/html-data/bacteria/cell-collectives.pdf — code: https://github.com/manuellerchner/MicrobeGrowthSim-IDP
  5. B. Palmer, H. M. Aktulga, T. Gao, "ReLCP: Scalable Complementarity-Based Collision Resolution for Smooth Rigid Bodies" (2025). https://arxiv.org/abs/2506.14097
  6. J. J. Winkle, O. A. Igoshin, M. R. Bennett, K. Josić, W. Ott, "Modeling mechanical interactions in growing populations of rod-shaped bacteria", Phys. Biol. 14, 055001 (2017). https://arxiv.org/abs/1702.08091
  7. M. Doumic, S. Hecht, D. Peurichard, "A purely mechanical model with asymmetric features for early morphogenesis of rod-shaped bacteria micro-colony" (2020). https://arxiv.org/abs/2008.04532
  8. T. J. Rudge, P. J. Steiner, A. Phillips, J. Haseloff, "Computational Modeling of Synthetic Microbial Biofilms", ACS Synth. Biol. 1, 345–352 (2012). https://doi.org/10.1021/sb300031n
  9. CellModeller, CellModeller/Biophysics/BacterialModels/CLBacterium.py, dev branch. https://github.com/cellmodeller/CellModeller
  10. "Bacterial growth under confinement requires transcriptional adaptation to resist metabolite-induced turgor pressure build-up", bioRxiv (2024). https://www.biorxiv.org/content/10.1101/2024.09.20.614086
  11. "Mechanical compression of E. coli in a microfluidic device", Sci. Rep. 5, 11367 (2015). https://doi.org/10.1038/srep11367

Notes on sourcing: the supplementary material of [3] and the supporting information of [8] were not available when this was written; the discretization above follows the description in [4], and the CellModeller behaviour is read from its source [9].

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions