Order Module

Module for the computation of ordering.

These are tools and utilities for calculating the ordering of local structures.

sdanalysis.order.compute_neighbours(box, position, max_radius=3.5, max_neighbours=8)[source]

Compute the neighbours of each molecule.

Parameters
  • box (ndarray) – The parameters of the simulation cell

  • position (ndarray) – The positions of each molecule

  • max_radius (float) – The maximum radius to search for neighbours

  • max_neighbours (int) – The maximum number of neighbours to find.

Return type

ndarray

Returns

An array containing the index of the neighbours of each molecule. Each molecule will have max_neighbours listed, with the value 2 ** 32 - 1 indicating a missing value.

sdanalysis.order.compute_voronoi_neighs(box, position)[source]
Return type

ndarray

sdanalysis.order.create_ml_ordering(model)[source]

Create a machine learning initialised from a pickled model.

This reads a machine learning model from a file, creating a function to classify the ordering of a configuration.

Parameters

model (Path) – The path to a file containing a pickled model to be loaded using joblib

Return type

Callable[[Frame], ndarray]

Returns

A function to classify the ordering within a configuration.

sdanalysis.order.create_neigh_ordering(neighbours)[source]
Return type

Callable[[Frame], ndarray]

sdanalysis.order.create_orient_ordering(threshold)[source]
Return type

Callable[[Frame], ndarray]

sdanalysis.order.num_neighbours(box, position, max_radius=3.5)[source]

Calculate the number of neighbours of each molecule.

This function is optimised to quickly calculate the number of nearest neighbours each particle has.

Parameters
  • box (ndarray) – The lengths of the simulation cell in each direction

  • position (ndarray) – The position of each particle

  • max_radius (float) – The maximum radius at which a particle is considered a neighbour.

Return type

ndarray

sdanalysis.order.orientational_order(box, position, orientation, max_radius=3.5, max_neighbours=8)[source]

Compute the orientational order parameter for a given input.

The orientational order parameter compares the orientation of a particle with that of all it’s neighbours, using the relation

..math:

Theta = sum_{i=1}^N cos^2((theta_i - theta))

taking the orientation of each of the neighbouring particles compared to the current particle. The square ensures that the angles which are both parallel and antiparallel contribute to the ordering.

Parameters
  • box (ndarray) – The lengths of the simulation cell in each direction

  • position (ndarray) – The position of each particle

  • orientation (ndarray) – The orientation of each particle, given as quaternions.

  • max_radius (float) – The maximum radius to search for neighbours

  • max_neighbours (int) – The maximum number of neighbours to search for

Return type

ndarray

sdanalysis.order.relative_distances(box, position, max_radius=3.5, max_neighbours=8)[source]

Compute the distance to each neighbour.

Parameters
  • box (ndarray) – The lengths of the simulation cell in each direction

  • position (ndarray) – The position of each particle

  • max_radius (float) – The maximum radius at which a particle is considered a neighbour.

  • max_neighbours (int) – The maximum number of neighbours to search for

Return type

ndarray

Returns

The distance to each neighbour in a numpy array. Values which correspond to missing neighbours are represented by the value -1.

sdanalysis.order.relative_orientations(box, position, orientation, max_radius=3.5, max_neighbours=8)[source]

Find the relative orientations of each neighbouring particle.

This finds each of the nearest neighbours for each particle and computes the orientation of those neighbours relative to the orientation of the central particle.

Parameters
  • box (ndarray) – The lengths of the simulation cell in each direction

  • position (ndarray) – The position of each particle

  • orientation (ndarray) – The orientation of each particle represented as a quaternion

  • max_radius (float) – The maximum distance to look to nearest neighbours

  • max_neighbours (int) – The maximum number of neighbours considered nearest.

Return type

ndarray

sdanalysis.order.setup_neighbours(box, position, max_radius=3.5, max_neighbours=8, is_2D=True)[source]
Return type

NearestNeighbors