Run and Tumble


This example models a single cell that moves according to a Lévy walk: a random walk with occassional occurrence of long straight walks.

Modeling cell movements as a Lévy walk.

Model description

The model defines a CPM cell that has two properties:

  • A PropertyVector that gives the direction of movement and
  • a Property that defines the time when this direction of movement is changed.

The change in direction is using a VectorRule. In this case, it specifies a new random direction for each of the three $x$, $y$, $z$ coordinates separately: move_dir = sin(angle), cos(angle), 0 where angle = rand_uni(0, 2*pi).

This is calculated with an Event. Upon triggering, this sets the new direction and a waiting time until the next change of direction. To model a superdiffusive Lévy walk, this waiting time is chosen from an exponential distribution: change_time = time + 20 * rand_gamma(0.5, 5).

Finally, the cell is made to move in the chosen direction using DirectedMotion that takes the PropertyVector as input.


In Morpheus GUI: Examples 🠒 CPM 🠒 RunAndTumble.xml.

<?xml version='1.0' encoding='UTF-8'?>
<MorpheusModel version="4">
        <Details>Models a Levy walk - a random walk strategy that is superior for searching due to it's high spatial coverage.

Shows how to manipulate PropertyVectors (x,z,y) using the VectorRule. An expression for each of the three coordinates must be given, separated by a comma ",".</Details>
        <Constant symbol="tumble.run_duration" value="0"/>
        <Lattice class="hexagonal">
            <Size symbol="size" value="300 300 0"/>
                <Condition boundary="x" type="periodic"/>
                <Condition boundary="y" type="periodic"/>
        <SpaceSymbol symbol="space"/>
        <StartTime value="0"/>
        <StopTime value="10000"/>
        <TimeSymbol symbol="time"/>
        <CellType class="biological" name="amoeba">
            <VolumeConstraint target="200" strength="1"/>
            <PropertyVector symbol="move_dir" value="0.0, 0.0, 0.0"/>
            <Property symbol="tumble.run_duration" value="0.0" name="run duration"/>
            <Property symbol="tumble.last" value="0" name="last tumble event"/>
            <Function symbol="tumble.time_left" name="time left">
                <Expression>tumble.last + tumble.run_duration - time</Expression>
            <DirectedMotion direction="move_dir" strength="0.2"/>
            <Event trigger="when true" time-step="5">
                <Condition>time >= tumble.last + tumble.run_duration</Condition>
                <Rule symbol-ref="tumble.last">
                <Rule symbol-ref="tumble.run_duration" name="new update time">
                    <Expression>20 * rand_gamma(0.5, 5)</Expression>
                <Intermediate symbol="angle" value="rand_uni(0, 2*pi)"/>
                <VectorRule symbol-ref="move_dir" spherical="true">
                    <Expression>angle, 0 , 1</Expression>
        <CellType class="medium" name="medium"/>
            <Contact type1="amoeba" type2="medium" value="4"/>
        <MonteCarloSampler stepper="edgelist">
            <MCSDuration value="1"/>
            <MetropolisKinetics temperature="0.6"/>
        <ShapeSurface scaling="norm">
        <Population size="1" type="amoeba">
            <Cell id="1" name="1">
        <Gnuplotter time-step="200" decorate="false">
            <Terminal name="png"/>
                <Cells min="0.0">
                        <Color value="0" color="red"/>
                        <Color value="2" color="blue"/>
                <CellArrows orientation="5 * move_dir"/>
        <Logger time-step="20">
                <Symbol symbol-ref=""/>
                <Symbol symbol-ref=""/>
                <Plot time-step="5000">
                    <Style style="lines" line-width="2.0"/>
                    <Terminal terminal="png"/>
                        <Symbol symbol-ref=""/>
                        <Symbol symbol-ref=""/>
                        <Symbol symbol-ref="tumble.run_duration"/>