PhysiCell and PhysiBoSS¶
engine: physicell runs PhysiCell 1.14.2 projects: natively as they are (tier T0), or ABM-IR models
exported onto PhysiCell’s template project (tier T1). PhysiBoSS projects (MaBoSS intracellular models)
build and run the same way. ABMfact writes PhysiCell’s settings XML itself and does not depend on any
settings library.
Building PhysiCell¶
PhysiCell needs a GNU g++ with OpenMP. The engine tries, in order:
native:
PHYSICELL_CPP, theng++-15down tog++-11, theng++, using the first that is GNU (not Apple clang) and compiles-fopenmp. The PhysiCell sources come from the project itself (a full PhysiCell tree) or fromPHYSICELL_SOURCE.docker: the image built from
containers/physicell/Dockerfile, pinned to PhysiCell 1.14.2 and to a Debian base image digest:docker build -t abmfact/physicell:1.14.2 "https://github.com/a7med7emedan/ABMfact.git#v0.2.0:containers/physicell"
Docker fetches the folder from GitHub at the release tag, so no checkout is needed. In a checkout,
containers/physicellin place of the URL builds the same image.
abmfact engines says which route is available and, if none is, what is missing. A project is built
once per hash of its sources and the toolchain, under ~/.cache/abmfact/physicell (change it with the
cache_dir option). The template’s -march=native -mfpmath=both -m64 flags do not compile on 64-bit
ARM, so builds use portable flags; with that change PhysiCell builds and runs natively under arm64
Docker on Apple silicon, without emulation.
Native runs (tier T0)¶
A project is the folder make <sample> populates: main.cpp, Makefile, custom_modules/ and
config/. For each run the engine copies config/ into a work directory and edits only what a run
controls:
Setting |
Element (PhysiCell 1.14.2) |
|---|---|
seed |
|
time steps |
|
voxel size |
|
threads |
|
output |
|
parameters |
any element path, or |
abmfact run-model path/to/project --engine physicell --out results/run \
--params '{"overall/max_time": 1440}' --option threads=1
Outputs are read into the common schema with pcdl
when pip install "abmfact[physicell]" is installed, and with a small SciPy reader of the MultiCellDS
XML and MATLAB files otherwise; the two agree exactly on real PhysiCell output kept as a test fixture.
Native observables default to cells, live, dead, live_<type> and <substrate>_mean, or pass
ABM-IR observable specs with the observables option.
PhysiCell honours dt_scale, dx_scale and, through seed remapping, rng_streams. It is not a torus
and has no activation-order switch, so the grid, update-order and agent-order checks are NOT_TESTABLE.
With more than one OpenMP thread, PhysiCell is not deterministic for a fixed seed; run audits with
threads=1 to separate that from the model.
A PhysiCell behaviour to know. PhysiCell advances in diffusion steps and runs mechanics at most once
per diffusion step, and Cell::update_position fixes its time step from its first call. When
dt_diffusion exceeds dt_mechanics, every cell therefore moves too slowly: in the chemotaxis example
with dt_diffusion = 1 and dt_mechanics = 0.1, ten times too slowly. Native runs with that ordering
carry a warning in their run record, and export lowers dt_diffusion to dt_mechanics and says so.
BioFVM’s diffusion solver splits each step by axis and is far from converged when dt_diffusion·D/dx² is
large. In the Gate 3 spheroid (D 10⁵ micron²/min, dx 20 micron, dt_diffusion 0.1 minute, so 25), a field
with no cells settled at 33.0 at its centre, where the converged value is 36.4, and six times as many
spheroid cells died as in the reference. Export therefore lowers dt_diffusion to a whole fraction of
dt_mechanics that keeps dt_diffusion·D/dx² at or below 0.25 for the fastest field, and reports it.
This includes PhysiCell’s usual oxygen setting (0.01 minute at 20 micron, 2.5), which still left a
consuming cell’s voxel about 4 below the converged value. Native runs keep their own step.
Translation (tier T1)¶
abmfact import physicell path/to/project -o model.yaml # also writes model.fidelity.md and .json
abmfact export model.yaml --to physicell -o exported/ # onto PhysiCell's template project
abmfact run-model model.yaml --engine physicell --out results/t1
Import reads the settings XML, the rules CSV (CBHG version 3) and the cells CSV. Export writes them onto
PhysiCell’s own template project, bundled with ABMfact under PhysiCell’s BSD 3-Clause licence, or onto a
project given with --base. Running an ABM-IR file in the PhysiCell engine exports it first, once per
model hash.
ABM-IR |
PhysiCell |
Import |
Export |
|---|---|---|---|
space |
|
exact (walled) |
exact; periodic becomes walled (approximated) |
substrates |
|
exact, including per-side Dirichlet values |
exact |
cycle |
|
exact; fixed-duration phases approximated |
exact; custom becomes live (approximated) |
death |
apoptosis and necrosis models |
rates and durations; volume changes dropped (approximated) |
exact; volume changes use PhysiCell’s defaults |
volume |
|
total kept; growth dynamics dropped (approximated) |
total set (approximated) |
mechanics |
adhesion, repulsion, adhesion distance, affinities |
exact |
exact |
motility |
speed, persistence, bias, chemotaxis |
exact; advanced chemotaxis dropped |
exact |
secretion |
per-substrate rates and targets |
exact |
exact |
interactions |
attack (rate, damage rate, duration), phagocytosis, fusion, transformations |
exact; distinct dead-phagocytosis rates approximated |
exact; immunogenicity other than 1 dropped, since the 1.14.2 settings file has none |
integrity |
|
exact |
exact |
rules |
|
exact; rules naming unknown things dropped |
exact |
initial cells |
|
positions and types; extra columns dropped (approximated) |
random placements drawn once with seed 0 (approximated) |
intracellular |
|
files and settings; mappings carried as settings (approximated) |
MaBoSS files and settings (approximated); SBML dropped |
events |
none |
dropped: PhysiCell has no timed events without custom code |
|
time steps |
|
exact |
exact; |
custom C++ |
|
native extension, never translated |
the base project’s code |
The translation is structural, not a proof of equivalence: the reference engine and PhysiCell move cells up the chemotaxis gradient at a similar speed, but docking the two engines within stated tolerances is milestone 3.
Tests¶
Unit tests use configuration files and output copied from PhysiCell 1.14.2 and need no compiler. Tests
marked physicell build and run the template project and the exported chemotaxis model; they are
skipped, with the reason, where neither a compiler nor the Docker image is available.