Save
Download PDF

ABSTRACT

There are many instances of collective behaviors in the natural world. For example, eukaryotic cells coordinate their motion to heal wounds; bacteria swarm during colony expansion; defects in alignment in growing bacterial populations lead to biofilm growth; and birds move within dynamic flocks. Although the details of how these groups behave vary across animals and species, they share the same qualitative feature: they exhibit collective behaviors that are not simple extensions of details associated with the motion of an individual. To learn more about these biological systems, we propose studying these systems through the lens of the foundational Vicsek model. Here, we present the process of building this computational model from scratch in a tutorial format that focuses on building the appropriate skills of an undergraduate student. In doing so, an undergraduate student should be able to work alongside this article, the corresponding tutorial, and the original manuscript of the Vicsek model to build their own model. We conclude by summarizing some of the current work involving computational modeling of flocking with Vicsek-type models.

Keywords: collective behavior; flocking; Vicsek model; computational physics

I. INTRODUCTION

The biological world is full of fascinating collective behaviors across an enormous range of length scales. At the nanometer-micrometer length scale, cytoskeletal proteins organize and exhibit long-range order while coordinating motion leading to cell division (1). In vitro mixtures of cytoskeletal proteins also develop fascinating long-range patterns (24).

Ordering and collective motion also occur within expanding bacterial colonies on agar plates (5, 6). Group motion of bacteria within bacterial suspensions is capable of affecting mechanical properties, such as the viscosity of a fluid (7). Furthermore, bacterial motility is coupled to biofilm growth (8, 9).

Eukaryotic cells coordinate with their neighbors in both their motion and the forces they generate when closing wounds (1012). Within epithelial sheets, cells exhibit interesting and complex patterns of motion while maintaining a mechanically robust cell layer (1315). Although those coordinate behaviors contribute positively to human health, coordinated behavior in the form of cancer metastasis does not (16, 17).

Collective behaviors reach significantly larger length scales as well. Most notably, collective behaviors are observed in the flocking of birds and the schooling of fish. Order and complex dynamics of humans within dense crowds (18) and animals within migrating mammal herds (19) are also observed.

The emergence of group motion from individual motion, which is present from micrometer length scales to hundreds of meters, is common to the biological world. Although the specific details associated with collective motion likely differ at different length scales, a comprehensive understanding of these behaviors would be helpful in defining the effective interactions between individuals that lead to these interesting behaviors.

The Vicsek model (20), proposed in 1995, is a simplified computational model that captures the emergence of collective behavior. In this model, objects move through space and tend to orient themselves with their neighbors. Thus, the details of the interaction between individuals change as an object accumulates more neighbors—a hallmark of an emergent system. The Vicsek model is a valuable tool to study collective behaviors at any length scale because it makes no assumptions about the origin of the interaction between individuals.

The utility of this model is also to help identify new characteristics of collective behavior. For example, short-range interactions between individuals that lead to network-level coordination must transfer information. As such, the Vicsek model is a tangible method to study information flow (21, 22). Additionally, comparisons between group-level properties in the model and experimental systems can elucidate the true interactions that likely deviate from the simplified Vicsek interaction (23, 24).

The Vicsek model also predicts a phase transition from a disordered state (individuals acting independently) to an ordered state (collective behavior). Most phase transitions that students learn about in a typical undergraduate curriculum are thermodynamic in origin, such as crossing of solid/liquid or liquid/gas phase boundaries by changing the temperature or pressure of water. However, this example is a different type of transition—a kinetic phase transition.

In this manuscript, we present a worked-through tutorial for building the Vicsek model from scratch. This example is the product of a research project in the lab of A. Pasha Tabatabai (APT), where APT led undergraduate physics majors, coauthors MacQuarrie Thomson (MT) and Reece Keller (RK), to build their own active particle simulations, which included the Vicsek model. A unique feature of this tutorial is that MT and RK played an integral role in identifying particular skills that they needed to learn to build their models independently (i.e., skills that may not be reinforced in a standard undergraduate curriculum). In response, we highlight and provide support in these areas by generating specific problems within the tutorial that address these skills. It is our hope that the discrete nature of the questions within this tutorial with clear actionable items makes it accessible to all students regardless of their background in computational physics or collective motion. Additionally, we provide detailed discussion in other sections for the topics of periodic boundary conditions (IV.B.3), troubleshooting as a skill (IV.B.4), and defining steady state (IV.B.5). A conservative estimate is that this tutorial can be completed within an academic quarter or semester.

We conclude the manuscript with a discussion of some current work with flocking models and how an undergraduate reader would implement these alterations to perform novel research in emergent behaviors.

II. PEDAGOGICAL BACKGROUND

The Vicsek model is a valuable pedagogical tool for many reasons.

  • (a) An interdisciplinary approach to science encourages students to build a well-rounded skill set making them better prepared for scientific careers. Although the basic Vicsek model obscures biologically relevant details in the interactions between objects, it is possible to adapt this model to better reflect true biological systems.

  • (b) This model provides an approachable strategy to connect an extremely complicated observation in the real world (i.e., flocking) with basic mathematical and physical rules. This model is computationally simpler and easier to integrate than other active simulations where a true equation-of-motion with interparticle interactions is required (25, 26).

  • (c) This model provides an example of a phase transition. It would be beneficial for students to see this model after taking a chemistry or thermodynamics course. In this way, comparisons can be made to a thermodynamic phase diagram. Within a physics course, this could be compared with the phase transition in the ferromagnetic two-dimensional (2D) Ising model. Introducing the Vicsek model (a non-thermodynamic phase transition) provides an opportunity to explore the transition through simulation. Implementing this within a noncomputational course could be accomplished by providing code to students and encouraging them to change variables.

  • (d) Computational skills are increasingly important for students interested in a career in science. Little computational background is needed to build this model, particularly with the assistance of the tutorial. As such, exploring the Vicsek model can be implemented as part of a thermodynamics course, statistical physics course, or a biological physics course to learn new physics. Alternatively, this example could be implemented as a module within a computational physics course to emphasize computational skills in the context of a physics problem. Depending on the course goal, students can be provided with sections of prebuilt code.

  • (e) The ability to troubleshoot issues in research is a skill that translates across all disciplines and careers. In this manuscript and associated tutorial, we discuss troubleshooting strategies and break down the problem into small components that build on each other. Providing pre-built code to students, as mentioned above, may limit the troubleshooting growth of students.

Often times students learning challenges are defined by the instructor, which may or may not be aligned with actual student challenges. As such, MT and RK identified skills that they needed to learn to implement a computational model. We hope that this style of tutorial is helpful for future undergraduate students to work independently through the manuscript.

Other pedagogical tools based on the Vicsek model exist. For example, the authors are aware of a video describing the original paper (20) in detail (27), as well as fully worked example code accompanied by blog-style commentary (28). Although resources like these are helpful, we believe that students will more deeply understand the Vicsek model by building their own code from scratch as opposed to referencing the prebuilt code of others.

III. MATERIALS

Although it is possible to write these simulations in any computer language, we chose to write in Python 3 because it is free, open source, and taught in the introductory computer science course at our institution. We downloaded the Anaconda distribution and worked within a Jupyter notebook.

We provide a tutorial in the Supplemental Material that describes building the Vicsek model from scratch by using questions that develop and test the model step-by-step. We provide solutions to each question so that students can be sure that they are moving in the right direction at each step.

IV. RESULTS

A. The Vicsek model

In the canonical Vicsek model, the time-varying position of each individual ri(t) evolves discretely as ri(t+Δt)=ri(t)+vi(t)Δt where Δt is the time step between measurements. The convention is to set Δt = 1. The velocity of each individual vi(t) is assumed to be of constant magnitude v and pointed in the direction θi(t) (Fig 1).

This orientation also evolves θi(t+Δt)=θ(t)r+Δθ where θ(t)r is the average position of all orientations within some radius r0 of an individual at time t (Fig 2). This average is calculated as arctan[sin(θ(t))r/cos(θ(t))r] and includes the orientation of the individual itself. The average in Eq. 3 may seem unnecessarily complex. As an example, consider two objects each with angle θ1 = π/4 and θ2 = 7π/4. If θ = 0 is considered to be pointed to the right, the average orientation of these two objects should be to the right. However, calculating the geometric mean of these angles gives (θ1 + θ2)/2 = π. By taking the average from Eq. 3, we correctly calculate the circular average θ = 0.

Fig 1Fig 1Fig 1
Fig 1 Schematic of a single object's position at time t and t + Δt. The object travels a distance vΔt before the orientation is reevaluated. The difference between the orientation at t + Δt and the dashed line is the Δθ.

Citation: The Biophysicist 4, 1; 10.35459/tbp.2022.000227

Fig 2Fig 2Fig 2
Fig 2 Schematic of interaction range between objects. The object within the center of the left (red) circle has an interaction radius r0 which includes the leftmost object. The orientation of this object will be affected by the orientation of the other object within the interaction range. The object within the rightmost (blue) circle does not have any neighbors within its interaction radius. As a consequence, the object in this snapshot has an orientation that is unaffected by the other objects.

Citation: The Biophysicist 4, 1; 10.35459/tbp.2022.000227

The angular noise Δθ varies for each object at each time step and is chosen from a uniformly distributed random angle within the interval [–η/2, η/2]. Therefore, η sets the possible values of the random noise Δθ. The effect of this angular noise is to add some uncertainty in the trajectory of a given particle, and its effects can be seen by looking at an isolated particle where θ(t)r becomes θi(t) (Fig 3).

Fig 3Fig 3Fig 3
Fig 3 The position of a single particle moving with constant speed v = 1 in a box of length L = 10 superimposed over four instances in time each separated by Δt = 1. Lighter shades represent object position further in the past. η = 3.

Citation: The Biophysicist 4, 1; 10.35459/tbp.2022.000227

In a system with many objects, the term θ(t)r in Equation 2 acts to align neighboring objects, whereas Δθ acts to randomize orientations. When η is small, the ordering effect dominates, and long-range order is present (Fig 4).

Fig 4Fig 4Fig 4
Fig 4 Snapshot of N = 200 objects in a box of length L = 10 interacting with radius r0 = 1 after t = 250. Noise is set to η = 0.1 and Δt = 1. Color coding of arrows represents object orientation. Objects were initialized with random positions and orientations.

Citation: The Biophysicist 4, 1; 10.35459/tbp.2022.000227

The overall extent of collective behavior is calculated by measuring the order parameter va=1Nv|iNvi| This order parameter measures the extent to which all objects have velocities in the same directions. For example, if all objects are moving in the same direction, va → 1, whereas many noninteracting, randomly oriented objects lead to va → 0. The order parameter va can be calculated at every instance in time and therefore evolves until the system reaches “steady state” (section IV.B.5); the steady state values of va are quoted in Figure 5.

Fig 5Fig 5Fig 5
Fig 5 Steady state order parameter va as a function of η for L = 5 (black), L = 15 (red), and L = 25 (blue) at a density of ρ = 8 with r0 = 1 and Δt = 1.

Citation: The Biophysicist 4, 1; 10.35459/tbp.2022.000227

Thus we see that by incorporating these rules, we capture an essential result of the Vicsek model: that the noise η controls a dynamic first-order phase transition from ordered flocking (high va) to disorder (va → 0), even when the number of objects per unit area (i.e., the density) is kept constant (Fig 5).

When fully describing a phase transition, it is common to determine exactly how an order parameter changes at this transition point. In the case of the Vicsek model, a noise level ηc separates the regime of collective motion from the disordered regime. In fact, this noise value is also a function of system size ηc(L), as seen in Figure 5. In the original publication, Vicsek et al. (20) treated this transition as continuous (i.e., a second-order phase transition like the 2D Ising model). However, later works with larger systems argue that the canonical Vicsek model is a discontinuous (i.e., a first-order) phase transition (29) and the transition occurs at a noise level that is also a function of system density ηc(ρ) (30).

One reason that the Vicsek model is interesting to study is that the long-range order associated with large values of the order parameter va are not possible in 2D for equilibrium systems. The Mermin–Wagner theorem states that a system with short-range interactions at thermal equilibrium cannot lead to a long-range order (31, 32). In the Vicsek model, the interactions are short range (r0L), yet the steady state is capable of achieving long-range order (va ∼ 1) because self propulsion (v ≠ 0) is a nonequilibrium feature. An exercise in the tutorial demonstrates that measurements of va for systems with and without swimming are very different despite all other parameters being the same.

B. Skills and concepts

1. Python familiarity

Computational abilities vary widely across an undergraduate cohort partially because computational courses are introduced at different points in the undergraduate curriculum, and different departments have different major requirements for computational courses. As such, many of the challenges in developing this model are rooted in the learning curve associated with Python.

The tutorial assumes students know the following Python skills before starting the tutorial:

  • (a) How to download and install the Anaconda distribution (www.anaconda.com) of Python 3 and work within a Python environment. We recommend Spyder or Jupyter notebooks.

  • (b) How to import libraries such as matplotlib and NumPy.

  • (c) How to use PyPlot from matplotlib to display and save plots.

  • (d) How to write a function.

Students who are unfamiliar with these items can find myriad online resources to help them prepare for this tutorial.

2. Python usage

The tutorial is designed to approach particular computational problems step-by-step. The tutorial covers the following computational topics in the context of problem solving:

  • (a) Importing and using built-in Python functions.

  • (b) Random number generators.

  • (c) Using loops and if statements.

  • (d) Generating and displaying images and plots.

  • (e) Calling multiple functions and using return statements within functions.

3. Periodic boundary conditions

The use of periodic boundary conditions in computational simulations is common. When simulating something, you want to avoid the effects of a boundary. If a boundary exists, you have to consider new rules for interaction with that boundary. In fact, what you really want is an infinitely large simulation so that the effects of these boundaries are minimal, but that would require infinite computing resources (and take infinitely long to run).

We use periodic boundary conditions such that objects leaving the bounding area reappear on the opposite side of the simulation area. As such, objects simply pass through the boundary and do not interact. Implementing periodic boundary conditions is an explicit step in the tutorial.

4. Troubleshooting

A primary challenge in building these models, and research in general, is finding troubleshooting methods for suspected errors. Within the typical structure of an undergraduate physics course, students tend to determine whether their solutions to problems are correct on the basis of a comparison with a known solution (either given or from a peer). However, in research scenarios, a known solution may not exist. As such, students must find ways to convince themselves and their advisor that their results are correct, determine how to correct their results, or both.

This process deviates significantly from the learning process within a traditional physics course. In these courses, students tend to submit assignments and receive a grade—end of transaction. However research is iterative, and progress relies on reflecting on the work done and implementing improvements.

As a consequence of this difference between research and coursework, troubleshooting is not an explicit skill learned in courses. Undergraduate research is important for this reason. We emphasize here that troubleshooting is an active part of the research process. Typical methods used to confirm that the model is implemented correctly (e.g., visual checks, building toy models, and taking limits of results) are demonstrated in the tutorial.

5. Steady state

In a typical simulation, particles are distributed in a region of space with random positions and orientations. The system is allowed to evolve, and in this evolution process the positions and orientations may become more correlated across objects depending on the experimental conditions. The goal is to determine the effect of parameters on the ultimate behavior of the system that is independent of the initial conditions and configuration.

As such, we separate the behavior of our system into two regimes: the “transient” and the “steady state.” In the steady state behavior, fluctuations in a measured quantity such as the order parameter occur, but the mean value is constant. In the preceding transient regime, a measured order parameter fluctuations and the mean are changing in a way that depended on the initial configuration. Here, we only make measurements in steady state. A strategy to determine whether the simulation has reached the steady state regime is to compare averages of the order parameter over different time windows. If the average is unchanged, then each time window is in steady state. Note that reaching steady state is not necessarily the same as reaching thermodynamic equilibrium.

V. A PERSPECTIVE ON CURRENT VICSEK MODEL USE

Although the simplicity of the Vicsek model is sufficient to capture this order–disorder transition, the model is still being adapted in current research. We highlight a few recent works.

The primary assumption in the standard Vicsek model is that objects interact with all other objects within a given radius. However, the visual information collected by a bird, for example, is not isotropic (i.e., the bird cannot see behind itself). To this end, nonisotropic interactions with limited fields of view, as shown in Figure 6, have recently been integrated into the Vicsek model (3335).

Fig 6Fig 6Fig 6
Fig 6 Schematic of nonisotropic interaction between objects. The primary object is shown to have an interaction that is limited to a range of π/2. Only the red arrow is within the interaction range of this object.

Citation: The Biophysicist 4, 1; 10.35459/tbp.2022.000227

It is important to consider that true interactions between animals may not be governed by metric interactions (i.e., how far the animals are apart). For example, starlings in a flock have been shown to interact topologically (individuals interact with some number of nearest neighbors, regardless of distance) (23), and fish in a school use line-of-sight interactions (24).

Another principle assumption of the standard Vicsek model is that objects move with a constant speed at all times. This model has been adapted to better mimic the variability of fish speed, which has been determined to depend on the local alignment of neighbors (36).

Additionally, most real systems exist in three dimensions, whereas this manuscript and the tutorial are explicitly done for the 2D Vicsek model. This can be extended to three dimensions.

Furthermore, self-propelled particle models such as the Vicsek model are used as a reference to other active models like the vertex model when investigating the order–disorder transition (37).

VI. DISCUSSION AND CONCLUSION

We have motivated the reasons to study the Vicsek model in the undergraduate curriculum both from the perspective of a student researcher and as an educator. We have defined the details of the Vicsek model and implemented this model to show a canonical result—a kinetic phase transition between order and disorder that stems from local interactions between active objects. We provide discussion about concepts that are necessary to build this model that may be new intellectual territory for undergraduate students, and we accompany a tutorial to help students build the model step-by-step. Finally, we have discussed a few ways in which current researchers are adapting the Vicsek model for their own research.

It is our hope that undergraduate students feel comfortable approaching this model and that our provided resources, in addition to the original manuscript (20), are sufficient to assist in an undergraduate student building their own model from scratch.

  • Download PDF
Copyright: © 2023 Biophysical Society.