Cellular Potts Model
CPM simulation, built in MATLAB.
Overview
The Cellular Potts Model (CPM) is a lattice-based model for simulating the dynamics of interacting cells. Originally developed to study cell sorting, the model assigns each site on an $N \times N$ grid to a cell type, and evolves the system through a sequence of Monte Carlo steps in which proposed site updates are accepted or rejected according to a Boltzmann probability dependent on the change in energy. The energy of the system is governed by a Hamiltonian encoding two competing effects: differential adhesion, which drives cells of the same type to cluster together, and a volume constraint, which penalises deviations from a prescribed target volume. This project investigates the qualitative cell-sorting behaviour produced by the CPM and examines how varying the parameters of the Hamiltonian affects pattern formation.
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi, 500)
plt.plot(x, np.sin(x))
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.title('Sine wave')
plt.show()
Method
The Hamiltonian
$$ H = \sum_{\text{neighbours}} J\!\left(\sigma_{(i,j)}, \sigma_{(i',j')}\right) \left(1-\delta_{\sigma_{(i,j)},\sigma_{(i',j')}}\right) + \lambda_v \sum_{\sigma=1}^{n} \left( v(\sigma) - V_T(\sigma) \right)^2 . $$Results
Implementation
The entire script can be found on the linked Github. Below is a snippet of the main loop
The cobweb loop:
let x0 = 0.1;
let y0 = 0;
for (let i = 0; i < n_iters; i++) {
let fx = r * x0 * (1 - x0);
line(cx(x0), cy(y0), cx(x0), cy(fx));
line(cx(x0), cy(fx), cx(fx), cy(fx));
y0 = fx;
x0 = fx;
}