def Bmat(N, k, rmin, rmax): dim = N - k - 2 t = knotSeq(k, N, rmin, rmax) BB = zeros((dim, dim)) for ii in range(0, dim): for jj in range(0, dim): i = ii + 2 j = jj + 2 if abs(i - j) <= k - 1: BB[ii][jj] = B_GQint(k, t, i, j) else: BB[ii][jj] = 0.0 return BB
def Hmat(N, k, rmin, rmax, l, Z): dim = N - k - 2 print("Hmat dim: %i " % dim) t = knotSeq(k, N, rmin, rmax) H = zeros((dim, dim)) t1f = 0.5 #hbar**2/(2*m_e) t2f = 0.5 * (l * (l + 1)) #hbar^2*l(l+1)/2m_e t3f = -1 * Z #-Z*e^2/(4*pi*epsilon_0) for ii in range(0, dim): for jj in range(0, dim): i = ii + 2 j = jj + 2 if abs(i - j) <= k - 1: term1 = t1f * H_GQint(k, t, i, j, term=1) term2 = t2f * H_GQint(k, t, i, j, term=2) term3 = t3f * H_GQint(k, t, i, j, term=3) H[ii][jj] = term1 + term2 + term3 else: H[ii][jj] = 0.0 return H
plt.rcParams.update(params) plt.rc('lines', linewidth=2) plt.rc('axes', prop_cycle=(cycler('color', ['c', 'r', 'm', 'y', 'b']) + cycler('linestyle', ['-', '-', '-', '-', '-']))) HtGS = (13.6 / 27.211385) # ~= 0.5 Hartree Hh = Hmat(N, k, rmin, rmax, l, Z) Bb = Bmat(N, k, rmin, rmax) #print Hh[-1][-1], Bb[-1][-1] #SEEMS TO WORK w, vr = LA.eig(Hh, Bb) tt = knotSeq(k, N, rmin, rmax) xx = linspace(rmin, rmax, 1000) minidx = argwhere(w < 0) minidx = minidx[:, 0] #print minidx, len(minidx) #print w aPsi2n1 = pow(abs(xx * aPsi(xx, 1, l)), 2) aPsi2n1 = aPsi2n1 / sum(aPsi2n1) aPsi2n2 = pow(abs(xx * aPsi(xx, 2, l)), 2) aPsi2n2 = aPsi2n2 / sum(aPsi2n2) aPsi2n3 = pow(abs(xx * aPsi(xx, 3, l)), 2) aPsi2n3 = aPsi2n3 / sum(aPsi2n3) apsilab = r'Analytic $r^2 |R_{n,l}(r)|^2$' if Z == 1 and lcompflag == 0: