aiida_phonopy.data.raw#

Module defining the base class for other Data types.

Module Contents#

Classes#

RawData

Base class containing the information for the other phonon related data types.

Functions#

_get_valid_matrix(→ numpy.ndarray)

Get and validate the supercell_matrix and primitive_matrix inputs.

aiida_phonopy.data.raw._get_valid_matrix(matrix: list | numpy.ndarray) numpy.ndarray[source]#

Get and validate the supercell_matrix and primitive_matrix inputs.

Parameters:

matrix (list, List, numpy.ndarray) – (3,1) or (3,3) shape array

Returns:

a (3,3) numpy.ndarray

Raises:
  • TypeError: if it is not a valid array type and if the array does not contain only numbers

  • ValueError: if the array is not of the correct shape

class aiida_phonopy.data.raw.RawData(structure: aiida.orm.StructureData | None = None, phonopy_atoms: phonopy.structure.cells.PhonopyAtoms | None = None, supercell_matrix: list | None = None, primitive_matrix: list | str | None = None, symprec: float = 1e-05, is_symmetry: bool = True, distinguish_kinds: bool = True, **kwargs)[source]#

Bases: aiida.orm.nodes.data.ArrayData

Base class containing the information for the other phonon related data types.

property phonopy_version: str[source]#

Get the Phonopy version used.

property numbers: numpy.ndarray[source]#

Get the array corresponding to the atomic number in periodic table of the sturcture.

Returns:

(nat,) shaper array

property masses: numpy.ndarray[source]#

Get the array of the atomic masses in the cell.

Returns:

(nat,) shape array

property positions: numpy.ndarray[source]#

Get the array of the atomic positions in the cell.

Returns:

(nat, 3) shape array

property cell: numpy.ndarray[source]#

Get the lattice matrix of the structure.

Returns:

(3,3) shape array

property magnetic_moments: list[int][source]#

Get the magnetic_moments array of the atoms in the cell.

property symbols: list[str][source]#

Get the chemical symbols array of the atoms in the cell.

property pbc: tuple[int, int, int][source]#

Get the periodic boundary conditions.

property names: list[str][source]#

Get the custom names array of the atoms in the cell.

property supercell_matrix: list[source]#

Get the supercell_matrix.

Returns:

a (3,3) shape array

property primitive_matrix: list[source]#

Get the primitive_matrix.

Returns:

a (3,3) shape array

property symprec: float[source]#

Get the tolerance for symmetry analysis.

property is_symmetry: bool[source]#

Get is_symmetry value.

It refers to whether Phonopy will use symmetries to reduce the number of displacements for frozen phonons.

property kinds_map: dict | None[source]#

Get the map bewtween of the numbers and the symbols and names.

property distinguish_kinds: bool[source]#

Get whether or not kinds with same chemical symbol will be distinguished by symmetry.

property dielectric: numpy.ndarray | None[source]#

Get the high-frequency dielectric tensor in Cartesian coordinates.

property born_charges: numpy.ndarray[source]#

Get the effective Born charges tensors in Cartesian coordinates.

..note:
The indecis refers to:
  1. Atomic index.

  2. Polarization index.

  3. Atomic displacement index.

Returns:

numpy.ndarray, shape (num primitive cell atoms, 3, 3)

_set_phonopy_version()[source]#

Set the installed Phonopy version.

_set_unitcell_attributes(phonopy_atoms: phonopy.structure.cells.PhonopyAtoms, pbc: tuple[bool, bool, bool])[source]#

Set the attributes for full reproducibility of the PhonopyAtoms class.

_set_symbols_and_names()[source]#

Set the symbols and names.

_set_supercell_matrix(value: list | numpy.ndarray)[source]#

Set the Phonopy supercell matrix.

Parameters:

value (list, List, numpy.ndarray) – (3,3) or (3,1) shape array

Raises:

ModificationNotAllowed – if object is already stored

_set_primitive_matrix(value: list | numpy.ndarray | str)[source]#

Set the primitive matrix.

Parameters:

value (list, List, numpy.ndarray, str) – (3,3) or (3,1) shape array, or ‘auto”

Raises:

ModificationNotAllowed – if object is already stored

_set_symprec(value: float)[source]#

Set the symmetry tolerance.

Parameters:

value – tolerance for symmetry analysis. Check that you get

the right symmetry of your structure before starting any calculation. Default is 1e-05. :type value: float :raises:

  • ModificationNotAllowed: if object is already stored

  • TypeError: if the input is not of type float

_set_is_symmetry(value: bool)[source]#

Set whether to use the symmetries.

Use with care and if you know what your are doing.

Parameters:

value (bool) – whether to use or not the symmetries. Deafault is True.

Raises:
  • ModificationNotAllowed: if object is already stored

  • TypeError: if the input is not of type bool

_set_kinds_map(value: dict)[source]#

Set the kind names map between the PhonopyAtoms unitcell and a reference structure.

This is needed since PhonopyAtoms does not support kind names. This attribute allows to get proper StructureData supercells with displacements.

Parameters:

value – tuple with two dictionaries (numbers_to_names, numbers_to_symbols)

_set_distinguish_kinds(value: bool)[source]#

Set whether or not to distinguish kinds.

_get_phonopy_atoms_unitcell(distinguish_kinds: bool) phonopy.structure.cells.PhonopyAtoms[source]#

Get the PhonopyAtoms object using the internal attributes.

get_phonopy_instance(symmetrize_nac: bool | None = None, factor_nac: float | None = None, **kwargs) phonopy.Phonopy[source]#

Return a phonopy.Phonopy object with the current values.

Parameters:
  • symmetrize_nac (bool) – whether or not to symmetrize the nac parameters using point group symmetry; defaults to self.is_symmetry

  • factor_nac (float) – factor for non-analytical corrections; defaults to Hartree*Bohr

  • kwargs – for internal use to set the primitive cell

get_unitcell() aiida.orm.StructureData[source]#

Get the unitcell as StructureData (not stored).

get_primitive_cell() aiida.orm.StructureData[source]#

Get the primitive cell as StructureData (not stored).

get_supercell() aiida.orm.StructureData[source]#

Get the pristine supercell as StructureData (not stored).

get_cells_mappings() dict[dict[list]][source]#

Return a dictionary containing the mappings among unit-, super- and primitive cell.

Returns:

dictionary with the following key:pair structure: * primitive: {p2p_map: list, p2s_map: list, s2p_map: list} * supercell: {u2u_map: list, u2s_map: list, s2u_map: list}

set_dielectric(dielectric: list | numpy.ndarray)[source]#

Set the high-frequency dielectric tensor in Cartesian coordinates.

Parameters:

dielectric – (3, 3) array like

Raises:
  • TypeError: if the format is not compatible or of the correct type

  • ValueError: if the format is not compatible or of the correct type

set_born_charges(born_charges: list | numpy.ndarray)[source]#

Set the Born effective charge tensors in Cartesian coordinates.

..note:
The indecis refers to:
  1. Atomic index.

  2. Polarization index.

  3. Atomic displacement index.

Parameters:

born_charges – (number of atoms in the primitive cell, 3, 3) shape array like

Raises:
  • TypeError: if the format is not compatible or of the correct type

  • ValueError: if the format is not compatible or of the correct type

has_nac_parameters() bool[source]#

Return wheter or not the Data has non-analytical constants.

_if_can_modify()[source]#

Check if the object is stored and raise an error if so. To use in every setter.