aiida_phonopy.data#

DataTypes for handling phonopy and frozen phonons calculations.

Submodules#

Package Contents#

Classes#

RawData

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

ForceConstantsData

Self-contained class for force constants data and non-analytical constants.

PreProcessData

Class for pre-processing of frozen-phonon calculations.

PhonopyData

Class wrapping the phonopy.Phonopy class.

RawData

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

PreProcessData

Class for pre-processing of frozen-phonon calculations.

RawData

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

class aiida_phonopy.data.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#

Get the Phonopy version used.

property numbers: numpy.ndarray#

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

Returns:

(nat,) shaper array

property masses: numpy.ndarray#

Get the array of the atomic masses in the cell.

Returns:

(nat,) shape array

property positions: numpy.ndarray#

Get the array of the atomic positions in the cell.

Returns:

(nat, 3) shape array

property cell: numpy.ndarray#

Get the lattice matrix of the structure.

Returns:

(3,3) shape array

property magnetic_moments: list[int]#

Get the magnetic_moments array of the atoms in the cell.

property symbols: list[str]#

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

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

Get the periodic boundary conditions.

property names: list[str]#

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

property supercell_matrix: list#

Get the supercell_matrix.

Returns:

a (3,3) shape array

property primitive_matrix: list#

Get the primitive_matrix.

Returns:

a (3,3) shape array

property symprec: float#

Get the tolerance for symmetry analysis.

property is_symmetry: bool#

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#

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

property distinguish_kinds: bool#

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

property dielectric: numpy.ndarray | None#

Get the high-frequency dielectric tensor in Cartesian coordinates.

property born_charges: numpy.ndarray#

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.

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

Bases: aiida_phonopy.data.raw.RawData

Self-contained class for force constants data and non-analytical constants.

It stores also the structure information (unitcell, supercell, …), for a complete transferable data type.

property force_constants: numpy.ndarray#

Get force force constants matrix.

get_phonopy_instance(**kwargs)[source]#

Return a Phonopy object with force and nac parameters (if set).

Parameters:

kwargs

see aiida_phonopy.data.preprocess.PreProcessData.get_phonopy_instance() * symmetrize_nac: whether or not to symmetrize the nac parameters

using point group symmetry; bool, defaults to self.is_symmetry

  • factor_nac: factor for non-analytical corrections;

    float, defaults to Hartree*Bohr

set_force_constants(force_constants: list | numpy.ndarray)[source]#

Set force constants matrix.

Parameters:
  • force_constants – array of force constants matrix in compact or full format

  • type – (n_patom = atoms in primitive cell, n_satom = atoms in supercell) * Compact format: (n_patom, n_satom, 3, 3) * Full format: (n_satom, n_satom, 3, 3)

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

  • ValueError: if the format is not compatible

  • RuntimeError: if the displacement dataset was not initialize in input

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

Bases: aiida_phonopy.data.raw.RawData

Class for pre-processing of frozen-phonon calculations.

This class is designed for handling the pre-process information regarding a frozen phonon calculation using Phonopy. These regard the unitcell structure, the supercell and primitive matrix, as well as other symmetry information.

property displacement_dataset: dict | list | None#

Get the dispacement dataset in a readible format for phonopy.

If not set, None is returned.

property displacements: list | dict#

Get the displacements to apply to the supercell.

Returns:

array with displacements; can be type-I or type-II (see phonopy.Phonopy.displacements())

property calcfunctions#

Namespace to access the calcfunction utilities.

get_displacements() list | dict[source]#

Get the displacements to apply to the supercell.

set_displacements(distance: float = 0.01, is_plusminus: str = 'auto', is_diagonal: bool = True, is_trigonal: bool = False, number_of_snapshots: int | None = None, random_seed: int | None = None, temperature: float | None = None, cutoff_frequency: float | None = None)[source]#

Set displacements for frozen phonon calculation.

Refer to phonopy.Phonopy.generate_displacements() for a complete description of the inputs.

Thus, in the PreProcessData value different from zero will raise an error.

Raises:

ValueError – if the inputs are not compatible with phonopy standards

_set_displacements(value: list | dict)[source]#

Put in the repository the displacement dataset in json format.

set_displacements_from_dataset(dataset: dict | list)[source]#

Set displacements for frozen phonon calculation from a dataset.

Useful if you want to set displacements from a previously random generated displacement dataset, or for setting dataset for self-consistent harmonic approximation.

Parameters:

dataset – dictionary or array like (numpy or list), compatible with phonopy

Raises:

ValueError – if the inputs are not compatible with phonopy standards

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

Return a 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_supercells_with_displacements() dict[aiida.orm.StructureData][source]#

Get the supercells with displacements for frozen phonon calculation.

Returns:

dictionary with StructureData nodes, None if the displacement dataset has not been set

generate_displacement_dataset(distance: float = 0.01, is_plusminus: str = 'auto', is_diagonal: bool = True, is_trigonal: bool = False, number_of_snapshots: int | None = None, random_seed: int | None = None, temperature: float | None = None, cutoff_frequency: float | None = None)[source]#

Return the displacement dataset for frozen phonon calculation.

Refer to phonopy.Phonopy.generate_displacements() for a complete description of the inputs.

Raises:

ValueError – if the inputs are not compatible with phonopy standards

static generate_preprocess_data(structure: aiida.orm.StructureData, displacement_generator: dict | None = None, supercell_matrix: list | None = None, primitive_matrix: list | None = None, symprec: float | None = None, is_symmetry: bool | None = None, distinguish_kinds: bool | None = None)[source]#

Return a complete stored PreProcessData node.

Parameters:
  • structure (StructureData) – structure data node representing the unitcell

  • displacement_generator (orm.Dict) – dictionary containing the info for generating the displacements, defaults to phonopy default (see phonopy doc)

  • supercell_matrix (List, Optional) – supercell matrix, defaults to diag(1,1,1)

  • primitive_matrix (List, Optional) – primitive matrix, defaults to “auto”

  • symprec (Float, Optional) – symmetry precision on atoms, defaults to 1e-5

  • is_symmetry (Bool, Optional) – if using space group symmetry, defaults to True

  • distinguish_kinds (Bool, Optional) – if distinguish names of same specie by symmetry, defaults to True

Returns:

PreProcessData node

class aiida_phonopy.data.PhonopyData(preprocess_data: aiida_phonopy.data.preprocess.PreProcessData, **kwargs)[source]#

Bases: aiida_phonopy.data.preprocess.PreProcessData

Class wrapping the phonopy.Phonopy class.

It represents the final Data node status of a frozen phonon calculaiton. It stores information regarding the pre-processing, the displacements and forces dataset, and the (eventual) non-analytical constants.

property residual_forces: numpy.ndarray#

Get the residual forces calculated on the pristine (i.e. no displaced) supercell structure (if set).

..note: if you have specified the forces_index this will be used as well here.

property forces: numpy.ndarray#

Get forces for each supercell with displacements in the dataset as a unique array.

property forces_index: int#

Return the index of the forces to use.

set_displacements()[source]#

Set displacements cannot be accessed from PhonopyData.

set_displacements_from_dataset()[source]#

Set displacements cannot be accessed from PhonopyData.

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

Return a Phonopy object with forces and nac parameters (if set).

Parameters:
  • subtract_residual_forces (bool) – whether or not subract residual forces (if set)

  • kwargs

    see aiida_phonopy.data.preprocess.PreProcessData.get_phonopy_instance() * symmetrize_nac: whether or not to symmetrize the nac parameters

    using point group symmetry; bool, defaults to self.is_symmetry

    • factor_nac: factor for non-analytical corrections;

      float, defaults to Hartree*Bohr

set_residual_forces(forces: list | numpy.ndarray)[source]#

Set the residual forces of the pristine supercell.

Parameters:

forces – (atoms in supercell, 3) array shape

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

  • ValueError: if the format is not compatible

set_forces(sets_of_forces: list | numpy.ndarray | None = None, dict_of_forces: dict | None = None, forces_index: int | None = None)[source]#

Set forces per each supercell with displacement in the dataset.

Parameters:
  • sets_of_forces – a set of atomic forces in displaced supercells. The order of displaced supercells has to match with that in displacement dataset.

  • type – (supercells with displacements, atoms in supercell, 3) array shape

  • dict_of_forces – dictionary of forces, in numpy.ndarray to store for each displacement. They keys for the dictionary must be passed as forces_{num}, where num corresponds to the associated supercell in the dataset. num starts from 1.

  • forces_index – an integer storing in the database the index for forces. The dict_of_forces may be specified from TrajectoryData to reduce the amount of data saved in the repository. For example: forces_1 = [[actual array]] ==> forces_index = 0

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

  • ValueError: if the format is not compatible

  • RuntimeError: if the displacement dataset was not initialize in input

set_forces_index(value: int)[source]#

Set the forces_index attribute.

This is used for tacking a particular array index of each single forces set. This is useful to not duplicate data of e.g. trajectories.

class aiida_phonopy.data.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#

Get the Phonopy version used.

property numbers: numpy.ndarray#

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

Returns:

(nat,) shaper array

property masses: numpy.ndarray#

Get the array of the atomic masses in the cell.

Returns:

(nat,) shape array

property positions: numpy.ndarray#

Get the array of the atomic positions in the cell.

Returns:

(nat, 3) shape array

property cell: numpy.ndarray#

Get the lattice matrix of the structure.

Returns:

(3,3) shape array

property magnetic_moments: list[int]#

Get the magnetic_moments array of the atoms in the cell.

property symbols: list[str]#

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

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

Get the periodic boundary conditions.

property names: list[str]#

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

property supercell_matrix: list#

Get the supercell_matrix.

Returns:

a (3,3) shape array

property primitive_matrix: list#

Get the primitive_matrix.

Returns:

a (3,3) shape array

property symprec: float#

Get the tolerance for symmetry analysis.

property is_symmetry: bool#

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#

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

property distinguish_kinds: bool#

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

property dielectric: numpy.ndarray | None#

Get the high-frequency dielectric tensor in Cartesian coordinates.

property born_charges: numpy.ndarray#

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.

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

Bases: aiida_phonopy.data.raw.RawData

Class for pre-processing of frozen-phonon calculations.

This class is designed for handling the pre-process information regarding a frozen phonon calculation using Phonopy. These regard the unitcell structure, the supercell and primitive matrix, as well as other symmetry information.

property displacement_dataset: dict | list | None#

Get the dispacement dataset in a readible format for phonopy.

If not set, None is returned.

property displacements: list | dict#

Get the displacements to apply to the supercell.

Returns:

array with displacements; can be type-I or type-II (see phonopy.Phonopy.displacements())

property calcfunctions#

Namespace to access the calcfunction utilities.

get_displacements() list | dict[source]#

Get the displacements to apply to the supercell.

set_displacements(distance: float = 0.01, is_plusminus: str = 'auto', is_diagonal: bool = True, is_trigonal: bool = False, number_of_snapshots: int | None = None, random_seed: int | None = None, temperature: float | None = None, cutoff_frequency: float | None = None)[source]#

Set displacements for frozen phonon calculation.

Refer to phonopy.Phonopy.generate_displacements() for a complete description of the inputs.

Thus, in the PreProcessData value different from zero will raise an error.

Raises:

ValueError – if the inputs are not compatible with phonopy standards

_set_displacements(value: list | dict)[source]#

Put in the repository the displacement dataset in json format.

set_displacements_from_dataset(dataset: dict | list)[source]#

Set displacements for frozen phonon calculation from a dataset.

Useful if you want to set displacements from a previously random generated displacement dataset, or for setting dataset for self-consistent harmonic approximation.

Parameters:

dataset – dictionary or array like (numpy or list), compatible with phonopy

Raises:

ValueError – if the inputs are not compatible with phonopy standards

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

Return a 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_supercells_with_displacements() dict[aiida.orm.StructureData][source]#

Get the supercells with displacements for frozen phonon calculation.

Returns:

dictionary with StructureData nodes, None if the displacement dataset has not been set

generate_displacement_dataset(distance: float = 0.01, is_plusminus: str = 'auto', is_diagonal: bool = True, is_trigonal: bool = False, number_of_snapshots: int | None = None, random_seed: int | None = None, temperature: float | None = None, cutoff_frequency: float | None = None)[source]#

Return the displacement dataset for frozen phonon calculation.

Refer to phonopy.Phonopy.generate_displacements() for a complete description of the inputs.

Raises:

ValueError – if the inputs are not compatible with phonopy standards

static generate_preprocess_data(structure: aiida.orm.StructureData, displacement_generator: dict | None = None, supercell_matrix: list | None = None, primitive_matrix: list | None = None, symprec: float | None = None, is_symmetry: bool | None = None, distinguish_kinds: bool | None = None)[source]#

Return a complete stored PreProcessData node.

Parameters:
  • structure (StructureData) – structure data node representing the unitcell

  • displacement_generator (orm.Dict) – dictionary containing the info for generating the displacements, defaults to phonopy default (see phonopy doc)

  • supercell_matrix (List, Optional) – supercell matrix, defaults to diag(1,1,1)

  • primitive_matrix (List, Optional) – primitive matrix, defaults to “auto”

  • symprec (Float, Optional) – symmetry precision on atoms, defaults to 1e-5

  • is_symmetry (Bool, Optional) – if using space group symmetry, defaults to True

  • distinguish_kinds (Bool, Optional) – if distinguish names of same specie by symmetry, defaults to True

Returns:

PreProcessData node

class aiida_phonopy.data.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#

Get the Phonopy version used.

property numbers: numpy.ndarray#

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

Returns:

(nat,) shaper array

property masses: numpy.ndarray#

Get the array of the atomic masses in the cell.

Returns:

(nat,) shape array

property positions: numpy.ndarray#

Get the array of the atomic positions in the cell.

Returns:

(nat, 3) shape array

property cell: numpy.ndarray#

Get the lattice matrix of the structure.

Returns:

(3,3) shape array

property magnetic_moments: list[int]#

Get the magnetic_moments array of the atoms in the cell.

property symbols: list[str]#

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

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

Get the periodic boundary conditions.

property names: list[str]#

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

property supercell_matrix: list#

Get the supercell_matrix.

Returns:

a (3,3) shape array

property primitive_matrix: list#

Get the primitive_matrix.

Returns:

a (3,3) shape array

property symprec: float#

Get the tolerance for symmetry analysis.

property is_symmetry: bool#

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#

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

property distinguish_kinds: bool#

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

property dielectric: numpy.ndarray | None#

Get the high-frequency dielectric tensor in Cartesian coordinates.

property born_charges: numpy.ndarray#

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.