aiida_vibroscopy.calculations.spectra_utils#

Calcfunctions utils for spectra workflows.

Module Contents#

Functions#

boson_factor(→ float)

Return boson factor, i.e. (nb+1). Frequency in cm-1 and temperature in Kelvin.

compute_active_modes(→ tuple[list, list, list])

Get frequencies, normalized eigenvectors and irreducible representation labels.

compute_raman_space_average(→ tuple[list, list])

Return the space average for the polarized (HH) and depolarized (HV) configurations.

compute_raman_susceptibility_tensors(→ tuple[list, ...)

Return the Raman susceptibility tensors, frequencies (cm-1) and labels.

compute_polarization_vectors(→ tuple[list, list, list])

Return the polarization vectors, frequencies (cm-1) and labels.

compute_complex_dielectric(→ numpy.ndarray)

Return the frequency dependent complex dielectric function (tensor).

get_supercells_for_hubbard(→ dict)

Return a dictionary of supercells with displacements.

elaborate_susceptibility_derivatives(→ dict)

Return the susceptibility derivatives in the primitive cell.

generate_vibrational_data_from_forces(preprocess_data, ...)

Return a VibrationalFrozenPhononData node.

generate_vibrational_data_from_force_constants(...)

Return a VibrationalData node.

aiida_vibroscopy.calculations.spectra_utils.boson_factor(frequency: float, temperature: float) float[source]#

Return boson factor, i.e. (nb+1). Frequency in cm-1 and temperature in Kelvin.

aiida_vibroscopy.calculations.spectra_utils.compute_active_modes(phonopy_instance: phonopy.Phonopy, degeneracy_tolerance: float = 1e-05, nac_direction: list[float, float, float] | None = None, selection_rule: str | None = None, sr_thr: float = 0.0001, imaginary_thr: float = -5.0) tuple[list, list, list][source]#

Get frequencies, normalized eigenvectors and irreducible representation labels.

Raman and infrared active modes can be extracted using selection_rule.

Parameters:
  • nac_direction – (3,) shape list, indicating non analytical direction in Cartesian coordinates

  • selection_rule – str, can be raman or ir, it uses symmetry in the selection of the modes for a specific type of process

  • sr_thr – float, threshold for selection rule (the analytical value is 0)

  • imaginary_thr – threshold for activating warnings on negative frequencies (in cm^-1)

Returns:

tuple of (frequencies in cm-1, normalized eigenvectors, labels), normalized eigenvectors is an array of shape (num modes, num atoms, 3).

aiida_vibroscopy.calculations.spectra_utils.compute_raman_space_average(raman_susceptibility_tensors: numpy.ndarray) tuple[list, list][source]#

Return the space average for the polarized (HH) and depolarized (HV) configurations.

See e.g.:
  • Light scattering in solides II, M. Cardona

  • S. A. Prosandeev et al., Phys. Rev. B, 71, 214307 (2005)

Returns:

tuple of numpy.ndarray (intensities HH, intensities HV)

aiida_vibroscopy.calculations.spectra_utils.compute_raman_susceptibility_tensors(phonopy_instance: phonopy.Phonopy, raman_tensors: numpy.ndarray, nlo_susceptibility: numpy.ndarray = None, nac_direction: list[float, float, float] | None = None, use_irreps: bool = True, degeneracy_tolerance: float = 1e-05, sum_rules: bool = False) tuple[list, list, list][source]#

Return the Raman susceptibility tensors, frequencies (cm-1) and labels.

Note

  • Units of Raman susceptibility tensor are (Angstrom/4pi/AMU)^(1/2)

  • Unitcell volume for Raman tensor as normalization (in case non-primitive cell was used).

Parameters:
  • phonopy_instance – Phonopy instance with non-analytical constants included

  • nac_direction – non-analytical direction in Cartesian coordinates

  • raman_tensors – dChi/du in Cartesian coordinates (in 1/Angstrom)

  • nlo_susceptibility – non linear optical susceptibility in Cartesian coordinates (in pm/V)

  • use_irreps – whether to use irreducible representations in the selection of modes, defaults to True

  • degeneracy_tolerance – degeneracy tolerance for irreducible representation

  • sum_rules – whether to apply sum rules to the Raman tensors

Returns:

tuple of numpy.ndarray (Raman susc. tensors, frequencies, labels)

aiida_vibroscopy.calculations.spectra_utils.compute_polarization_vectors(phonopy_instance: phonopy.Phonopy, nac_direction: list[float, float, float] | None = None, use_irreps: bool = True, degeneracy_tolerance: float = 1e-05, sum_rules: bool = False, **kwargs) tuple[list, list, list][source]#

Return the polarization vectors, frequencies (cm-1) and labels.

Note

the unite for polarization vectors are in (debey/angstrom)/sqrt(AMU)

Parameters:
  • phonopy_instance – Phonopy instance with non-analytical constants included

  • nac_direction – non-analytical direction in Cartesian coordinates

  • use_irreps – whether to use irreducible representations in the selection of modes, defaults to True

  • degeneracy_tolerance – degeneracy tolerance for irreducible representation

  • sum_rules – whether to apply charge neutrality to effective charges

Returns:

tuple of numpy.ndarray (polarization vectors, frequencies, labels)

aiida_vibroscopy.calculations.spectra_utils.compute_complex_dielectric(phonopy_instance: phonopy.Phonopy, freq_range: str | numpy.ndarray = 'auto', gammas: float | list[float] = 12.0, nac_direction: None | list[float, float, float] = None, use_irreps: bool = True, degeneracy_tolerance: float = 1e-05, sum_rules: bool = False) numpy.ndarray[source]#

Return the frequency dependent complex dielectric function (tensor).

Parameters:
  • freq_range – frequency range in cm^-1; set to auto for automatic choice

  • gammas – list or single value of broadenings, i.e. full width at half maximum (FWHM)

  • nac_direction – (3,) shape list, indicating non analytical direction in Cartesian coordinates

  • use_irreps – whether to use irreducible representations in the selection of modes, defaults to True

  • degeneracy_tolerance – degeneracy tolerance for irreducible representation

  • sum_rules – whether to apply charge neutrality to effective charges

Returns:

(3, 3, num steps) shape numpy.ndarray, num steps refers to the number of frequency steps where the complex dielectric function is evaluated

aiida_vibroscopy.calculations.spectra_utils.get_supercells_for_hubbard(preprocess_data: aiida_phonopy.data.preprocess.PreProcessData, ref_structure) dict[source]#

Return a dictionary of supercells with displacements.

The supercells are obtained from the reference structure, preventing the case scenario of folded atoms. This is essential for extended Hubbard functionals which depends upon explicit positions in the cell. An atom folded would mean losing the interaction between first neighbours.

Returns:

a dict of StructureData or HubbardStructureData, labelled with supercell_{}, where {} is a number starting from 1.

aiida_vibroscopy.calculations.spectra_utils.elaborate_susceptibility_derivatives(preprocess_data: aiida_phonopy.data.preprocess.PreProcessData, raman_tensors=None, nlo_susceptibility=None) dict[source]#

Return the susceptibility derivatives in the primitive cell.

It uses the unique atoms referring to the supercell matrix.

Returns:

dict with keyword raman_tensors and nlo_susceptibility

aiida_vibroscopy.calculations.spectra_utils.generate_vibrational_data_from_forces(preprocess_data: aiida_phonopy.data.preprocess.PreProcessData, tensors: aiida.orm.ArrayData, forces_index: aiida.orm.Int = None, **forces_dict)[source]#

Return a VibrationalFrozenPhononData node.

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

Parameters:
  • tensorsArrayData with arraynames dielectric, born_charges and eventual raman_tensors, nlo_susceptibility

  • forces_indexInt if a TrajectoryData is given, in order to get the correct slice of the array. In aiida-quantumespresso it should be 0 or -1.

  • 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

Note

if residual forces would be stored, label it with 0 as suffix.

aiida_vibroscopy.calculations.spectra_utils.generate_vibrational_data_from_force_constants(preprocess_data, force_constants, tensors: aiida.orm.ArrayData)[source]#

Return a VibrationalData node.

Parameters:
  • force_constants – ArrayData with arrayname force_constants

  • tensors – ArrayData with arraynames dielectric, born_charges and eventual raman_tensors, nlo_susceptibility