pc4thanos : Thanos vs. Avengers multicellular demonstrator

PhysiCell Thanos vs. Avengers demonstrator for multicellular simulation techniques

Launch Tool

You must login before you can run this tool.

Version 1.0 - published on 03 Feb 2020

doi:10.21981/9D06-8E76 cite this

Open source: license | download

View All Supporting Documents

    Thanos has acquired some infinity stones



Published on


Introduction: Battle for the Infinity Stones

This app demonstrates chemotactic migration, cell-cell contact interactions, and iterating across cells to apply a random event. It also explores the impact of varying the number and strength of different cells in a complex, stochastic adversarial system.

(Fictional) modeling scenario

In this scenario, Thanos (purple) seeks the 6 infinity stones, which will allow him to instantly wipe out 50% of all sentient life (green civilians and red Avengers) with the "snap."

The Avengers (red) have hidden the 6 stones amongst themselves (ones with gold centers). Thanos seeks and attacks Avengers, while Avengers seek and attack thanos. Thanos will also attack any civilians in his way.

Whenever Thanos kills an Avenger with an infinity stone, he acquires it. His center will glow with brighter shades of gold. Once he has acquired all 6 infinity stones, he will immediately initiate the "Thanos snap" that kills each living non-Thanos cell with 50% probability.

Model approach

We use agent-based models to simulate the individual players, who detect one another both by contact (in near proximity) and through diffusible factors (over larger distances). Thanos secretes a Thanos signal (θ) that diffuses outward with a fast enough decay rate to reasonably "track" with Thanos. Likewise, each Avenger secretes an Avenger signal (a) that diffuses outward with a fast enough decay rate to reasonably track with them.

Thanos tests for contact with other cells, and if so, engages them in battle by a custom function (more below). He attacks anything. Avengers test for contact and only attack Thanos. All cells have health (h) that is reduced during battles. In battles, both attackers and defenders create damage according to their health and strength. The damage is distributed to each according to their relative strength and used to reduce health. Cell agents die according to the regular background apoptosis and necrosis rates and deterministically when they are too damaged.

The Thanos "snap" is modeled by iterating through all cells and triggering death with 50% probability.

This demo model shows (1) chemical diffusion, (2) coordination by chemotaxis, (3) testing for contact, (4) more advanced cell-cell contact interactions (in "battle"), (5) iterating through all cells, (6) use of custom data, (7) manually triggering death, and (8) custom coloring functions.

Note that these techniques could be easily used in immunology models, and triggering death as done in this project is a good way to model radiation therapy (where the probability of death could for example be computed by a linear-quadratic model).

About the software

This model and cloud-hosted demo are part of a course on computational multicellular systems biology created and taught by Dr. Paul Macklin in the Department of Intelligent Systems Engineering at Indiana University. It is also part of the education and outreach for the IU Engineered nanoBIO Node and the NCI-funded cancer systems biology grant U01CA232137. The models are built using PhysiCell: a C++ framework for multicellular systems biology [1].

Chemical components:

All chemical signals move by chemical diffusion in the simulated environment, using BioFVM [2] to solve the reaction-diffusion equations. A key property is the diffusion length scale. Diffusion (with a diffusion coefficient D) helps spread a signal over large distances, while decay (and uptake) (with coefficient λ) eliminates the signal to slow its spread. These effects compete to determine the characteristic distance Lthat a chemical signal travels.

That length scale L is given by L = sqrt( D/λ ).

Choosing D and λ can help to tune the chemical communication distance in these models.

Thanos factor (θ):

This is released by the Thanos agent as a chemoattractant for Avenger cells. We use a Neumann (zero flux) boundary condition. We use a diffusion coefficient and decay rate to give a 100 μm length scale and a decay time scale on the order of 1 min.

Avenger factor (a):

This is released by all Avenger cells to act as a chemoattractant for Thanos. We use a Neumann (zero flux) boundary condition. We use a diffusion coefficient and decay rate to give a 100 μm length scale and a decay time scale on the order of 1 min.

Cell agents:

We use agent-based models to explore multicellular systems like this one. Each cell is modeled as a software agent with an independent state, and its own rules to change its behavior based on local environmental conditions and communication. We use PhysiCell as our modeling platform [1].

Key features in the agent-based models:

Birth and death:

Cells can proliferate (divide into two daughter cells of half size), with division rates regulated by cell rules. In our model, cells continuously work to grow towards a "target" mature volume.

Note that birth and death are stochastic events for each cell agent: if such a process occurs at rate r, then between now (t) and soon (t + Δt), the probability of the event occurring for that agent is rΔt.

Secretion and uptake:

Cells can secrete chemical factors, or they can remove them (i.e., consume or uptake). This can contribute to gradients in chemical factors, and it's a key method of communication between cells. Moreover, cells can "sample" the chemical state of their surrounding environment. Secreting is sending a signal. Uptaking and sampling is receiving a signal.

Biased migration:

Motile cells perform biased migration. After traveling for Tpersistence time (the mean persistence time), they choose a new migration direction dmigrate. Based on the environmental conditions, the cell chooses a directional bias (intended direction) dbias and a random unit vector r. The motile direction dmigrate is then determined by according to:

dmigrate = b dbias + (1-b) r.

Here, b is a bias parameter (between 0 and 1) that determines how strongly biased migration is towards dbias. If b =1, then migration is deterministic towards dbias. If b = 0, then migration is completely random (Brownian).

Once the migration direction is chosen, it is normalized, and multiplied by the cell's migration speed.


Cell agents can stick to one another within a prescribed interaction distance (some multiple of their radius), and they can exert a pushing force on neighbors. PhysiCell [1] uses potential functions to implement these simple mechanics. Notably, PhysiCell is an off-lattice model, meaning that cells can have variable sizes, and can move freely without grid artifacts.

They aren't required to move some prescribed number of spatial steps. They also can divide without checking for an open neighbor "site". Instead, they can divide and push their neighbors out of the way.

Cell-cell interactions (battles):

Each cell has a strength s, health h, and attack rate r. If cell i attacks cell j, then the rate of attack is determined by i, the total damage dealt is based upon the health and strength of each cell (attack and counter-attack), and the distribution of the damage is also based upon their relative strengths and healths

di = si hi

dj = sj hj

dij= di + dj

Then, each cell is damage proportionately according to the strength of its opponent:

ddthi =  -ridj/dijhi

ddthj =  -ridi/dijhj

In this simplified model, a cell dies (deterministically) if its health drops below a threshold hT.

Civilian cells (green)

Civilian cells are born and die at constant rates in this version of the model, and they migrate randomly (Brownian motion). If they are attacked by Thanos, their health decreases as described above.

Avenger cells (red)

Avenger cells do not divide or die in this simplified model, but they can be damaged or die in battle as described above. They choose their migration bias for chemotaxis according to

dbias = ∇θ.

Migrating Avenger cells continuously test for collision (contact) with other cells. If that cell is Thanos, they attack according to the battle model above.

At the start, 6 Avenger cells hold an infinity stone--these are denoted with . They are allowed different motility parameters than regular Avengers.

Thanos cell (purple)

Thanos does not divide or die in this simplified model, but he can be damaged or die in battle as described above. He chooses his migration bias for chemotaxis according to

dbias = ∇a.

Migrating Thanos continuously tests for collision (contact) with other cells and attacks according to the battle model above. Whenever Thanos defeats an Avenger carrying an infinity stone, that stone is transferred to Thanos, and his nucleus glows a brighter shade of . Once he has six stones, he immediately initiates the Thanos snap. (Look in the console to watch him brag that he is inevitable.)

Basic instructions

Modify the parameters in the "config basics" and "user params" tabs. Click the "run" button once ready.

To view the cell plots, click the "cell plots" tab, and slide the bar to advance through simulation frames. Note that as the simulation runs, the "max" field (maximum frame number) will increase, so you can view more simulation frames. Within the plots tab, you can alos overlay the diffusing signals.

Note that you can download full simulation data for further exploration in your tools of choice.

Powered by

This software is powered by PhysiCell [1-2], a powerful simulation tool that combines multi-substrate diffusive transport and off-lattice cell models. PhysiCell is BSD-licensed, and available at:

It is a C++, cross-platform code with minimal software dependencies. It has been tested and deployed in Linux, BSD, OSX, Windows, and other environments, using the standard g++ compiler. 

See http://PhysiCell.MathCancer.org.

The Jupyter-based GUI was auto-generated by xml2jupyter [3], a technique to create graphical user interfaces for command-line scientific applications.


[1] Ghaffarizadeh A, Heiland R, Friedman SH, Mumenthaler SM, Macklin P (2018) PhysiCell: An open source physics-based cell simulator for 3-D multicellular systems. PLoS Comput Biol 14(2): e1005991. https://dx.doi.org/10.1371/journal.pcbi.1005991

[2] Ghaffarizadeh A, Friedman SH, Macklin P (2016) BioFVM: an efficient, parallelized diffusive transport solver for 3-D biological simulations. Bioinformatics 32(8):1256-8. https://dx.doi.org/10.1093/bioinformatics/btv730

[3] Heiland R, Mishler D, Zhang T, Bower E, Macklin P (2019) Xml2jupyter: Mapping parameters between XML and Jupyter widgets. J Open Source Software 4(39):1408. https://dx.doi.org/10.21105/joss.01408  

[4] Ozik J, Collier N, Wozniak J, Macal C, Cockrell C, Friedman S, Ghaffarizadeh A, Heiland R, An G, Macklin P (2018). High-throughput cancer hypothesis testing with an integrated PhysiCell-EMEWS workflow. BMC Bioinformatics 19:483. https://dx.doi.org/10.1186/s12859-018-2510-x

[5] Ozik J, Collier N, Heiland R, An G, and Macklin P (2019). Learning-accelerated discovery of immune-tumor interactions. Molec. Syst. Design Eng. 4:747-60. https://dx.doi.org/10.1039/c9me00036d 

Cite this work

Researchers should cite this work as follows:

  • This tool is still in preparation for submission. For now, please cite: 

    Ghaffarizadeh A, Heiland R, Friedman SH, Mumenthaler SM, Macklin P (2018) PhysiCell: An open source physics-based cell simulator for 3-D multicellular systems. PLoS Comput Biol 14(2): e1005991. https://doi.org/10.1371/journal.pcbi.1005991

  • Paul Macklin (2020), "pc4thanos : Thanos vs. Avengers multicellular demonstrator," https://nanohub.org/resources/pc4thanos. (DOI: 10.21981/9D06-8E76).

    BibTex | EndNote