EPWpy.QE.band_util#
Classes
|
Utility class for handling band structure data from Quantum ESPRESSO (QE) outputs. |
- class EPWpy.QE.band_util.BandUtil(system, prefix, scf_file='scf', scf_fold='scf', nscf_file='nscf', nscf_fold='nscf', ph_file='ph', ph_fold='ph', bs_fold='bs', bs_file='bs', epw_fold='epw', epw_file='epw')[source]#
Bases:
objectUtility class for handling band structure data from Quantum ESPRESSO (QE) outputs.
This class provides convenient access to file and directory information associated with band structure, phonon, and EPW calculations, allowing downstream tools to locate and process relevant outputs.
- system#
Name of the system or material (used as the main working directory).
- Type:
str
- prefix#
Common prefix used in Quantum ESPRESSO input/output files.
- Type:
str
- scf_file#
Name of the self-consistent field (SCF) input/output file (default: 'scf').
- Type:
str
- scf_fold#
Folder containing SCF calculation results (default: 'scf').
- Type:
str
- nscf_file#
Name of the non-self-consistent field (NSCF) input/output file (default: 'nscf').
- Type:
str
- nscf_fold#
Folder containing NSCF calculation results (default: 'nscf').
- Type:
str
- ph_file#
Name of the phonon input/output file (default: 'ph').
- Type:
str
- ph_fold#
Folder containing phonon calculation results (default: 'ph').
- Type:
str
- bs_file#
Name of the band structure input/output file (default: 'bs').
- Type:
str
- bs_fold#
Folder containing band structure calculation results (default: 'bs').
- Type:
str
- epw_file#
Name of the EPW input/output file (default: 'epw').
- Type:
str
- epw_fold#
Folder containing EPW calculation results (default: 'epw').
- Type:
str
Examples
>>> bands = BandUtil(system='si', prefix='si') >>> print(bands.bs_fold) 'bs' >>> print(bands.scf_file) 'scf'
- get_band_EPW(file=None)[source]#
Retrieve the interpolated band structure from an EPW calculation.
This method reads the EPW-generated
band.eigfile and extracts eigenvalues and k-points using thebnd.extract_band_eigutility function.- Parameters:
file (str, optional) -- Path to the EPW band structure eigenvalue file. Defaults to
{system}/{epw_fold}/band.eig.- Returns:
Band_EPW -- Extracted EPW band structure data with shape
(nk, nband).- Return type:
object
Examples
>>> bu = BandUtil(system='si', prefix='si') >>> bands_epw = bu.get_band_EPW() >>> print(bands_epw.eigenvalues[:5]) [ -5.78, -5.77, -5.75, -5.70, -5.68 ]
- get_band_QE(file=None)[source]#
Retrieve the band structure data from a Quantum ESPRESSO output file.
This method reads the QE band structure output (typically from
bs.out) and extracts eigenvalues and k-points using thebnd.extract_band_scfutility function.- Parameters:
file (str, optional) -- Path to the QE bandstructure output file. If not provided, it defaults to
{system}/{bs_fold}/{bs_file}.out.- Returns:
Band_QE -- Extracted band structure data with shape
(nk, nband).- Return type:
object
Examples
>>> bu = BandUtil(system='si', prefix='si') >>> bands = bu.get_band_QE() >>> print(bands.eigenvalues.shape) (50, 10)
- get_eff_mass(grid, file=None, nmax=5)[source]#
Get the effective mass tensor using FT method nmax = nmax nk1 = grid[0] nk2 = grid[1] nk3 = grid[2]
- if file is None:
file = f'{self.system}/{self.nscf_fold}/{self.nscf_file}.out'
band = self.get_band_QE(f'{file}') kx=[1,0,0] ky=[0,1,0] kz=[0,0,0]
h=np.linspace(0.0,1,nk1,endpoint=False) k=np.linspace(0.0,1,nk2,endpoint=False) l=np.linspace(0.0,1,nk3,endpoint=False)
kpoints = np.array(k_mesh(h,k,l,kx,ky,kz))
print(np.shape(band),np.shape(kpoints))
interp_func, coeffs, Gints = fourier_fit(band,kpoints[:,:3], nmax = nmax)
qe = QE_XML("si/bs/si.xml") # or your file name qe.summary() kpts = qe.get_kpoints() eigs = qe.get_eigenvalues() cell = qe.get_lattice() kpoints_crys = kpoints_2pi_alat_to_fractional(kpts, cell, 10.262000) band_dft = extract_band_scf('si/bs/bs.out')
band = []
- for kpt in kpoints_crys:
band.append(interp_func(kpt))
band = np.array(band) for ib in range(len(band[0,0,:])):
plt.plot(band[:,0,ib],color = 'k') plt.plot(band_dft[:,ib],color = 'crimson')
bvecs = recoproc_lat_cart(cell) min_arg = np.argmin(band[:,0,4]) print(effective_mass_tensor(kpoints_crys[min_arg,:], coeffs, Gints, cell*bohr2m, band = 3))
print(np.shape(band))
- get_phonon_EPW(file=None)[source]#
Retrieve the phonon dispersion data interpolated by EPW.
This method reads the phonon frequency file
phband.freqgenerated by EPW, which contains interpolated phonon frequencies along a specified q-path.- Parameters:
file (str, optional) -- Path to the EPW phonon frequency file. Defaults to
{system}/{epw_fold}/phband.freq.- Returns:
epw_ph_band -- Extracted EPW phonon band frequencies with shape
(nq, nmode)in THz.- Return type:
ndarray
Examples
>>> bu = BandUtil(system='si', prefix='si') >>> epw_ph = bu.get_phonon_EPW() >>> print(epw_ph.shape) (200, 6)
- get_phonon_QE(file=None)[source]#
Retrieve the phonon dispersion data from Quantum ESPRESSO.
This method reads the phonon frequency data from the
matdyn.freqfile (typically produced bymatdyn.x) and converts frequencies from meV to THz using a conversion factor of 0.124.- Parameters:
file (str, optional) -- Path to the phonon frequency file. Defaults to
{system}/{ph_fold}/{prefix}.freq.- Returns:
ph_band -- Extracted phonon band frequencies with shape
(nq, nmode), expressed in meV.- Return type:
ndarray
Notes
The conversion factor
0.124converts from cm^-1 → meVExamples
>>> bu = BandUtil(system='si', prefix='si') >>> ph = bu.get_phonon_QE() >>> print(ph.shape) (120, 6)
- plot_band_EPW(file=None, **kwargs)[source]#
Plot the interpolated electronic band structure obtained from EPW.
This method reads the EPW-interpolated bandstructure data (typically from
band.eig), aligns the bands to the Fermi level, and visualizes the interpolated dispersion using the internal plotting utility.- Parameters:
file (str, optional) -- Path to the EPW bandstructure file. Defaults to
{system}/{epw_fold}/band.eig.**kwargs (dict, optional) -- Additional keyword arguments passed to the plotting function
plb.plot_band_prod(e.g., color, linewidth, figsize). Supported keys include: -xlabel: str, label for x-axis (default: "Wavevector") -ylabel: str, label for y-axis (default: "Energy (eV)")
Notes
The band structure is read from EPW’s interpolation output file (
band.eig), typically generated after Wannier interpolation.The Fermi level is automatically extracted from the SCF output file (
{system}/{scf_fold}/{scf_file}.out).The energy axis is shifted such that the Fermi level corresponds to 0 eV.
Example
>>> bu = BandUtil(system='graphene', prefix='gr') >>> bu.plot_band_EPW(color_c='red', linewidth=1.0, xlabel='k-path', ylabel='Energy (eV)')
- plot_band_QE(file=None, **kwargs)[source]#
Plot the electronic band structure obtained from Quantum ESPRESSO.
This method reads the Quantum ESPRESSO bandstructure output file (typically
bs.out), extracts the band data, aligns it with the Fermi level, and plots the band structure using the built-in plotting utilities.- Parameters:
file (str, optional) -- Path to the Quantum ESPRESSO bandstructure output file. Defaults to
{system}/{bs_fold}/{bs_file}.out.**kwargs (dict, optional) -- Additional keyword arguments passed to the plotting function
plb.plot_band_prod(e.g., color, linewidth, figsize). Supported keys include: -xlabel: str, label for x-axis (default: "Wavevector") -ylabel: str, label for y-axis (default: "Energy (eV)")
Notes
The Fermi level is automatically extracted from the SCF output file (
{system}/{scf_fold}/{scf_file}.out).The energy axis is shifted such that the Fermi level is set to 0 eV.
Example
>>> bu = BandUtil(system='si', prefix='si') >>> bu.plot_band_QE(color_c='blue', linewidth=1.2)
- plot_phonon_EPW(file=None, **kwargs)[source]#
Plot the phonon dispersion interpolated using EPW.
This method reads the EPW-generated phonon dispersion file (typically
phband.freq) and visualizes the interpolated phonon bandstructure.- Parameters:
file (str, optional) -- Path to the EPW phonon frequency file. Defaults to
{system}/{epw_fold}/phband.freq.**kwargs (dict, optional) -- Additional keyword arguments passed to the plotting function
plb.plot_band_prod(e.g., color, linewidth, figsize). Supported keys include: -xlabel: str, label for x-axis (default: "Wavevector") -ylabel: str, label for y-axis (default: "Energy (meV)")
Notes
The phonon frequencies are obtained from EPW’s
phband.freqoutput.Frequencies are assumed to be in meV.
The zero energy reference is set at 0 meV.
Example
>>> bu = BandUtil(system='graphene', prefix='gr') >>> bu.plot_phonon_EPW(color='red', linewidth=1.2)
- plot_phonon_QE(file=None, **kwargs)[source]#
Plot the phonon dispersion obtained from Quantum ESPRESSO.
This method reads the phonon frequencies calculated by QE (typically from
matdyn.freqor{prefix}.freq), converts them to meV, and visualizes the phonon bandstructure.- Parameters:
file (str, optional) -- Path to the QE phonon frequency file. Defaults to
{system}/{ph_fold}/{prefix}.freq.**kwargs (dict, optional) -- Additional keyword arguments passed to the plotting function
plb.plot_band_prod(e.g., color, linewidth, figsize). Supported keys include: -xlabel: str, label for x-axis (default: "Wavevector") -ylabel: str, label for y-axis (default: "Energy (meV)")
Notes
The phonon frequencies are extracted from QE’s
matdyn.freqoutput.Frequencies are converted to meV using the factor 0.124.
The zero energy reference is set at 0 meV.
Example
>>> bu = BandUtil(system='graphene', prefix='gr') >>> bu.plot_phonon_QE(color='blue', linewidth=1.2)