The Viscek model is a system of N self-propelled particles moving in 2D space. The particles align their velocities with those of their neighbors within a certain radius of influence. The model exhibits collective behavior such as swarming and phase transitions as the density of particles and the radius of influence are varied. This implementation allows the user to simulate the Viscek model [1] and output a .gif
animation of the particles' motion over time.
To run the simulation, you will need to have the following dependencies installed:
- numpy
- pandas
- matplotlib
- imageio
- tqdm
You can install the latest versions of the dependencies using the following command:
pip install numpy pandas matplotlib imageio tqdm
The output of the simulation is a .gif animation of the particles' motion over time. The animation will be saved as animation.gif
in the working directory.
To run the simulation, follow these steps:
- Adjust the simulation parameters in the
parameters.py
file. - Run the
MainProgram.py
script. - The output animation will be saved as
animation.gif
in the working directory.
You can adjust the following parameters in the parameters.py
file:
N
: number of particlesL
: size of simulation domainPspeed
: self-propulsion speed of particleseta
: noise parameterrad_influence
: radius of interactionTstart
: start time of simulationTend
: end time of simulationdeltat
: time stepbcond
: boundary condition ('periodic' or 'reflective')
Run the simulation using this command:
python MainProgram.py
Example animation generated by this implementation for high noise (chaotic motion) and low noise (organized motion):
- [1] Vicsek, T., Czirók, A., Ben-Jacob, E., Cohen, I., I., & Shochet, O. (1995). Novel type of phase transition in a system of self-driven particles. Physical Review Letters, 75(6), 1226–1229. doi:10.1103/PhysRevLett.75.1226
- [2] Kulkarni, A., Thampi, S. P., & Panchagnula, M. V. (2019). Sparse game changers restore collective motion in panicked human crowds. Physical Review Letters, 122(4), 048002. doi:10.1103/PhysRevLett.122.048002
This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 3 - see the LICENSE file for details.