def GetCoulombUJ(lmbda_eps, Rx, Ag, Bg, l, Nk, U0, J0): (lmbda, eps) = lmbda_eps Fk = CmpSlaterInt(lmbda, Rx, Ag, Bg, l, Nk, False) UJs = SlaterF2J(array(Fk) / eps, l) UH = UJs[0] JH = sum(UJs[1:]) / len(UJs[1:]) return array([UH - U0, JH - J0])
def GetDielectricFunctions(UJ_icase, projector_file='projectorw.dat', options_Nk=8): Nk = 2**options_Nk + 1 (Rx_, Ag_, Bg_, ls_) = GetWaveF(projector_file) UlamJ = {} for icase in UJ_icase.keys(): Rx = Rx_[icase] Ag = Ag_[icase] Bg = Bg_[icase] l = ls_[icase] lmbda = 0.000001 epsilon = 1. if UJ_icase[icase][0] > 0: (Uunscr, Junscr) = GetCoulombUJ( [lmbda, epsilon], Rx, Ag, Bg, l, Nk, 0.0, 0.0) # First compute the unscreened interaction epsilon = Uunscr / UJ_icase[icase][ 0] # dielectric constant is the ration between the unscreened and screened interaction print 'lambda=', lmbda, 'epsilon=', epsilon Fk = CmpSlaterInt(lmbda, Rx, Ag, Bg, l, Nk, True) Fk = array(Fk) / epsilon UJs = SlaterF2J(Fk, l) print 'Fk=', Fk.tolist() print 'U,J=', UJs UlamJ[icase] = (UJ_icase[icase][0], lmbda, epsilon, UJs[1:]) return UlamJ
def Anisimov(nocc, Fk, l, fh_info): nd = sum(nocc) UJ = SlaterF2J(Fk, l) print 'U=', UJ[0], 'Js=', UJ[1:], 'n_imp=', nd print >> fh_info, 'U=', UJ[0], 'Js=', UJ[1:], 'n_imp=', nd n0 = int(nd + 0.1) return (UJ[0] * (nd - 0.5) - UJ[1] / 2. * (nd - 1), UJ[0] * (n0 - 0.5) - UJ[1] / 2. * (n0 - 1))
def AverageHartreeFock(nocc, Fk, l): J_HF = zeros((4, 4)) J_HF[0, :1] = [1.] # s-electrons J_HF[1, :2] = [1., 2. / 5.] # p-electrons J_HF[2, :3] = [1., 32. / 65., 20. / 117.] # d-electrons J_HF[3, :4] = [1., 110. / 173., 167. / 1038., 475. / 4498.] # f-electrons nd = sum(nocc) nd1 = nd / (2 * (2 * l + 1.)) UJ = array(SlaterF2J(Fk, l)) Vu = UJ[0] * (nd - nd1) Vj = nd1 * sum([UJ[i] * J_HF[l, i] for i in range(1, len(UJ))]) #print 'Vu=', Vu, 'Vj=', Vj return Vu - Vj
def GetLambdas(UJ_icase, projector_file='projectorw.dat', options_Nk=8): Nk = 2**options_Nk + 1 (Rx_, Ag_, Bg_, ls_) = GetWaveF(projector_file) UlamJ = {} for icase in UJ_icase.keys(): Rx = Rx_[icase] Ag = Ag_[icase] Bg = Bg_[icase] l = ls_[icase] #lmbda = optimize.brentq(GetCoulombU, 0., 3., args=(Rx,Ag,Bg,l,Nk,U_icase[icase])) lmbda = 0.000001 epsilon = 1. if UJ_icase[icase][0] > 0: lmbda = optimize.brentq(GetCoulombU, 0., 3., args=(Rx, Ag, Bg, l, Nk, UJ_icase[icase][0])) epsilon = 1. if UJ_icase[icase][1] > 0: sol = optimize.root(GetCoulombUJ, [lmbda, epsilon], args=(Rx, Ag, Bg, l, Nk, UJ_icase[icase][0], UJ_icase[icase][1])) if sol.success: (lmbda, epsilon) = sol.x else: print 'ERROR:', sol.message print 'lambda=', lmbda, 'epsilon=', epsilon Fk = CmpSlaterInt(lmbda, Rx, Ag, Bg, l, Nk, True) Fk = array(Fk) / epsilon UJs = SlaterF2J(Fk, l) print 'Fk=', Fk.tolist() print 'U,J=', UJs UlamJ[icase] = (UJ_icase[icase][0], lmbda, epsilon, UJs[1:]) return UlamJ
def GetCoulombU(lmbda, Rx, Ag, Bg, l, Nk, U0): Fk = CmpSlaterInt(lmbda, Rx, Ag, Bg, l, Nk, False) UJs = SlaterF2J(Fk, l) return UJs[0] - U0
for icase in range(len(Rx_)): Rx = Rx_[icase] Ag = Ag_[icase] Bg = Bg_[icase] l = ls_[icase] if options.U0 > 0: lmbda = optimize.brentq(GetCoulombU, 0., 3., args=(Rx, Ag, Bg, l, Nk, options.U0)) epsilon = 1. if options.J0 > 0: sol = optimize.root(GetCoulombUJ, [lmbda, epsilon], args=(Rx, Ag, Bg, l, Nk, options.U0, options.J0)) if sol.success: (lmbda, epsilon) = sol.x else: print 'ERROR:', sol.message else: lmbda = options.lmbda epsilon = 1. print 'lambda=', lmbda, 'epsilon=', epsilon Fk = CmpSlaterInt(lmbda, Rx, Ag, Bg, l, Nk, True) UJs = SlaterF2J(Fk, l) print 'Fk=', (array(Fk) / epsilon).tolist() print 'U,J=', (array(UJs) / epsilon).tolist()