pyiron.atomistics.structure.analyse module

class pyiron.atomistics.structure.analyse.Analyse(structure)[source]

Bases: object

Class to analyse atom structure.

get_layers(distance_threshold=0.01, id_list=None, wrap_atoms=True, planes=None)[source]

Get an array of layer numbers.

Parameters
  • distance_threshold (float) – Distance below which two points are considered to belong to the same layer. For detailed description: sklearn.cluster.AgglomerativeClustering

  • id_list (list/numpy.ndarray) – List of atoms for which the layers should be considered.

  • planes (list/numpy.ndarray) – Planes along which the layers are calculated. Planes are given in vectors, i.e. [1, 0, 0] gives the layers along the x-axis. Default planes are orthogonal unit vectors: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]. If you have a tilted box and want to calculate the layers along the directions of the cell vectors, use planes=np.linalg.inv(structure.cell).T. Whatever values are inserted, they are internally normalized, so whether [1, 0, 0] is entered or [2, 0, 0], the results will be the same.

Returns: Array of layer numbers (same shape as structure.positions)

Example I - how to get the number of layers in each direction:

>>> structure = Project('.').create_structure('Fe', 'bcc', 2.83).repeat(5)
>>> print('Numbers of layers:', np.max(structure.analyse.get_layers(), axis=0)+1)

Example II - get layers of only one species:

>>> print('Iron layers:', structure.analyse.get_layers(
...       id_list=structure.select_index('Fe')))
pyscal_centro_symmetry(num_neighbors=12)[source]

Analyse centrosymmetry parameter

Parameters

num_neighbors (int) – number of neighbors

Returns

list of centrosymmetry parameter

Return type

list

pyscal_cna_adaptive(mode='total', ovito_compatibility=False)[source]

Use common neighbor analysis

Parameters
  • mode ("total"/"numeric"/"str") –

    Controls the style and level of detail of the output. - total : return number of atoms belonging to each structure - numeric : return a per atom list of numbers- 0 for unknown,

    1 fcc, 2 hcp, 3 bcc and 4 icosa

    • str : return a per atom string of sructures

  • ovito_compatibility (bool) – use ovito compatiblity mode

Returns

(depends on mode)

pyscal_diamond_structure(mode='total', ovito_compatibility=False)[source]

Analyse diamond structure

Parameters
  • mode ("total"/"numeric"/"str") – Controls the style and level

  • detail of the output. (of) –

    • total : return number of atoms belonging to each structure

    • numericreturn a per atom list of numbers- 0 for unknown,

      1 fcc, 2 hcp, 3 bcc and 4 icosa

    • str : return a per atom string of sructures

  • ovito_compatibility (bool) – use ovito compatiblity mode

Returns

(depends on mode)

pyscal_steinhardt_parameter(neighbor_method='cutoff', cutoff=0, n_clusters=2, q=(4, 6), averaged=False, clustering=True)[source]

Calculate Steinhardts parameters

Parameters
  • neighbor_method (str) – can be [‘cutoff’, ‘voronoi’]

  • cutoff (float) – can be 0 for adaptive cutoff or any other value

  • n_clusters (int) – number of clusters for K means clustering

  • q (list) – can be from 2-12, the required q values to be calculated

  • averaged (bool) – If True, calculates the averaged versions of the parameter

  • clustering (bool) – If True, cluster based on the q values

Returns

calculated q parameters

Return type

list

pyscal_voronoi_volume()[source]

Calculate the Voronoi volume of atoms

pyiron.atomistics.structure.analyse.get_average_of_unique_labels(labels, values)[source]

This function returns the average values of those elements, which share the same labels

Example:

>>> labels = [0, 1, 0, 2]
>>> values = [0, 1, 2, 3]
>>> print(get_average_of_unique_labels(labels, values))
array([1, 1, 3])