EphmatSpin tutorial

In this section, we describe how to use Perturbopy to process a Perturbo 'ephmat_spin' calculation.

The 'ephmat_spin' calculation computes absolute values of the e-ph spin-flip matrix elements, summed over the number of electronic bands, given two lists of k-points and q-points. We first run the Perturbo calculation following the instructions on the Perturbo website and obtain the YAML file, ‘diam_ephmat_spin.yml’. For more information, please refer to the Perturbo website.

Next, we create the EphmatSpin object using the YAML file as an input. This object contains all of the information from the YAML file.

import perturbopy.postproc as ppy

# Example using the ephmat_spin calculation mode.
diam_ephmat_spin = ppy.EphmatSpin.from_yaml('diam_ephmat_spin.yml')

Accessing the data

The attributes in an EphmatSpin object have the same name and format as an object from the Ephmat. The k-points are stored in EphmatSpin.kpt, which is a RecipPtDB object. The data for the phonons is stored analogously in EphmatSpin.qpt (another RecipPtDB object) and EphmatSpin.phdisp, a UnitsDict object where the keys are the phonon mode and the values are the phonon energies computed across the q-points.

# Access the k-point coordinates. There is only one in this calculation.
# The units are in crystal coordinates.
diam_ephmat_spin.kpt.points
>> array([[0.],
          [0.],
          [0.]])

diam_ephmat_spin.kpt.units
>> 'crystal'

# There are 196 q-point coordinates (we display the first two below).
# The units are in crystal coordinates.
diam_ephmat_spin.qpt.points.shape
>> (3, 196)

diam_ephmat_spin.qpt.points[:, :2]
>> array([[0.5   , 0.4902],
          [0.5   , 0.4902],
          [0.5   , 0.4902]])

diam_ephmat_spin.qpt.units
>> 'crystal'

# Access the phonon energies, which are a UnitsDict.
# There are 6 modes, which are the keys of the dictionary.
diam_ephmat_spin.phdisp.keys()
>> dict_keys([1, 2, 3, 4, 5, 6])

# Phonon energies of the first 2 q-points in phonon mode 3.
diam_ephmat_spin.phdisp[3][:2]
>> array([130.41105408, 130.31173133])

diam_ephmat_spin.phdisp.units
>> 'meV'

Please see the section Handling k-points and q-points for more details on accessing information from EphmatSpin.kpt and EphmatSpin.qpt, such as labeling the k, q-points and converting to Cartesian coordinates.

The 'ephmat_spin' calculation interpolates the deformation potentials and e-ph elements from the spin-flip process which are stored in dictionaries EphmatSpin.defpot and EphmatSpin.ephmat, respectively. Both are UnitsDict objects. The keys represent the phonon mode, and the values are (num_kpoints x num_qpoints) size arrays.

# There are 6 keys, one for each mode.
diam_ephmat_spin.ephmat.keys()
>> dict_keys([1, 2, 3, 4, 5, 6])

# There is 1 k-point and 196 q-points, so the e-ph matrix is 1 x 196.
diam_ephmat_spin.ephmat[1].shape
>> (1, 196)

# The e-ph spin-flip matrix elements corresponding to the first
# phonon mode, first (and only) k-point, and first two q-points.
diam_ephmat_spin.ephmat[1][0, :2]
>> array([[5.37973306e-06, 2.51372197e+00]])

# Units for the e-ph spin-flip matrix elements are in meV.
diam_ephmat_spin.ephmat.units
>> 'meV'

# We can extract analogous information from the deformation potential.
diam_ephmat_spin.defpot[1].shape
>> (1, 196)

# Units for the deformation potential are in eV/A.
diam_ephmat_spin.defpot.units
>> 'eV/A'

Plotting the data

Please refer to the Ephmat tutorial for details on plotting the data.