aiida_vibroscopy.calculations.symmetry
#
Symmetry utils for vectors and tensors, and for pre/post analysis.
Module Contents#
Functions#
|
Tensor transformation. |
|
Symmetrize a 3rd rank tensor using symmetry operations in the lattice. |
|
Symmetrize \(\frac{d \chi}{dr}\) tensors. |
|
Symmetrize susceptibility derivatives tensors (\(d\chi /dr\) and \(\chi^{(2)}\)). |
Return symmetry equivalent electric field direction (always with zeros ones). |
|
|
Transform and return the TrajectoryData using rotation and traslation symmetry operations. |
|
Return the full dictionary with transformed TrajectoryData using symmetry operation. |
|
Return independent numbers and corresponding sign to run. |
- aiida_vibroscopy.calculations.symmetry.tensor_3rd_rank_transformation(rot: list[tuple[float, float, float]] | numpy.ndarray, mat: list[list[tuple[float, float, float]]] | numpy.ndarray) numpy.ndarray [source]#
Tensor transformation.
- Parameters:
rot – rotation transformation matrix, shape (3,3)
mat – tensor to be transformed, shape (3,3,3)
- Returns:
transformed (3,3,3) tensor
- aiida_vibroscopy.calculations.symmetry.symmetrize_3nd_rank_tensor(tensor: list[list[tuple[float, float, float]]] | numpy.ndarray, symmetry_operations: tuple[list[list[float, float, float]]] | numpy.ndarray, lattice: list[tuple[float, float, float]] | numpy.ndarray) numpy.ndarray [source]#
Symmetrize a 3rd rank tensor using symmetry operations in the lattice.
- Parameters:
tensor – tensor to be symmetrized, shape (3,3,3)
symmetry_operations – list of rotation matrices in crystal coordinates, each of shape (3,3)
lattice – the lattice in Cartesian coordinates as a (3,3) shape array
- Returns:
new symmetrized tensor, (3,3,3) shape
- aiida_vibroscopy.calculations.symmetry.take_average_of_dph0(dchi_ph0: numpy.ndarray, rotations: List[numpy.ndarray], translations: List[numpy.ndarray], cell: numpy.ndarray, symprec: float) numpy.ndarray [source]#
Symmetrize \(\frac{d \chi}{dr}\) tensors.
Symmetrize in respect to space group symmetries and applies sum rules. See e.g. M. Veiten et al., PRB, 71, 125107, (2005).
- Parameters:
dchi_ph0 – the (nat, 3,3,3) tensor, second index referring to atomic displacements
rotations – list of symmetry rotations in crystal coordinates
translations – list of symmetry translations in crystal coordinates, associated with the rotations (that form the space group symmetries)
cell – reference cell in Cartesian coordinates and in Angstrom
symprec – symmetry precision tolerance
- Returns:
newly fully symmetrized by space group Raman tensors, shape (nat, 3, 3, 3)
- aiida_vibroscopy.calculations.symmetry.symmetrize_susceptibility_derivatives(raman_tensors: numpy.ndarray, nlo_susceptibility: numpy.ndarray, ucell: numpy.ndarray, primitive_matrix: numpy.ndarray | None = None, primitive: numpy.ndarray | None = None, supercell_matrix: numpy.ndarray | None = None, symprec: float = 1e-05, is_symmetry: bool = True)[source]#
Symmetrize susceptibility derivatives tensors (\(d\chi /dr\) and \(\chi^{(2)}\)).
- Parameters:
raman_tensors – array_like \(d\chi /dr\) tensors, shape=(unitcell_atoms, 3, 3, 3). Convention is to have the symmetric elements over the 2 and 3 indices, i.e. \([I,k,i,j] = [I,k,j,i] \iff k\) is the index of the displacement.
nlo_susceptibility – array_like \(\chi^{(2)}\) tensors, shape=(3, 3, 3)
ucell – PhonopyAtoms unit cell
primitive_matrix – primitive matrix. This is used to select \(d\chi /dr\) tensors in primitive cell. If None (default), \(d\chi /dr\) tensors in unit cell are returned. shape=(3, 3)
primitive – a PhonopyAtoms instance; this is an alternative of giving primitive_matrix (Mp). Mp is given as \(M_p = (a_u, b_u, c_u)^{-1} \cdot (a_p, b_p, c_p)\). In addition, the order of atoms is alined to those of atoms in this primitive cell for Born effective charges. No rigid rotation of crystal structure is assumed.
supercell_matrix – supercell matrix. This is used to select Born effective charges in primitive cell. Supercell matrix is needed because primitive cell is created first creating supercell from unit cell, then the primitive cell is created from the supercell. If None (defautl), 1x1x1 supercell is created. shape=(3, 3)
symprec – symmetry tolerance. Default is 1e-5
is_symmetry – by setting False, symmetrization can be switched off. Default is True.
- Returns:
symmetrized tensors (\(d\chi /dr\), \(\chi^{(2)}\))
- aiida_vibroscopy.calculations.symmetry.get_connected_fields_with_operations(phonopy_instance: phonopy.Phonopy, field_direction: tuple[int, int, int]) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] [source]#
Return symmetry equivalent electric field direction (always with zeros ones).
- Parameters:
field_direction – (3,) shape list
- Returns:
tuple containing equivalent fields and associated rotations and translations
- aiida_vibroscopy.calculations.symmetry.transform_trajectory(trajectory_data: aiida.orm.TrajectoryData, polarisation_0: numpy.ndarray, rotation: numpy.ndarray, translation: numpy.ndarray, cell: phonopy.structure.cells.PhonopyAtoms, symprec: float) aiida.orm.TrajectoryData [source]#
Transform and return the TrajectoryData using rotation and traslation symmetry operations.
Only forces and electronic_dipole_cartesian_axes are transformed.
- aiida_vibroscopy.calculations.symmetry.get_trajectories_from_symmetries(preprocess_data: aiida_phonopy.data.PreProcessData, data: dict, data_0: aiida.orm.TrajectoryData, accuracy_order: int) dict [source]#
Return the full dictionary with transformed TrajectoryData using symmetry operation.
Only forces and electronic_dipole_cartesian_axes are transformed.
- Returns:
dict following the standard conventions:
main fields are named field_index_{index}
secondary fields have {number}, where number refer to the coeffient for the numerical derivation
- aiida_vibroscopy.calculations.symmetry.get_irreducible_numbers_and_signs(preprocess_data: aiida_phonopy.data.PreProcessData, number_id: int) tuple[list[int], list[tuple[int, int]]] [source]#
Return independent numbers and corresponding sign to run.
- Parameters:
number_id – 3 or 6 for second or third order derivatives, respectively.
- Returns:
tuple with elements:
- List of independent numbers.
2 and 3 are favourite in respect to the other directions, as they have a better implementation in Quantum ESPRESSO
- A second list of lists
each containing two bools, one per sign, respectively -1 and +1.