Made by Dongwook Go (d.go@fz-juelich.de)
Let's first import life-saving libraries.
import numpy as np
import matplotlib.pyplot as plt
Our band structure data is at band/bands.1
.
band_raw = np.genfromtxt('band/bands.1')
Then let's re-arrange it into a two-dimensional array, whose indices represent kpoint and band-index, respectively.
N_kpts = 240
N_band = int(len(band_raw)/N_kpts)
band = np.zeros((N_kpts, N_band))
for n in range(0,N_band):
band[:,n] = band_raw[n*N_kpts:(n+1)*N_kpts,1]
While you can make a very quick plot out of this, let's add high-symmetry points of the Brillouin zone.
xticks_pos = [0.00000, 1.17343, 2.00317, 2.58988, 3.60610, 4.43583]
xticks_label = [r'$\Gamma$', r'$\mathrm{H}$', r'$\mathrm{N}$', r'$\mathrm{P}$', r'$\Gamma$', r'$\mathrm{N}$']
kpts = np.linspace(0.00000, np.max(xticks_pos), N_kpts)
Now let's plot the band structure.
fig, ax = plt.subplots()
ax.set_title('Band structure of Fe')
ax.set_xlim(np.min(xticks_pos), np.max(xticks_pos))
ax.set_ylim(-8,8)
for q in range(0,len(xticks_pos)):
ax.plot([xticks_pos[q],xticks_pos[q]], [-8, 8], linewidth=0.7, color='k')
for n in range(0,N_band):
ax.plot(kpts, band[:,n], color='C0', linewidth=1.5)
ax.set_xticks(xticks_pos)
ax.set_xticklabels(xticks_label)
ax.set_ylabel(r'$E_{n\mathbf{k}} - E_\mathrm{F}\ [\mathrm{eV}]$')
plt.show()
Having obtained the band structure from the Wannier Hamiltonian, let's compare the DFT and Wannier band structures to see if they agree well. Let's define the Fermi energy, which you should get from our own calculation. In my case, it was 11.1072 eV.
Fermi_energy = 11.4917
Then import WF1_band.dat
into an array.
band_WF_raw = np.genfromtxt('wann/WF1_band.dat')
N_wann = 18
kpts_wann_raw = np.genfromtxt('wann/WF1_band.kpt', skip_header=1)
N_kpts_wann = len(kpts_wann_raw)
band_WF = np.zeros((N_kpts_wann, N_wann))
for n in range(0,N_wann):
band_WF[:,n] = band_WF_raw[n*N_kpts_wann:(n+1)*N_kpts_wann,1] - Fermi_energy
kpts_wann = np.linspace(0.00000, np.max(xticks_pos), N_kpts_wann)
fig0, ax0 = plt.subplots()
ax0.set_title('Comparison of the band structures')
ax0.set_xlim(np.min(xticks_pos), np.max(xticks_pos))
ax0.set_ylim(-8,8)
for q in range(0,len(xticks_pos)):
ax0.plot([xticks_pos[q],xticks_pos[q]], [-8, 8], linewidth=0.7, color='k')
for n in range(0,N_band):
plt_DFT, = ax0.plot(kpts, band[:,n], color='C0', linewidth=1.5)
for n in range(0,N_wann):
plt_wan, = ax0.plot(kpts_wann, band_WF[:,n], '--', color='C1', linewidth=1.5)
ax0.legend([plt_DFT, plt_wan], ['DFT', 'Wannier'])
ax0.set_xticks(xticks_pos)
ax0.set_xticklabels(xticks_label)
ax0.set_ylabel(r'$E_{n\mathbf{k}} - E_\mathrm{F}\ [\mathrm{eV}]$')
plt.show()
If you see perfect agreement between the DFT and Wannier band structures, congrats!