aiida_quantumespresso.data.force_constants#

Sub class of Data to handle interatomic force constants produced by the Quantum ESPRESSO q2r.x code.

Module Contents#

Classes#

ForceConstantsData

Class to handle interatomic force constants from the Quantum ESPRESSO q2r.x code.

Functions#

parse_q2r_force_constants_file(lines[, ...])

Parse the real-space interatomic force constants file from QE-Q2R.

class aiida_quantumespresso.data.force_constants.ForceConstantsData(file: str | pathlib.Path | IO, filename: str | pathlib.Path | None = None, **kwargs: Any)[source]#

Bases: aiida.orm.SinglefileData

Class to handle interatomic force constants from the Quantum ESPRESSO q2r.x code.

property number_of_species[source]#

Return the number of atom species.

Returns:

a scalar

property number_of_atoms[source]#

Return the number of atoms.

Returns:

a scalar

property cell[source]#

Return the crystal unit cell where rows are the crystal vectors.

Returns:

a 3x3 numpy.array

property atom_list[source]#

Return the list of atoms.

Returns:

a list of length-5 tuple (element name, element mass amu_ry, 3 coordinates in cartesian Angstrom)

property has_done_electric_field[source]#

Return flag to indicate if dielectric tensor and effective charges were computed.

Returns:

a boolean

property dielectric_tensor[source]#

Return the dielectric tensor matrix.

Returns:

a 3x3 tuple

property effective_charges_eu[source]#

Return the effective charges for each atom.

Returns:

a list of number_of_atoms elements, each being a 3x3 tuple

property qpoints_mesh[source]#

Return the number of q-points in each direction.

Returns:

a length-3 tuple

set_file(file, filename=None, **kwargs)[source]#

Add a file to the node, parse it and set the attributes found.

Parameters:
  • file – absolute path to the file or a filelike object

  • filename – specify filename to use (defaults to name of provided file).

aiida_quantumespresso.data.force_constants.parse_q2r_force_constants_file(lines, also_force_constants=False)[source]#

Parse the real-space interatomic force constants file from QE-Q2R.

Parameters:

also_force_constants – True to parse the force constants as well

Return parsed_data:

dictionary with the following keywords:

  • number_of_species: number of atom species (‘ntyp’ in QE)

  • number_of_atoms: number of atoms (‘nat’ in QE)

  • cell: unit cell

  • atom_list: list with, for each atom in the cell, a length-5 tuple of the form (element_name, mass_in_amu_ry, then 3 coordinates in cartesian & Angstroms)

  • has_done_electric_field: True if dielectric constants & effective charges were computed

  • dielectric_tensor: dielectric constant (3x3 matrix)

  • effective_charges_eu: effective charges (ntyp x 3 x 3 matrix)

  • qpoints_mesh: length-3 tuple with number of qpoints in each dimension of the reciprocal lattice

  • force_constants: the real-space force constants: array with 7 indices, of the kind

    C(mi1, mi2, mi3, ji1, ji2, na1, na2) with * (mi1, mi2, mi3): the supercell dimensions * (ji1, ji2): axis of the displacement of the two atoms (from 1 to 3) * (na1, na2): atom numbers in the cell.

  • warnings: a list of warnings

Return force_constants:

the real-space force constants: array with 7 indices, of the kind C(mi1, mi2, mi3, ji1, ji2, na1, na2) where: * (mi1, mi2, mi3): the supercell dimensions * (ji1, ji2): axis of the displacement of the two atoms (from 1 to 3) * (na1, na2): atom numbers in the cell.