Skip to main content

An atooms backend for simulating active matter

Project description

active

pypi version license pipeline coverage report

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atooms.active-1.0.4.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atooms.active-1.0.4-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file atooms.active-1.0.4.tar.gz.

File metadata

  • Download URL: atooms.active-1.0.4.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for atooms.active-1.0.4.tar.gz
Algorithm Hash digest
SHA256 f09e42ffb71915a63de64159fd7de1530ea13d991de6416a5c1e218ad5f8aa0f
MD5 2df5c1488f7c8c3ca5f8901a638bb7e3
BLAKE2b-256 75f81ca1313e5d571b0f9d28a383f47b9564ea77f7cfe4138b13de02145390f7

See more details on using hashes here.

File details

Details for the file atooms.active-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: atooms.active-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for atooms.active-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b9a5344dda5c50f060a6c4caf5551ae516335b90954753d54f0853f4b01c6940
MD5 b9d69ac3998d612a96c654526a1e5a6f
BLAKE2b-256 411f2c77c60edb040841c3deb364aee4382df3b936e854585f9b6ec61e06b189

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page