Neighbour finders

NeighbourFinder

Interface for classes that set the neighbours of a given list of particles according to some criterium.

FixedNumberFinder

Define as neighbours of a particle the N particles that are closest to it.

CutoffFinder

Define as neighbours of a particle all those particles that are closer than the given cutoff and, optionally, satisfy further conditions set by a custom function.

SANNFinder

Use the SANN algorithm to detect neighbours.

class baggianalysis.core.NeighbourFinder(self: baggianalysis.core.NeighbourFinder)None

Bases: pybind11_builtins.pybind11_object

Interface for classes that set the neighbours of a given list of particles according to some criterium.

include_bonded_neighbours(self: baggianalysis.core.NeighbourFinder, include: bool)None
Parameters

include (bool) – True if bonded neighbours can also be regular neighbours, False otherwise.

set_neighbours(self: baggianalysis.core.NeighbourFinder, particles: List[baggianalysis.core.Particle], box: glm::tvec3<scalar, P>)None

Set the neighbours of the given list of particles. Note that only particles that belong to the given list can be neighbours. The criterium according to which particles are defined as neighbours can be set by subclassing this interface and overriding this method.

By default if particle q is already a bonded neighbour of particle p, q will not be added as a regular neighbour of p. This behaviour can be changed by invoking include_bonded_neighbours().

Parameters
  • particles (List(Particle)) – The particles whose neighbours will be set.

  • box (numpy.ndarray) – The simulation box.

class baggianalysis.core.FixedNumberFinder(self: baggianalysis.core.FixedNumberFinder, N: int, cutoff: float = 1.5)None

Bases: baggianalysis.core.NeighbourFinder

Define as neighbours of a particle the N particles that are closest to it. By default, a cutoff of 1.5 is used to look for neighbours. If not enough neighbours are found, the cutoff is increased.

The constructor takes two mandatory arguments.

Parameters
  • N (int) – The number of neighbours N that each particle will have at the end of the finding procedure.

  • cutoff (float) – The smallest cutoff that will be used to look for neighbours.

class baggianalysis.core.CutoffFinder(*args, **kwargs)

Bases: baggianalysis.core.NeighbourFinder

Define as neighbours of a particle all those particles that are closer than the given cutoff and, optionally, satisfy further conditions set by a custom function.

Overloaded function.

  1. __init__(self: baggianalysis.core.CutoffFinder, cutoff: float) -> None

The default constructor takes a single parameter setting the cutoff.

Parameters

cutoff (float) – The cutoff used to define neighbours.

  1. __init__(self: baggianalysis.core.CutoffFinder, cutoff: float, neighbour_function: Callable[[baggianalysis.core.Particle, baggianalysis.core.Particle, glm::tvec3<scalar, P>], bool]) -> None

This constructor takes two parameters: the cutoff and a callable that can be used to enforce further conditions.

Parameters
  • cutoff (float) – The cutoff used to define neighbours.

  • neighbour_function (callable) – A callable that takes two particles and a vector that is the distance between the two particles (defined as \(\vec{r} = \vec{r}_1 - \vec{r}_2\)), and returns a boolean, which should be True if the two particles are neighbours, False otherwise.

class baggianalysis.core.SANNFinder(self: baggianalysis.core.SANNFinder, max_distance: float, symmetry_policy: ba::SANNFinder::SymmetryPolicy)None

Bases: baggianalysis.core.NeighbourFinder

Use the SANN algorithm to detect neighbours.

SANN is a parameter-free, solid-angle based, nearest-neighbor algorithm described in this paper.

The constructor takes two mandatory arguments.

Parameters
  • max_distance (double) – The maximum distance that will be used to look for neighbour candidates.

  • symmetry_policy (SymmetryPolicy) – The policy that will be applied to particles that have neighbours that don’t have them as neighbours.

NO_ACTION = <SymmetryPolicy.NO_ACTION: 0>
SYMMETRISE_BY_ADDING = <SymmetryPolicy.SYMMETRISE_BY_ADDING: 1>
SYMMETRISE_BY_REMOVING = <SymmetryPolicy.SYMMETRISE_BY_REMOVING: 2>
class SymmetryPolicy(self: baggianalysis.core.SANNFinder.SymmetryPolicy, value: int)None

Bases: pybind11_builtins.pybind11_object

Members:

NO_ACTION

SYMMETRISE_BY_ADDING

SYMMETRISE_BY_REMOVING

NO_ACTION = <SymmetryPolicy.NO_ACTION: 0>
SYMMETRISE_BY_ADDING = <SymmetryPolicy.SYMMETRISE_BY_ADDING: 1>
SYMMETRISE_BY_REMOVING = <SymmetryPolicy.SYMMETRISE_BY_REMOVING: 2>
property name
property value