aim2dat.strct.mixin¶
Mixin classes for the Structure and StructureOperations classes.
Module Contents¶
Classes¶
Mixin class to perform structural analysis tasks. |
|
Mixin to implement structural constraints. |
|
Mixin class to perform structural manipulation tasks. |
Functions¶
|
Mark function as calculation function. |
|
Mark structure manipulating functions. |
- exception aim2dat.strct.mixin.ConstraintError[source]¶
Bases:
ExceptionConstraint error.
- class args¶
Overview
Methods¶ Exception.with_traceback(tb) –
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class aim2dat.strct.mixin.AnalysisMixin[source]¶
Mixin class to perform structural analysis tasks.
Overview
Properties¶ class Return calculation methods.
Methods¶ calculate_angle(key, site_index1, site_index2, site_index3, backfold_positions)Calculate angle between three atoms.
calculate_coordination(key, r_max, method, min_dist_delta, n_nearest_neighbours, econ_tolerance, econ_conv_threshold, voronoi_weight_type, voronoi_weight_threshold, okeeffe_weight_threshold)Calculate coordination environment of each atomic site.
calculate_dihedral_angle(key, site_index1, site_index2, site_index3, site_index4, backfold_positions)Calculate dihedral angle between four atoms.
calculate_distance(key, site_index1, site_index2, backfold_positions, use_supercell, r_max)Calculate distance between two atoms.
calculate_ffingerprint(key, r_max, delta_bin, sigma, use_legacy_smearing, distinguish_kinds)Calculate f-fingerprint function for each element-pair and atomic site.
calculate_voronoi_tessellation(key, r_max)Calculate voronoi polyhedron for each atomic site.
determine_point_group(key, threshold_distance, threshold_angle, threshold_inertia)Determine the point group of a molecule.
determine_space_group(key, 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.
-
calculate_angle(key: str | int | tuple | list =
None, site_index1: int =0, site_index2: int =1, site_index3: int =2, backfold_positions: bool =True) float[source]¶ Calculate angle between three atoms.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.site_index1 (int) – Index of the site.
site_index2 (int) – Index of the site.
site_index3 (int) – Index of the site.
backfold_positions (bool) – Whether to backfold the atomic sites and return the smallest distance.
- Returns:¶
float – Angle calculated via the vectors from atom 2 to atom 1 and atom 3.
-
calculate_coordination(key: str | int | tuple | list =
None, r_max: float =10.0, method: str ='minimum_distance', min_dist_delta: float =0.1, n_nearest_neighbours: int =5, 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[source]¶ Calculate coordination environment of each atomic site.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.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. The default value is
'minimum_distance'.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.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_thresholdparameter and settingvoronoi_weight_typeto'rel_solid_angle'.
- Returns:¶
dict – Dictionary containing the coordination information of the structure.
-
calculate_dihedral_angle(key: str | int | tuple | list =
None, site_index1: int =0, site_index2: int =1, site_index3: int =2, site_index4: int =3, backfold_positions: bool =True) float[source]¶ Calculate dihedral angle between four atoms.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.site_index1 (int) – Index of the site.
site_index2 (int) – Index of the site.
site_index3 (int) – Index of the site.
site_index4 (int) – Index of the site.
backfold_positions (bool) – Whether to backfold the atomic sites and return the smallest distance.
- Returns:¶
float – Dihedral angle.
-
calculate_distance(key: str | int | tuple | list =
None, 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) float | list[source]¶ Calculate distance between two atoms.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.site_index1 (int) – Index of the site.
site_index2 (int) – 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.
- Returns:¶
float – Distance between the two atoms or a list of distances (if
use_super_cellis set toTrue).
-
calculate_ffingerprint(key: str | int | tuple | list =
None, 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][source]¶ 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:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.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_voronoi_tessellation(key: str | int | tuple | list =
None, r_max: float =10.0) list[list[dict]][source]¶ Calculate voronoi polyhedron for each atomic site.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.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.
-
determine_point_group(key: str | int | tuple | list =
None, threshold_distance: float =0.1, threshold_angle: float =1.0, threshold_inertia: float =0.1) dict[source]¶ Determine the point group of a molecule.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.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(key: str | int | tuple | list =
None, 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[source]¶ Determine the space group of the structure using spglib as backend.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.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.
-
calculate_angle(key: str | int | tuple | list =
- class aim2dat.strct.mixin.ConstraintsMixin[source]¶
Mixin to implement structural constraints.
Overview
Properties¶ Attribute constraints.
Constraints on the chemical formula.
Elemental concentration constraints.
Whether to neglect elemental phases.
Methods¶ add_chem_formula_constraint(chem_formula, reduced_formula)Add a chemical formula as a constraint.
Remove all constraints.
set_attribute_constraint(attribute, min_value, max_value)Set a constraint on attributes.
set_concentration_constraint(element, min_conc, max_conc)Set a constraint on the concentration of an element in the structure.
- property attribute_constraints¶
Attribute constraints.
- property chem_formula_constraints¶
Constraints on the chemical formula.
- property concentration_constraints¶
Elemental concentration constraints.
- property neglect_elemental_structures¶
Whether to neglect elemental phases.
-
add_chem_formula_constraint(chem_formula, reduced_formula=
True)[source]¶ Add a chemical formula as a constraint.
The formula can be given as a string, dictionary or list of strings or dictionaries.
- Parameters:¶
chem_formula (list, dict or str) – Chemical formula given as list, dict or str.
reduced_formula (bool (optional)) – If set to
Truethe reduced formulas are compared. The default value isTrue.
-
set_attribute_constraint(attribute, min_value=
None, max_value=None)[source]¶ Set a constraint on attributes.
- Parameters:¶
attribute (str) – Attribute to be constraint.
min_value (float) – Minimum value of the attribute. In case of no limit the variable can be set to
0.0.max_value (float) – Maximum value of the attribute. In case of no limit the variable can be set to
1.0.
-
set_concentration_constraint(element, min_conc=
0.0, max_conc=1.0)[source]¶ Set a constraint on the concentration of an element in the structure.
The minimum and maximum values have to be set between 0.0 and 1.0.
- Parameters:¶
element (str) – Element to be constraint.
min_conc (float) – Minimum concentration. In case of no limit the variable can be set to
0.0.max_conc (float) – Maximum concentration. In case of no limit the variable can be set to
1.0.
- class aim2dat.strct.mixin.ManipulationMixin[source]¶
Mixin class to perform structural manipulation tasks.
Overview
Properties¶ class Return manipulation methods.
Methods¶ delete_atoms(key, elements, site_indices, change_label)Delete atoms by element, list of elements, site index or list of site indices.
scale_unit_cell(key, scaling_factor, change_label)Scale unit cell of the structure.
substitute_elements(key, elements, radius_type, change_label)Substitute all atoms of one or several elements.
-
delete_atoms(key: str | int | tuple | list =
None, elements: str | list[str] =[], site_indices: int | list[int] =[], change_label: bool =False) aim2dat.strct.Structure | aim2dat.strct.StructureCollection[source]¶ Delete atoms by element, list of elements, site index or list of site indices.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.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.
-
scale_unit_cell(key: str | int | tuple | list =
None, scaling_factor: float =1.0, change_label: bool =False) aim2dat.strct.Structure | aim2dat.strct.StructureCollection[source]¶ Scale unit cell of the structure.
-
substitute_elements(key: str | int | tuple | list =
None, elements: list[tuple[str]] | list[tuple[int]] =[], radius_type: str | None ='covalent', change_label: bool =False) aim2dat.strct.Structure | aim2dat.strct.StructureCollection[source]¶ Substitute all atoms of one or several elements.
- Parameters:¶
key (str, int, tuple or list) – Only used in the
StructureOperationsclass. Specifies the key or list/tuple of keys of the underlyingStructureCollectionobject.elements (list or tuple) – Tuple or list of tuples of the elements that are substituted.
radius_type (str or None (optional)) – Radius type used to calculate the scaling factor for the unit cell. If set to
Noneno scaling is applied. The default value iscovalent.
- Returns:¶
aim2dat.strct.Structure – Structure with substituted elements.
-
delete_atoms(key: str | int | tuple | list =