Agent-based Model

Persistent Identifier

Use this permanent link to cite or share this Morpheus model:

An agent-based model where each cell’s position and velocity is tracked


We expand our exploration of local and non-local models to the class of agent-based models.


Instead of tracking continuous distributions of cell density, neural activity, or other properties that vary continuously across space, we adopt a different kind of modeling approach by tracking the trajectories and behavior of individual cells.

For this, the mean squared displacement (MSD) of random walkers in 2D is calculated and plotted using a Mapper.


The cells spread out (left to right). Each cell's position and velocity is tracked along with their trajectories plotted in the right panel.
The cells spread out (left to right). Each cell’s position and velocity is tracked along with their trajectories plotted in the right panel.
Video of the simulation of ABMmodel.xml showing individual cells running and tumbling throughout the entire two-dimensional domain.


Get this model via:

  • Morpheus-Link or
  •  Download: ABMmodel.xml
  • XML Preview

    <?xml version='1.0' encoding='UTF-8'?>
    <MorpheusModel version="4">
            <Details>Full title:		Agent-based Model
    Authors:		L. Edelstein-Keshet
    Contributors:	Y. Xiao
    Date:		23.06.2022
    Software:		Morpheus (open-source). Download from
    Model ID:
    Reference:		L. Edelstein-Keshet: Mathematical Models in Cell Biology
    Comment:		Random walkers in 2D. A population of cells are started at the center of the domain. For each one, the following rules of motion are used: At fixed time increments, the walker changes its direction of motion. Its velocity vector is then recomputed as a vector with random x and y components. This simulation has some similarities to the RunAndTumble.xml example (Morpheus Model ID: M0025, A bias in the move direction can be introduced by setting BiasOnOff to 0 (off) or 1 (on). The mean squared displacement is computed and plotted. Thanks: Uses some aspects of the example RunAndTumble.xml and MSD calculation provided by Lutz Brusch.</Details>
            <Variable symbol="MSD" value="0.0"/>
            <Lattice class="hexagonal">
                <Size symbol="size" value="500, 500, 0"/>
                    <Condition type="periodic" boundary="x"/>
                    <Condition type="periodic" boundary="y"/>
            <SpaceSymbol symbol="space"/>
            <StartTime value="0"/>
            <StopTime value="10000"/>
            <TimeSymbol symbol="time"/>
            <CellType class="biological" name="Walker">
                <VolumeConstraint target="200" strength="1"/>
                <PropertyVector symbol="move_dir" value="0.0, 0.0, 0.0"/>
                <PropertyVector symbol="displacement" value="0.0, 0.0, 0.0"/>
                <PropertyVector symbol="velocity" value="0.0, 0.0, 0.0"/>
                <PropertyVector symbol="BiasDirection" name="spatial cue direction" value="0, 1.0, 0.0"/>
                <Property symbol="BiasOnOff" name="Turn cue on (1) or off (0)" value="0.0"/>
                <Property symbol="run_time" name="run duration" value="50.0"/>
                <Property symbol="last_turn_time" name="last random event" value="0"/>
                <DirectedMotion direction="20*move_dir+BiasDirection*BiasOnOff" strength="1"/>
                <Event trigger="when-true" time-step="5" name="Change direction">
                    <Condition>time >= last_turn_time+ run_time</Condition>
                    <Rule symbol-ref="last_turn_time" name="Time of last random event">
                    <VectorRule symbol-ref="move_dir" name="new direction of motion">
                        <Expression>rand_uni(-1,1), rand_uni(-1,1) , 1</Expression>
                <MotilityReporter time-step="1.0" name="Compute displacement and velocity">
                    <Displacement symbol-ref="displacement"/>
                    <Velocity symbol-ref="velocity"/>
                <Mapper name="Compute MSD">
                    <Input value="(displacement.abs)^2"/>
                    <Output symbol-ref="MSD" mapping="average"/>
            <CellType class="medium" name="medium"/>
                <Contact type1="Walker" type2="medium" value="4"/>
                <Contact type1="Walker" type2="Walker" value="10"/>
            <MonteCarloSampler stepper="edgelist">
                <MCSDuration value="1"/>
                <MetropolisKinetics temperature="0.6"/>
            <ShapeSurface scaling="norm">
            <Population type="Walker" size="1" name="Random Walker">
                <!--    <Disabled>
            <Cell id="1">
                <InitCircle number-of-cells="10" random_displacement="5.0" mode="random">
                    <Dimensions radius="30.0" center="250.0, 250.0, 0.0"/>
            <Gnuplotter time-step="200" decorate="false">
                <Terminal name="png"/>
                    <Cells value=""/>
                    <CellArrows orientation="20*velocity" center="midpoint" style="1"/>
            <Logger time-step="10">
                    <Symbol symbol-ref=""/>
                    <Symbol symbol-ref=""/>
                    <Plot time-step="-1">
                        <Style point-size="0.5" style="points"/>
                        <Terminal terminal="png"/>
                            <Symbol symbol-ref=""/>
                            <Symbol symbol-ref=""/>
                            <Symbol symbol-ref=""/>
                    <!--    <Disabled>
                <Style point-size="0.5" style="points"/>
                <Terminal terminal="png"/>
                    <Symbol symbol-ref="time"/>
                    <Symbol symbol-ref="MSD"/>
            <DisplacementTracker time-step="10" name="data" celltype="Walker"/>
            <ModelGraph format="svg" reduced="false" include-tags="#untagged"/>

    Model Graph
    Model Graph


    Files associated with this model: