aiida_phonopy.calculations.functions.data_utils#

Calcfunctions Utils for aiida-phonopy DataTypes.

Module Contents#

Classes#

CalcfunctionMixin

Set of calcfunctions to be called from the aiida-phonopy DataTypes.

Functions#

get_unitcell(→ aiida.orm.StructureData)

Get the unitcell of a PreProcessData as a StructureData.

get_primitive(→ aiida.orm.StructureData)

Get the primitive cell of a PreProcessData as a StructureData.

get_supercell(→ aiida.orm.StructureData)

Get the supercell (pristine) of a PreProcessData as a StructureData.

get_supercells_with_displacements(→ dict)

Get the supercells with displacements of a PreProcessData as a StructureData.

get_displacements(→ aiida.orm.ArrayData)

Get the displacements of a PreProcessData as an ArrayData with array name displacements.

generate_preprocess_data(structure[, ...])

Return a complete stored PreProcessData node.

get_preprocess_with_new_displacements(preprocess_data, ...)

Get a new PreProcessData from an old one from new displacement generator settings.

generate_phonopy_data(preprocess_data[, ...])

Create a PhonopyData node from a PreProcess(Phonopy)Data node.

aiida_phonopy.calculations.functions.data_utils.get_unitcell(preprocess_data) aiida.orm.StructureData[source]#

Get the unitcell of a PreProcessData as a StructureData.

aiida_phonopy.calculations.functions.data_utils.get_primitive(preprocess_data) aiida.orm.StructureData[source]#

Get the primitive cell of a PreProcessData as a StructureData.

aiida_phonopy.calculations.functions.data_utils.get_supercell(preprocess_data) aiida.orm.StructureData[source]#

Get the supercell (pristine) of a PreProcessData as a StructureData.

aiida_phonopy.calculations.functions.data_utils.get_supercells_with_displacements(preprocess_data) dict[source]#

Get the supercells with displacements of a PreProcessData as a StructureData.

aiida_phonopy.calculations.functions.data_utils.get_displacements(preprocess_data) aiida.orm.ArrayData[source]#

Get the displacements of a PreProcessData as an ArrayData with array name displacements.

aiida_phonopy.calculations.functions.data_utils.generate_preprocess_data(structure: aiida.orm.StructureData, displacement_generator: aiida.orm.Dict | None = None, supercell_matrix: aiida.orm.List | None = None, primitive_matrix: aiida.orm.List | aiida.orm.Str | None = None, symprec: aiida.orm.Float | None = None, is_symmetry: aiida.orm.Bool | None = None, distinguish_kinds: aiida.orm.Bool | None = None)[source]#

Return a complete stored PreProcessData node.

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

  • displacement_generator (Dict) – dictionary containing the info for generating the displacements

  • 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

aiida_phonopy.calculations.functions.data_utils.get_preprocess_with_new_displacements(preprocess_data, displacement_generator: aiida.orm.Dict)[source]#

Get a new PreProcessData from an old one from new displacement generator settings.

aiida_phonopy.calculations.functions.data_utils.generate_phonopy_data(preprocess_data, nac_parameters: aiida.orm.ArrayData | None = None, forces_index: aiida.orm.Int | None = None, **forces_dict)[source]#

Create a PhonopyData node from a PreProcess(Phonopy)Data node.

Forces must be passed as kwargs, since we are calling a calcfunction with a variable number of supercells forces.

Parameters:
  • nac_parameters – ArrayData containing ‘dielectric’ and ‘born_charges’ as arrays with their correct shape

  • forces_index – Int if a TrajectoryData is given, in order to get the correct slice of the array.

  • forces_dict

    dictionary of supercells forces as ArrayData stored as forces, each Data labelled in the dictionary in the format forces_{suffix}. The prefix is common and the suffix corresponds to the suffix number of the supercell with displacement label given from the get_supercells_with_displacements method.

    For example:

    {‘forces_1’:ArrayData, ‘forces_2’:ArrayData} <==> {‘supercell_1’:StructureData, ‘supercell_2’:StructureData} and forces in each ArrayData stored as ‘forces’, i.e. ArrayData.get_array(‘forces’) must not raise error

class aiida_phonopy.calculations.functions.data_utils.CalcfunctionMixin(data_node)[source]#

Set of calcfunctions to be called from the aiida-phonopy DataTypes.

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

Get the unitcell as a StructureData through a calfunction.

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

Get the primitive cell as a StructureData through a calfunction.

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

Get the supercell (pristine) as a StructureData through a calfunction.

get_supercells_with_displacements() dict[source]#

Get the supercells with displacements as a StructureData through a calfunction.

get_displacements() aiida.orm.ArrayData[source]#

Get the displacements as an ArrayData through a calfunction.

get_preprocess_with_new_displacements(displacement_generator: aiida.orm.Dict)[source]#

Create a PreProcessData node from a PreProcess/PhonopyData with a new set of displacements.

Parameters:

displacement_generator – a storable dictionary

generate_phonopy_data(nac_parameters: aiida.orm.ArrayData | None = None, forces_index: aiida.orm.Int | None = None, **forces_dict)[source]#

Create a PhonopyData node from a PreProcess(Phonopy)Data node.

Forces must be passed as kwargs, since we are calling a calcfunction with a variable number of supercells forces.

Parameters:
  • nac_parameters – ArrayData containing ‘dielectric’ and ‘born_charges’ as arrays with their correct shape

  • forces_index – Int if a TrajectoryData is given, in order to get the correct slice of the array.

  • forces_dict

    dictionary of supercells forces as ArrayData stored as forces, each Data labelled in the dictionary in the format {prefix}_{suffix}. The prefix is common and the suffix corresponds to the suffix number of the supercell with displacement label given from the get_supercells_with_displacements method

    For example:

    {‘forces_1’:ArrayData, ‘forces_2’:ArrayData} goes along with {‘supercell_1’:StructureData, ‘supercell_2’:StructureData} and forces in each ArrayData stored as ‘forces’, i.e. ArrayData.get_array(‘forces’) must not raise error