aim2dat.strct.structure_operations

Implements the StructureComparison and StructuresOperations classes to analyze a collection of structures.

Module Contents

Classes

StructureOperations

Serves as a wrapper to make the methods defined on a single

Functions

compare_structures(structures, compare_function, ...)

Parallelize structure comparison methods via this wrapper function.

structure_wrapper(structure, method, kwargs, check_stored)

Parallelize structure analysis and manipulation methods via this wrapper function.

class aim2dat.strct.structure_operations.StructureOperations(structures: list[aim2dat.strct.Structure | dict] | aim2dat.strct.StructureCollection, output_format: str = 'dict', n_procs: int = 1, chunksize: int = 50, verbose: bool = True)[source]

Bases: aim2dat.strct.mixin.AnalysisMixin, aim2dat.strct.mixin.ManipulationMixin

Serves as a wrapper to make the methods defined on a single Structure object accessible for a StructureCollection.

Manipulation methods applied to one Structure will simply return the new manipulated Structure. If a manipulation method is applied to multiple Structure`s, a new `StructureCollection object will be returned. The initial StructureCollection remains unaffected.

Overview

Properties

chunksize

Number of tasks handed to each process at once.

n_procs

Number of parallel processes.

output_format

Specify the output format of calculation methods. Supported options are 'dict'

structures

Return the internal StructureCollection object.

supported_output_formats

Return the supported output formats.

verbose

Print progress bar.

Methods

analysis_methods()

list: Return calculation methods. This property is depreciated and will be removed soon.

calculate_angle(site_index1, site_index2, site_index3, backfold_positions)

Calculate angle between three atoms.

calculate_coordination(r_max, method, min_dist_delta, n_nearest_neighbours, radius_type, atomic_radius_delta, econ_tolerance, econ_conv_threshold, voronoi_weight_type, voronoi_weight_threshold, okeeffe_weight_threshold)

Calculate coordination environment of each atomic site.

calculate_dihedral_angle(site_index1, site_index2, site_index3, site_index4, backfold_positions)

Calculate dihedral angle between four atoms.

calculate_distance(site_index1, site_index2, backfold_positions, use_supercell, r_max, return_pos)

Calculate distance between two atoms.

calculate_ffingerprint(r_max, delta_bin, sigma, use_legacy_smearing, distinguish_kinds)

Calculate f-fingerprint function for each element-pair and atomic site.

calculate_stabilities(unit, exclude_keys)

Calculate the formation energies and stabilities of all structures.

calculate_voronoi_tessellation(r_max)

Calculate voronoi polyhedron for each atomic site.

compare_sites_via_coordination(key1, key2, site_index1, site_index2, distinguish_kinds, threshold, **cn_kwargs)

Compare two atomic sites based on their coordination and the distances to their neighbour

compare_sites_via_ffingerprint(key1, key2, site_index1, site_index2, r_max, delta_bin, sigma, use_weights, use_legacy_smearing, distinguish_kinds)

Calculate similarity of two atom sites.

compare_structures_via_comp_sym(key1, key2, symprec, angle_tolerance, hall_number)

Compare two structures merely based on the composition and space group.

compare_structures_via_direct_comp(key1, key2, symprec, angle_tolerance, hall_number, no_idealize, length_threshold, angle_threshold, position_threshold, distinguish_kinds)

Compare structures by comparing lattice vectors, angles and scaled positions.

compare_structures_via_ffingerprint(key1, key2, r_max, delta_bin, sigma, use_weights, use_legacy_smearing, distinguish_kinds)

Calculate similarity of two structures.

copy()

Return copy of StructureCollection object.

delete_atoms(elements, site_indices, change_label)

Delete atoms by element, list of elements, site index or list of site indices.

determine_point_group(threshold_distance, threshold_angle, threshold_inertia)

Determine the point group of a molecule.

determine_space_group(symprec, angle_tolerance, hall_number, return_sym_operations, return_primitive_structure, return_standardized_structure, no_idealize)

Determine the space group of the structure using spglib as backend.

find_duplicates_via_comp_sym(confined, remove_structures, symprec, angle_tolerance, hall_number)

Find duplicate structures coimparing the composition and space group.

find_duplicates_via_direct_comp(confined, remove_structures, symprec, angle_tolerance, hall_number, no_idealize, length_threshold, angle_threshold, position_threshold, distinguish_kinds)

Find duplicate structures comparing directly the lattice parameters and positions of the

find_duplicates_via_ffingerprint(confined, remove_structures, threshold, r_max, delta_bin, sigma, use_weights, use_legacy_smearing, distinguish_kinds)

Find duplicate structures using the FFingerprint method.

find_eq_sites_via_coordination(key, distinguish_kinds, threshold, **cn_kwargs)

Find equivalent sites by comparing the coordination of each site and its distance to the

find_eq_sites_via_ffingerprint(key, r_max, delta_bin, sigma, use_weights, use_legacy_smearing, distinguish_kinds, threshold)

Find equivalent sites by comparing the F-Fingerprint of each site.

list_analysis_methods()

class Get a list with the function names of all available analysis methods.

list_manipulation_methods()

class Get a list with the function names of all available manipulation methods.

manipulation_methods()

list: Return manipulation methods. This property is depreciated and will be removed soon.

perform_analysis(method, kwargs)

Perform structure analaysis using an external method.

perform_manipulation(method, kwargs)

Perform structure manipulation using an external method.

scale_unit_cell(scaling_factors, pressure, bulk_modulus, change_label)

Scale the unit cell of the structure, supporting isotropic and anisotropic strain,

substitute_elements(elements, radius_type, remove_kind, change_label)

Substitute all atoms of one or several elements.

property chunksize : int

Number of tasks handed to each process at once.

Type:

int

property n_procs : int

Number of parallel processes.

Type:

int

property output_format : str

Specify the output format of calculation methods. Supported options are 'dict' and 'DataFrame'.

Type:

str

property structures : aim2dat.strct.StructureCollection

Return the internal StructureCollection object.

property supported_output_formats : list[str]

Return the supported output formats.

property verbose : bool

Print progress bar.

Type:

bool

analysis_methods() list

list: Return calculation methods. This property is depreciated and will be removed soon.

calculate_angle(site_index1: int | list[int] = 0, site_index2: int | list[int] = 1, site_index3: int | list[int] = 2, backfold_positions: bool = True) float

Calculate angle between three atoms.

Parameters:
  • site_index1 (int, list or None) – Index of the site.

  • site_index2 (int, list or None) – Index of the site.

  • site_index3 (int, list or None) – Index of the site.

  • backfold_positions (bool) – Whether to backfold the atomic sites and return the smallest distance.

Returns:

float or dict – Angle calculated via the vectors from atom 2 to atom 1 and atom 3. If one of the indices is a list, a dictionary with all index pairs as keys and angles as values is returned.

calculate_coordination(r_max: float = 10.0, method: str = 'atomic_radius', min_dist_delta: float = 0.1, n_nearest_neighbours: int = 5, radius_type: str = 'chen_manz', atomic_radius_delta: float = 0.0, econ_tolerance: float = 0.5, econ_conv_threshold: float = 0.001, voronoi_weight_type: float = 'rel_solid_angle', voronoi_weight_threshold: float = 0.5, okeeffe_weight_threshold: float = 0.5) dict

Calculate coordination environment of each atomic site.

Parameters:
  • r_max (float (optional)) – Cut-off value for the maximum distance between two atoms in angstrom.

  • method (str (optional)) – Method used to calculate the coordination environment.

  • min_dist_delta (float (optional)) – Tolerance parameter that defines the relative distance from the nearest neighbour atom for the 'minimum_distance' method.

  • n_nearest_neighbours (int (optional)) – Number of neighbours that are considered coordinated for the 'n_neighbours' method.

  • radius_type (str (optional)) – Type of the atomic radius used for the 'atomic_radius' method ('covalent' is used as fallback in the radius for an element is not defined).

  • atomic_radius_delta (float (optional)) – Tolerance relative to the sum of the atomic radii for the 'atomic_radius' method. If set to 0.0 the maximum threshold is defined by the sum of the atomic radii, positive (negative) values increase (decrease) the threshold.

  • econ_tolerance (float (optional)) – Tolerance parameter for the econ method.

  • econ_conv_threshold (float (optional)) – Convergence threshold for the econ method.

  • voronoi_weight_type (str (optional)) – Weight type of the Voronoi facets. Supported options are 'covalent_atomic_radius', 'area' and 'solid_angle'. The prefix 'rel_' specifies that the relative weights with respect to the maximum value of the polyhedron are calculated.

  • voronoi_weight_threshold (float (optional)) – Weight threshold to consider a neighbouring atom coordinated.

  • okeeffe_weight_threshold (float (optional)) – Threshold parameter to distinguish indirect and direct neighbour atoms for the 'okeeffe'.

    This parameter is depreciated and will be removed in a future version. The original results can be obtained by using the voronoi_weight_threshold parameter and setting voronoi_weight_type to 'rel_solid_angle'.

Returns:

dict – Dictionary containing the coordination information of the structure.

calculate_dihedral_angle(site_index1: int | list[int] = 0, site_index2: int | list[int] = 1, site_index3: int | list[int] = 2, site_index4: int | list[int] = 3, backfold_positions: bool = True) float

Calculate dihedral angle between four atoms.

Parameters:
  • site_index1 (int, list or None) – Index of the site.

  • site_index2 (int, list or None) – Index of the site.

  • site_index3 (int, list or None) – Index of the site.

  • site_index4 (int, list or None) – Index of the site.

  • backfold_positions (bool) – Whether to backfold the atomic sites and return the smallest distance.

Returns:

float or dict – Dihedral angle. If one of the indices is a list, a dictionary with all index pairs as keys and angles as values is returned.

calculate_distance(site_index1: int | list[int] = 0, site_index2: int | list[int] = 1, backfold_positions: bool = True, use_supercell: bool = False, r_max: float = 7.5, return_pos: bool = False) float | list

Calculate distance between two atoms.

Parameters:
  • site_index1 (int, list or None) – Index of the site.

  • site_index2 (int, list or None) – Index of the site.

  • backfold_positions (bool) – Whether to backfold the atomic sites and return the smallest distance.

  • use_supercell (bool) – User supercell to calculate all distances between the two atomic sites up to the radius r_max.

  • r_max (float) – Cut-off value for the maximum distance between two atoms in angstrom.

  • return_pos (bool) – Whether to return the positions. Useful if use_supercell is set to True or when trying to determine the closest periodic image.

Returns:

float, dict or None – Distance between the two atoms or a list of distances (if use_super_cell is set to True). If one of the indices is a list, a dictionary with all index pairs as keys and distances as values is returned. If return_pos is set to True, the positions are returned as well. In case use_super_cell is set to True and the distance between the two sites exceeds r_max, None is returned.

calculate_ffingerprint(r_max: float = 20.0, delta_bin: float = 0.005, sigma: float = 0.05, use_legacy_smearing: bool = False, distinguish_kinds: bool = False) tuple[dict, dict]

Calculate f-fingerprint function for each element-pair and atomic site.

The calculation is based on equation (3) in doi:10.1063/1.3079326.

Parameters:
  • r_max (float (optional)) – Cut-off value for the maximum distance between two atoms in angstrom.

  • delta_bin (float (optional)) – Bin size to descritize the function in angstrom.

  • sigma (float (optional)) – Smearing parameter for the Gaussian function.

  • use_legacy_smearing (bool) – Use the depreciated smearing method.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

Returns:

  • element_fingerprints (dict) – Dictionary containing all fingerprint functions of the structure summed over all atoms of the same element.

  • atomic_fingerprints (dict) – Dictionary containing all individual fingerprint functions for each atomic site.

calculate_stabilities(unit: str = 'eV', exclude_keys: list = []) tuple[list, list][source]

Calculate the formation energies and stabilities of all structures.

The stabilities are only valid for binary systems.

Parameters:
  • unit (str (optional)) – Energy unit.

  • exclude_keys (list) – List of keys of structures that are not included in the detection of the convex hull. This means that the stability of these structures may have a negative sign.

Returns:

  • formation_energies (list) – List of the formation energies of all structures.

  • stabilities (list) – List of the stabilities of all structures.

calculate_voronoi_tessellation(r_max: float = 10.0) list[list[dict]]

Calculate voronoi polyhedron for each atomic site.

Parameters:

r_max (float (optional)) – Cut-off value for the maximum distance between two atoms in angstrom.

Returns:

list – List of voronoi details for each atomic site.

compare_sites_via_coordination(key1: str | int, key2: str | int, site_index1: int, site_index2: int, distinguish_kinds: bool = False, threshold: float = 0.01, **cn_kwargs)[source]

Compare two atomic sites based on their coordination and the distances to their neighbour atoms.

Parameters:
  • key1 (str or int) – Index or label of the first structure.

  • key2 (str or int) – Index or label of the second structure.

  • site_index1 (int) – Index of the site.

  • site_index2 (int) – Index of the site.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

  • threshold (float (optional)) – Threshold to consider two sites equivalent.

  • cn_kwargs – Optional keyword arguments passed on to the calculate_coordination function.

Returns:

bool – Whether the two sites are equivalent or not.

compare_sites_via_ffingerprint(key1: str | int, key2: str | int, site_index1: int, site_index2: int, r_max: float = 15.0, delta_bin: float = 0.005, sigma: float = 10.0, use_weights: bool = True, use_legacy_smearing: bool = False, distinguish_kinds: bool = False)[source]

Calculate similarity of two atom sites.

The cosine-distance is used to compare the two structures.

Parameters:
  • key1 (str or int) – Index or label of the first structure.

  • key2 (str or int) – Index or label of the second structure.

  • site_index1 (int) – Index of the site.

  • site_index2 (int) – Index of the site.

  • r_max (float (optional)) – Cut-off value for the maximum distance between two atoms in angstrom.

  • delta_bin (float (optional)) – Bin size to descritize the function in angstrom.

  • sigma (float (optional)) – Smearing parameter for the Gaussian function.

  • use_weights (bool (optional)) – Whether to use importance weights for the element pairs.

  • use_legacy_smearing (bool) – Use the depreciated smearing method.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

Returns:

distance (float) – Measure for the similarity of the two sites.

compare_structures_via_comp_sym(key1: str | int, key2: str | int, symprec: float = 0.005, angle_tolerance: float = -1.0, hall_number: int = 0) bool[source]

Compare two structures merely based on the composition and space group.

Parameters:
  • key1 (str, int, list or tuple) – Index or label of the structure or list/tuple of indices or labels of several structures.

  • key2 (str, int, list, tuple or None) – Index or label of the structure or list/tuple of indices or labels of several structures. If set to None, all structures given with key1 are compared to each other. Otherwise, key1 and key2 are compared pair-wise (in this case, key1 and key2 must be of same length).

  • symprec (float (optional)) – Tolerance parameter for spglib.

  • angle_tolerance (float (optional)) – Tolerance parameter for spglib.

  • hall_number (int (optional)) – The argument to constrain the space-group-type search only for the Hall symbol corresponding to it.

Returns:

bool – Returns True if the structures match and otherwise False.

compare_structures_via_direct_comp(key1: str | int, key2: str | int, symprec: float = 0.005, angle_tolerance: float = -1.0, hall_number: float = 0, no_idealize: bool = False, length_threshold: float = 0.08, angle_threshold: float = 0.03, position_threshold: float = 0.025, distinguish_kinds: bool = False) bool[source]

Compare structures by comparing lattice vectors, angles and scaled positions.

compare_structures_via_ffingerprint(key1: str | int, key2: str | int, r_max: float = 15.0, delta_bin: float = 0.005, sigma: float = 0.05, use_weights: bool = True, use_legacy_smearing: bool = False, distinguish_kinds: bool = False) float[source]

Calculate similarity of two structures.

The cosine-distance is used to compare the two structures.

Parameters:
  • key1 (str, int, list or tuple) – Index or label of the structure or list/tuple of indices or labels of several structures.

  • key2 (str, int, list, tuple or None) – Index or label of the structure or list/tuple of indices or labels of several structures. If set to None, all structures given with key1 are compared to each other. Otherwise, key1 and key2 are compared pair-wise (in this case, key1 and key2 must be of same length).

  • r_max (float (optional)) – Cut-off value for the maximum distance between two atoms in angstrom.

  • delta_bin (float (optional)) – Bin size to descritize the function in angstrom.

  • sigma (float (optional)) – Smearing parameter for the Gaussian function.

  • use_weights (bool (optional)) – Whether to use importance weights for the element pairs.

  • use_legacy_smearing (bool) – Use the depreciated smearing method.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

Returns:

distance (float) – Measure for the similarity of the two structures.

copy() StructureOperations[source]

Return copy of StructureCollection object.

delete_atoms(elements: str | list[str] = [], site_indices: int | list[int] = [], change_label: bool = False) aim2dat.strct.Structure | aim2dat.strct.StructureCollection

Delete atoms by element, list of elements, site index or list of site indices.

Parameters:
  • elements (str, list or tuple) – Element or tuple or list of the elements to be deleted.

  • site_indices (list or tuple) – Site index or tuple or list of site indices to be deleted.

Returns:

aim2dat.strct.Structure – Structure with deleted atoms.

determine_point_group(threshold_distance: float = 0.1, threshold_angle: float = 1.0, threshold_inertia: float = 0.1) dict

Determine the point group of a molecule.

Parameters:
  • threshold_distance (float (optional)) – Tolerance parameter for distances.

  • threshold_angle (float (optional)) – Tolerance parameter for angles.

  • threshold_inertia (float (optional)) – Tolerance parameter for inertia.

Returns:

dict – Dictionary containing the point group and symmetry elements of the structure.

determine_space_group(symprec: float = 0.005, angle_tolerance: float = -1.0, hall_number: int = 0, return_sym_operations: bool = False, return_primitive_structure: bool = False, return_standardized_structure: bool = False, no_idealize: bool = False) dict

Determine the space group of the structure using spglib as backend.

Parameters:
  • symprec (float (optional)) – Tolerance parameter for spglib

  • angle_tolerance (float (optional)) – Tolerance parameter for spglib.

  • hall_number (int (optional)) – The argument to constrain the space-group-type search only for the Hall symbol corresponding to it.

  • return_sym_operations (bool (optional)) – Additionally, return all symmetry elements.

  • return_primitive_structure (bool (optional)) – Whether to return the primitive standardized structure.

  • return_standardized_structure (bool (optional)) – Whether to the non-primitive standardized structure.

  • no_idealize (bool (optional)) – Whether to idealize unit cell vectors and angles.

Returns:

dict – Dictionary containing the internal space group number and labels.

find_duplicates_via_comp_sym(confined: list = None, remove_structures: bool = False, symprec: float = 0.005, angle_tolerance: float = -1.0, hall_number: int = 0) list[tuple[str]][source]

Find duplicate structures coimparing the composition and space group.

Parameters:
  • confined (list or None (optional)) – Confine comparison to a subset of the structure collection by giving a minimum and maximum index.

  • remove_structures (bool (optional)) – Whether to remove the duplicate structures.

  • symprec (float (optional)) – Tolerance parameter for spglib.

  • angle_tolerance (float (optional)) – Tolerance parameter for spglib.

  • hall_number (int (optional)) – The argument to constrain the space-group-type search only for the Hall symbol corresponding to it.

Returns:

list – List of tuples containing the indices of the found duplicate pairs.

find_duplicates_via_direct_comp(confined: list = None, remove_structures: bool = False, symprec: float = 0.005, angle_tolerance: float = -1.0, hall_number: int = 0, no_idealize: bool = False, length_threshold: float = 0.08, angle_threshold: float = 0.03, position_threshold: float = 0.025, distinguish_kinds: bool = False) list[tuple[str]][source]
Find duplicate structures comparing directly the lattice parameters and positions of the

standardized structures..

Parameters:
  • confined (list or None (optional)) – Confine comparison to a subset of the structure collection by giving a minimum and maximum index.

  • remove_structures (bool (optional)) – Whether to remove the duplicate structures.

  • symprec (float (optional)) – Tolerance parameter for spglib.

  • angle_tolerance (float (optional)) – Tolerance parameter for spglib.

  • hall_number (int (optional)) – The argument to constrain the space-group-type search only for the Hall symbol corresponding to it.

Returns:

list – List of tuples containing the indices of the found duplicate pairs.

find_duplicates_via_ffingerprint(confined: list = None, remove_structures: bool = False, threshold: float = 0.001, r_max: float = 15.0, delta_bin: float = 0.005, sigma: float = 0.05, use_weights: bool = True, use_legacy_smearing: bool = False, distinguish_kinds: bool = False) list[tuple[str]][source]

Find duplicate structures using the FFingerprint method.

Parameters:
  • confined (list or None (optional)) – Confine comparison to a subset of the structure collection by giving a minimum and maximum index.

  • remove_structures (bool (optional)) – Whether to remove the duplicate structures.

  • threshold (float (optional)) – Threshold of the FFingerprint to detect duplicate structures.

  • r_max (float (optional)) – Maximum distance between two atoms used to construct the super cell.

  • delta_bin (float (optional)) – Bin size to discretize the function in angstrom.

  • sigma (float (optional)) – Smearing parameter for the Gaussian function.

  • use_weights (bool (optional)) – Whether to use importance weights for the element pairs.

  • use_legacy_smearing (bool) – Use the depreciated smearing method.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

Returns:

list – List of tuples containing the indices of the found duplicate pairs.

find_eq_sites_via_coordination(key: str | int, distinguish_kinds: bool = False, threshold: float = 0.01, **cn_kwargs)[source]

Find equivalent sites by comparing the coordination of each site and its distance to the neighbour atoms.

Parameters:
  • key (str or int) – Index or label of the structure.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

  • threshold (float (optional)) – Threshold to consider two sites equivalent.

  • cn_kwargs – Optional keyword arguments passed on to the calculate_coordination function.

Returns:

dict – Dictionary grouping equivalent sites.

find_eq_sites_via_ffingerprint(key: str | int, r_max: float = 20.0, delta_bin: float = 0.005, sigma: float = 0.05, use_weights: bool = True, use_legacy_smearing: bool = False, distinguish_kinds: bool = False, threshold: float = 0.001)[source]

Find equivalent sites by comparing the F-Fingerprint of each site.

Parameters:
  • key (str or int) – Index or label of the structure.

  • r_max (float (optional)) – Cut-off value for the maximum distance between two atoms in angstrom.

  • delta_bin (float (optional)) – Bin size to descritize the function in angstrom.

  • sigma (float (optional)) – Smearing parameter for the Gaussian function.

  • use_weights (bool) – Whether to use importance weights for the element pairs.

  • use_legacy_smearing (bool) – Use the depreciated smearing method.

  • distinguish_kinds (bool (optional)) – Whether different kinds should be distinguished e.g. Ni0 and Ni1 would be considered as different elements if True.

  • threshold (float (optional)) – Threshold to consider two sites equivalent.

Returns:

dict – Dictionary grouping equivalent sites.

classmethod list_analysis_methods() list

Get a list with the function names of all available analysis methods.

Returns:

list – Return a list of all available analysis methods.

classmethod list_manipulation_methods() list

Get a list with the function names of all available manipulation methods.

Returns:

list – Return a list of all available manipulation methods.

manipulation_methods() list

list: Return manipulation methods. This property is depreciated and will be removed soon.

perform_analysis(method: collections.abc.Callable, kwargs: dict = {})[source]

Perform structure analaysis using an external method.

Parameters:
  • method (function) – Analysis function.

  • kwargs (dict) – Arguments to be passed to the function.

Returns:

output – Output of the analysis.

perform_manipulation(method: collections.abc.Callable, kwargs: dict = {})

Perform structure manipulation using an external method.

Parameters:
  • method (function) – Function which manipulates the structure(s).

  • kwargs (dict) – Arguments to be passed to the function.

Returns:

  • aim2dat.strct.Structure or

  • aim2dat.strct.StructureCollection – Manipulated structure(s).

scale_unit_cell(scaling_factors: float | list[float] = None, pressure: float = None, bulk_modulus: float = None, change_label: bool = True) aim2dat.strct.Structure | aim2dat.strct.StructureCollection

Scale the unit cell of the structure, supporting isotropic and anisotropic strain, and pressure-based strain.

Parameters:
  • scaling_factors (float, list of floats, or arry-like, optional) – Scaling factor(s) to scale the unit cell. - If a single float, isotropic scaling is applied. - If a list of 3 floats or a 1D array, anisotropic scaling is

    applied along the principal axes.

    • If a 3x3 nested list or a 2D array, it defines a full transformation matrix.

    Scaling factors are interpreted as 1 + strain. For example: - A 1% strain corresponds to a scaling factor of 1.01. - A -2% strain (compression) corresponds to a scaling factor of 0.98.

  • pressure (float, optional) – Hydrostatic pressure to apply. Requires bulk_modulus to calculate scaling.

  • bulk_modulus (float, optional) – Bulk modulus of the material. Required if pressure is provided. Ensure the units of bulk_modulus and pressure are consistent.

  • change_label (bool, optional) – If True, appends a suffix to the structure’s label to reflect the scaling applied. Defaults to True

Returns:

Structure or StructureCollection – The scaled structure or a collection of scaled structures.

Raises:

ValueError – If required parameters are missing or invalid, such as when pressure is given without bulk_modulus, or invalid scaling_factors inputs.

Notes

  • The pressure and bulk_modulus inputs are mutually exclusive with direct

scaling_factors input. - Scaling factors directly modify the unit cell dimensions and are applied such that

fractional atomic positions remain unchanged.

substitute_elements(elements: list[tuple[str]] | list[tuple[int]] = [], radius_type: str | None = 'covalent', remove_kind: bool = False, change_label: bool = False) aim2dat.strct.Structure | aim2dat.strct.StructureCollection

Substitute all atoms of one or several elements.

Parameters:
  • elements (list or tuple) – Tuple or list of tuples of the elements that are substituted.

  • remove_kind (bool (optional)) – Sets the entries of the substituted sites in kinds to None.

  • radius_type (str or None (optional)) – Radius type used to calculate the scaling factor for the unit cell. If set to None no scaling is applied. The default value is covalent.

Returns:

aim2dat.strct.Structure – Structure with substituted elements.

aim2dat.strct.structure_operations.compare_structures(structures, compare_function, comp_kwargs, threshold)[source]

Parallelize structure comparison methods via this wrapper function.

aim2dat.strct.structure_operations.structure_wrapper(structure, method, kwargs, check_stored)[source]

Parallelize structure analysis and manipulation methods via this wrapper function.