aiida_phonopy.data.phonopy#

Module defining the class which wraps the phonopy.Phonopy main class.

Module Contents#

Classes#

PhonopyData

Class wrapping the phonopy.Phonopy class.

class aiida_phonopy.data.phonopy.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[source]#

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[source]#

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

property forces_index: int[source]#

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.