# Non-local interactions in collective motion

## Citation

King, Arthur; Turner, Matthew (2021), Non-local interactions in collective motion, Dryad, Dataset, https://doi.org/10.5061/dryad.f4qrfj6vb

## Abstract

The collective motion of animal groups often exhibits velocity-velocity correlations between nearest neighbours, with the strongest velocity correlations observed at the shortest inter-animal spacings. This may have been a motivational factor in the development of models based primarily on short-ranged interactions. Here we ask whether such observations necessarily mean that the interactions are short-ranged. We develop a minimal model of collective motion capable of supporting interactions of arbitrary range and show that it represents a counter-example: the strongest velocity correlations emerge at the shortest distances, even when the interactions are explicitly non-local.

## Methods

The data has been generated from simulations of the Adjustable Range Model, https://doi.org/10.5281/zenodo.4429251. This model is a 2d agent based model of collective motion (swarming).

## Usage Notes

Data

#######################################################################################################

There are 4 different types of data file. Each is a txt file.

-1. sums: the sum of the dot product of velocity fluctuations in each bin. Representing the numerator of the correlation function fraction.

-2. counts: the counts of each bin. In other words the number of pairs of agents with a particular separation.

-3. sqSums: the sum of the square of the dot product of velocity fluctuations (in each bin). This is saved to allow calculation of the error in the correlation function.

-4. sumvUdotvU: the sum (over all the agents) of the dot product of velocity fluctuations of each agent with themselves. This is a single float. This is saved in order to calculate a normalisation constant. (Note: this is done because in our definition of the correlation function we exclude self-correlations).

Data was collected from each simulations with total runtime T=110000. For a given simulation data was saved every 10000 timestep and labelled with a 'run number' for example: run 1. So for each simulation there are 10 'runs' (there are not 11 because the first 10000 timesteps are thrown away to allow for burn in).

Folder structure

#######################################################################################################

Data files are organised in folders referring to each figure in the paper. The structure is required for the plotting code to work!

Code

#######################################################################################################

Requirements: python3,

Python libraries: numpy, matplotlib, re, pathlib

loadData.py - this script goes through the folder structure and loads the text files into numpy arrays. For each run the correlation function is calculated. In addition the average correlation function across all runs is calculated. The error is also calculated. This script can plot the raw correlation functions for each run. The output from this script is a numpy array of the correlation function and error, as well as a class object containing the parameter values used to generate the data.

plotMultipleCorrelations.py - used for plotting correlation curves for a fixed system size (N). This code generates fig 2.

plotCorrelationsAtVaryingN.py - used for plotting correlation curves at different system sizes. Used to generate fig 4 and fig 5.

plotCorrelationsAtDifferentNoises.py - used for plotting correlation curves at different noises. Used to generate fig 6.

## Funding

Engineering and Physical Sciences Research Council, Award: EP/L015374/1