atoms.get_potential_energy() calc.write('C6H6.gpw', 'all') calc = GPAW('C6H6.gpw', txt=None, basis='sz') ibzk_kc = calc.wfs.ibzk_kc nk = len(ibzk_kc) Ef = calc.get_fermi_level() eps_kn = np.asarray([calc.get_eigenvalues(k) for k in range(nk)]) eps_kn -= Ef V_knM, H_kMM, S_kMM, P_aqMi = get_phs(calc, s=0) H_kMM -= Ef * S_kMM pwf = ProjectedWannierFunctions(V_knM, h_lcao=H_kMM, s_lcao=S_kMM, eigenvalues=eps_kn, kpoints=ibzk_kc, fixedenergy=5.0) t1 = time() h, s = pwf.get_hamiltonian_and_overlap_matrix(useibl=True) t2 = time() print "\nTime to construct PWF: %.3f seconds " % (t2 - t1) norm_kn = pwf.get_norm_of_projection() eps1_kn = pwf.get_eigenvalues() print "band | deps/eV | norm" print "-------------------------" for n in range(norm_kn.shape[1]): norm = norm_kn[0, n] if n >= eps1_kn.shape[1]: print "%4i | - | %.1e " % (n, norm)
calc.write('al.gpw', 'all') calc = GPAW('al.gpw', txt=None, basis='sz') ibzk_kc = calc.wfs.ibzk_kc nk = len(ibzk_kc) Ef = calc.get_fermi_level() eps_kn = np.asarray([calc.get_eigenvalues(kpt=k) for k in range(nk)]) eps_kn -= Ef V_knM, H_kMM, S_kMM, P_aqMi = get_phs(calc, s=0) H_kMM -= S_kMM*Ef pwf = ProjectedWannierFunctions(V_knM, h_lcao=H_kMM, s_lcao=S_kMM, eigenvalues=eps_kn, fixedenergy=1.0, kpoints=ibzk_kc) t1 = time() h_kMM, s_kMM = pwf.get_hamiltonian_and_overlap_matrix(useibl=True) t2 = time() print "\nTime to construct PWF: %.3f seconds " % (t2 - t1) print "max condition number:", pwf.get_condition_number().max() eigs_kn = pwf.get_eigenvalues() fd2 = open('bands_al_sz.dat','w') fd1 = open('bands_al_exact.dat', 'w') for eps1_n, eps2_n, k in zip(eps_kn, eigs_kn, ibzk_kc[:,0]): for e1 in eps1_n: print >> fd1, k, e1
calc = GPAW(h=0.2, basis='szp', kpts=(1, 1, 1), convergence={'bands':4*8}, width=0.1, maxiter=200, mixer=Mixer(0.1, 7, weight=100.)) atoms.set_calculator(calc) atoms.get_potential_energy() calc.write('al8.gpw', 'all') calc = GPAW('al8.gpw', txt=None, basis='sz') ibzk_kc = calc.wfs.ibzk_kc nk = len(ibzk_kc) Ef = calc.get_fermi_level() eps_kn = np.asarray([calc.get_eigenvalues(kpt=k) for k in range(nk)]) eps_kn -= Ef V_knM, H_kMM, S_kMM, P_aqMi = get_phs(calc, s=0) H_kMM -= S_kMM * Ef pwf = ProjectedWannierFunctions(V_knM, h_lcao=H_kMM, s_lcao=S_kMM, eigenvalues=eps_kn, fixedenergy=0.0, kpoints=ibzk_kc) t1 = time() h_kMM, s_kMM = pwf.get_hamiltonian_and_overlap_matrix(useibl=True) t2 = time() print "\nTime to construct PWF: %.3f seconds " % (t2 - t1)