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
 Return type
 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.
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.

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.

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 directionposition (
ndarray
) – The position of each particleorientation (
ndarray
) – The orientation of each particle, given as quaternions.max_radius (
float
) – The maximum radius to search for neighboursmax_neighbours (
int
) – The maximum number of neighbours to search for
 Return type

sdanalysis.order.
relative_distances
(box, position, max_radius=3.5, max_neighbours=8)[source]¶ Compute the distance to each neighbour.
 Parameters
 Return type
 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 directionposition (
ndarray
) – The position of each particleorientation (
ndarray
) – The orientation of each particle represented as a quaternionmax_radius (
float
) – The maximum distance to look to nearest neighboursmax_neighbours (
int
) – The maximum number of neighbours considered nearest.
 Return type