def test_HkFe(self): Hr = extractHr("test_data/Fe_hr_test.dat") k0 = (0.0, 0.0, 0.0) latVecs = _latVecs() Hk_0 = Hk(k0, Hr, latVecs) expected = complex(28.252214, -2.312399946e-18) eps = 1e-6 assertEquivComplex(self, Hk_0[0, 0], expected, eps, eps)
def test_dHkdkFe(self): Hr = extractHr("test_data/Fe_hr_test.dat") k0 = (0.0, 0.0, 0.0) latVecs = _latVecs() deriv = dHk_dk(k0, Hr, latVecs) expected = complex(-2.8699914595e-06, -1.08160008727e-15) eps = 1e-6 assertEquivComplex(self, deriv[0][0,0], expected, eps, eps)
def make_plot(work, prefix, plot_evecs, minE, maxE): qe_bands_path = os.path.join(work, prefix, "bands", "{}_bands.dat".format(prefix)) wannier_dir = os.path.join(work, prefix, "wannier") scf_path = os.path.join(wannier_dir, "scf.out") Hr_path = os.path.join(wannier_dir, "{}_hr.dat".format(prefix)) nbnd, nks, evalsQE = extractQEBands(qe_bands_path) alat = alat_from_scf(scf_path) latVecs = latVecs_from_scf(scf_path) E_F = fermi_from_scf(scf_path) if minE is None: minE = E_F - 9.0 else: minE = E_F + minE if maxE is None: maxE = E_F + 6.0 else: maxE = E_F + maxE Hr = extractHr(Hr_path) outpath = prefix symList = ["$\\Gamma$", "$M$", "$K$", "$\\Gamma$"] component_labels = get_orbital_labels(work, prefix) plotBands(evalsQE, Hr, alat, latVecs, minE, maxE, outpath, symList=symList, fermi_energy=E_F, plot_evecs=plot_evecs, component_labels=component_labels)
def test_extractHrFe(self): Hr = extractHr("test_data/Fe_hr_test.dat") elem = Hr[(-6, 2, -4)] self.assertEqual(elem[0][0, 0], complex(0.004554, 0.0)) self.assertEqual(elem[1], 4)
def get_Hr(work, prefix): wannier_dir = os.path.join(work, prefix, "wannier") Hr_path = os.path.join(wannier_dir, "{}_hr.dat".format(prefix)) Hr = extractHr(Hr_path) return Hr
default=None) parser.add_argument('--scf_path', type=str, help="Path to QE scf output file.", default=None) parser.add_argument('--minE', type=float, help="Minimal energy to plot.", default=None) parser.add_argument('--maxE', type=float, help="Maximum energy to plot.", default=None) parser.add_argument('--show', help="Show plot before writing file.", action='store_true') args = parser.parse_args() if args.Hr_path is not None: nbnd, nks, evalsQE = extractQEBands(args.QE_path) print("QE eigenvalues loaded.") Hr = extractHr(args.Hr_path) print("Wannier Hamiltonian loaded.") alat = alat_from_scf(args.scf_path) latVecs = latVecs_from_scf(args.scf_path) plotBands(evalsQE, Hr, alat, latVecs, args.minE, args.maxE, args.outPath, args.show) else: plotDFTBands(args.QE_path, args.outPath, args.minE, args.maxE, args.show)