An atooms backend for simulating active matter
Project description
active
active is a simulation backend for atooms, a high-level framework for particle-based simulations. This backend implements active matter systems, e.g. the Vicsek model as described in Vicsek et al. (1995) and in Grégoire and Chaté (2004).
Quick start
Here we have a simulation of an active matter system based on the Vicsek model. First of all, we need to setup a 2D atooms system.
import numpy
import atooms
from atooms.system import System
n = 200
dim = 2
system = System(N = n)
system.cell = [32. for i in range(dim)]
for p in system.particle:
p.orientation = numpy.random.uniform(-numpy.pi,numpy.pi)
p.position = [L*numpy.random.uniform() for i in range(dim)]
p.fold(system.cell)
Having done so, we can run a simple Vicsek model simulation as follows. We need to provide the system size n, its noise amplitude eta, velocity v0, and density rho.
from atooms.active.vicsek import Vicsek
from atooms.active.neighbors import VicsekNeighbors
from atooms.simulation import Simulation
eta = 0.4
v0 = 0.5
rho = 0.5
backend = Vicsek(system, eta, v0, noise='vectorial')
neighbors = VicsekNeighbors(system, method='kdtree')
bck.neighbors = neighbors
Simulation(backend).run(10)
This simulation employs the so-called 'vectorial' noise implementation (discussed in Grégoire and Chaté) and the scipy-based kD-tree neighbor search algorithm.
A basic API is also available. We can run the same simulation as follows
from atooms.active.api import vm
vm('input.xyz', file_out='output.xyz', npart=2048, eta=0.4, rho=2.0, nsteps=1000, config_number=10)
or, from the command line
api.py input.xyz --file-out output.xyz --npart 2048 --eta 0.4 --rho 2.0 --nsteps 1000 --config-number 10
Features
- Seamless integration with atooms framework
- Various nearest neighbors algorithms available
- Easy extension to new variations of the Vicsek model
- Support for user-provided code
Dependencies
- gfortran 11.3.0
- python 3.10
- argh 0.28.1
- atooms 3.17.0
- f2py-jit 0.9.2
- numpy
- scipy (optional)
Documentation
Check out the tutorial for more detailed examples and the public API for more detail.
Installation
From the Python Package Index
pip install atooms.active[full]
to get all optional dependencies (i.e. scipy
). A lightweight installation can be performed as well
pip install atooms.active
From the code repository
git clone https://framagit.org/atooms/active.git
cd active
make install
Authors
Iacopo Ricci: https://iricci.frama.io/
Huge thanks to Prof. Daniele Coslovich for his careful supervision and for his profound insights.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for atooms.active-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9a5344dda5c50f060a6c4caf5551ae516335b90954753d54f0853f4b01c6940 |
|
MD5 | b9d69ac3998d612a96c654526a1e5a6f |
|
BLAKE2b-256 | 411f2c77c60edb040841c3deb364aee4382df3b936e854585f9b6ec61e06b189 |