def first_scan(coor, ax, ay, NN, qx, k_sq_max, k_step, mu, NNb=None, Wj=0, cutx=0, cuty=0, V=0, alpha=0, delta=0, phi=0, gamx=0): k_sq = 0 k = 0 k_sq_list = [] k_list = [] E_list = [] while True: #k_sq = k_sq + k_sq_step #k = np.sqrt(k_sq) k_sq = k**2 print(k, k_sq) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=k) eigs, vecs = spLA.eigsh(H, k=4, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] k_sq_list.append(k_sq) k_list.append(k) E_list.append(np.min(np.abs(eigs))) if k_sq > k_sq_max: break k += k_step k_arr = np.array(k_list) E_arr = np.array(E_list) return E_arr, k_arr
k = 100 #number of perturbation energy eigs Q = 1e-4 * (np.pi / Lx) Zeeman_in_SC = False SOC_in_SC = False Tesla = True mu = 0 H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu, gammaz=1e-5, alpha=alpha, delta=delta, phi=phi, qx=1e-4 * (np.pi / Lx), Tesla=Tesla, Zeeman_in_SC=Zeeman_in_SC, SOC_in_SC=SOC_in_SC) #gives low energy basis eigs_0, vecs_0 = spLA.eigsh(H0, k=k, sigma=0, which='LM') vecs_0_hc = np.conjugate(np.transpose(vecs_0)) #hermitian conjugate H_G0 = spop.HBDG( coor, ax,
top_array = np.zeros((mu.shape), dtype='int') for q in range(qx.shape[0]): start = time.perf_counter() if q == 0: Qx = 1e-5 * (np.pi / Lx) else: Qx = qx[q] H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=0, alpha=alpha, delta=delta, phi=phi, gamz=1e-4, qx=Qx) eigs_0, vecs_0 = spLA.eigsh(H0, k=k, sigma=0, which='LM') vecs_0_hc = np.conjugate(np.transpose(vecs_0)) H_0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb,
steps = 100 #Number of kx values that are evaluated qx = np.linspace(0.0035, 0.0036, steps) #kx in the first Brillouin zone qmax = np.sqrt(2 * (5 - Vj) * 0.026 / const.hbsqr_m0) * 1.25 qx = np.linspace(0, qmax, steps) bands = np.zeros((steps, k)) for i in range(steps): print(steps - i) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutxT=cutxT, cutyT=cutyT, cutxB=cutxB, cutyB=cutyB, Vj=Vj, mu=mu, alpha=alpha, delta=delta, phi=phi, gamx=gx, qx=qx[i]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] bands[i, :] = eigs plt.plot(qx, bands[:, int(k / 2)], c='mediumblue', linestyle='solid') #for i in range(bands.shape[1]):
def gap_finder(coor, NN, NNb, ax, ay, mu, gx, Wj=0, cutxT=0, cutyT=0, cutxB=0, cutyB=0, Vj=0, Vsc=0, alpha=0, delta=0, phi=0, k=4, n=5, steps_targ=1000): n1, n2 = step_finder(steps_targ, n) print("total avg steps = ", n1 + n * n2) Lx = (max(coor[:, 0]) - min(coor[:, 0]) + 1) * ax #Unit cell size in x-direction qx = np.linspace(0, np.pi / Lx, n1) #kx in the first Brillouin zone bands = np.zeros((n1, k)) for i in range(n1): if ((n1 - i) % 10 == 0): print(n1 - i) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutxT=cutxT, cutyT=cutyT, cutxB=cutxB, cutyB=cutyB, Vj=Vj, Vsc=Vsc, mu=mu, gamx=gx, alpha=alpha, delta=delta, phi=phi, qx=qx[i]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] bands[i, :] = eigs lowest_energy_band = bands[:, int(k / 2)] local_min_idx = np.array(argrelextrema(lowest_energy_band, np.less)[0]) print(local_min_idx.size, "Energy local minima found at kx = ", qx[local_min_idx]) #for i in range(bands.shape[1]): # plt.plot(qx, bands[:, i], c ='mediumblue', linestyle = 'solid') #plt.scatter(qx[local_min_idx], lowest_energy_band[local_min_idx], c='r', marker = 'X') #plt.show() min_energy = [] qx_crit_arr = [] #checking edge cases min_energy.append(bands[0, int(k / 2)]) qx_crit_arr.append(qx[0]) min_energy.append(bands[-1, int(k / 2)]) qx_crit_arr.append(qx[-1]) for i in range(local_min_idx.size): #eigs_min.size qx_c = qx[local_min_idx[i]] #first approx kx of band minimum qx_lower = qx[local_min_idx[i] - 1] #one step back qx_higher = qx[local_min_idx[i] + 1] #one step forward qx_finer = np.linspace(qx_lower, qx_higher, n2) #around local min bands_finer = np.zeros((n2, k)) #new eigenvalue array for j in range(n2): H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutxT=cutxT, cutyT=cutyT, cutxB=cutxB, cutyB=cutyB, mu=mu, Vj=Vj, Vsc=Vsc, alpha=alpha, delta=delta, phi=phi, gamx=gx, qx=qx_finer[j]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] bands_finer[j, :] = eigs leb_finer = bands_finer[:, int(k / 2)] min_idx_finer = np.array(argrelextrema(leb_finer, np.less)[0]) leb_min_finer = leb_finer[min_idx_finer] #isolating local minima qx_crit = qx_finer[min_idx_finer] #for b in range(bands.shape[1]): # plt.plot(qx_finer, bands_finer[:, b], c ='mediumblue', linestyle = 'solid') #plt.scatter(qx_finer[min_idx_finer], leb_min_finer, c='r', marker = 'X') #plt.show() leb_min_finer = np.array(leb_min_finer) GAP, IDX = minima(leb_min_finer) min_energy.append(GAP) qx_crit_arr.append(qx_crit[IDX]) min_energy = np.array(min_energy) gap, idx = minima(min_energy) qx_crit = qx_crit_arr[idx] return gap, qx_crit
steps = 201 #Number of kx values that are evaluated qx = np.linspace(0, np.pi / Lx, steps) #kx in the first Brillouin zone bands0 = np.zeros((steps, k)) bands1 = np.zeros((steps, k)) for i in range(steps): print(steps - i) H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu, gammax=B[0], alpha=alpha, delta=delta, phi=phi[0], qx=qx[i], Tesla=True, Zeeman_in_SC=True, SOC_in_SC=False) H1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj,
def Junc_eff_Ham_gen(omega, Wj, Lx, cutxT, cutyT, cutxB, cutyB, ax, ay, kx, m_eff, alp_l, alp_t, mu, Vj, Gam, delta, phi, Vsc=0, Gam_SC_factor=0, iter=50, eta=0, plot_junction=False): # Generates the effective Hamiltonian for the Junction, which includes the self-energy from both of the SC regions # * omega is the (real) energy that goes into the Green's function # * W is the width of the junction # * ay_targ is the targeted lattice constant # * kx is the wavevector along the length of the junction # * m_eff is the effective mass # * alp_l is the longitudinal spin-orbit coupling coefficient # * alp_t is the transverse spin-orbit coupling coefficient # * mu is the chemical potential # * Vj is an addition potential in the junction region (V = 0 in SC regions by convention) # * Gam is the Zeeman energy in the junction # * Gam_SC = Gam_SC_factor * Gam, which is the Zeeman energy in the SC regions # * delta is the magnitude of the SC pairing in the SC regions # * phi is the phase difference between the two SC regions # * iter is the number of iteration of the algorithm to perform # * eta is the imaginary component of the energy that is used for broadening if cutxT == 0 and cutxB == 0: Nx = 3 Lx = Nx * ax else: Nx = int(Lx / ax) Wj_int = int( Wj / ay ) # number of lattice sites in the junction region (in the y-direction) Ny = Wj_int + 2 #add one SC site on each side coor = shps.square(Nx, Ny) #square lattice NN = nb.NN_sqr(coor) NNb = nb.Bound_Arr(coor) Gam_SC = Gam_SC_factor * Gam H_J = spop.HBDG(coor=coor, ax=ax, ay=ay, NN=NN, NNb=NNb, Wj=Wj_int, cutxT=cutxT, cutyB=cutyB, cutxB=cutxB, cutyT=cutyT, Vj=Vj, Vsc=Vsc, mu=mu, gamx=Gam, alpha=alp_l, delta=delta, phi=phi, qx=kx, meff_sc=m_eff, meff_normal=m_eff, plot_junction=plot_junction) Gs, Gb, sNRG_bot = bot_SC_sNRG_calc(omega=omega, Wj=Wj, Lx=Lx, cutxT=cutxT, cutxB=cutxB, ax=ax, ay=ay, kx=kx, m_eff=m_eff, alp_l=alp_l, alp_t=alp_t, mu=mu, Gam_SC=Gam_SC, delta=delta, phi=phi, iter=iter, eta=eta) Gs, Gb, sNRG_top = top_SC_sNRG_calc(omega=omega, Wj=Wj, Lx=Lx, cutxT=cutxT, cutxB=cutxB, ax=ax, ay=ay, kx=kx, m_eff=m_eff, alp_l=alp_l, alp_t=alp_t, mu=mu, Gam_SC=Gam_SC, delta=delta, phi=phi, iter=iter, eta=eta) #print(H_J.shape) #print(sNRG_top.shape) #print(sNRG_bot.shape) H_eff = H_J + sNRG_bot + sNRG_top return H_eff
sys.exit() ############################################################## #state plot MU = 2 GX = 0.75 H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, V=V, mu=MU, gammax=GX, alpha=alpha, delta=delta, phi=np.pi, qx=0, periodicX=True, periodicY=False) eigs, states = spLA.eigsh(H, k=8, sigma=0, which='LM') idx_sort = np.argsort(eigs) print(eigs[idx_sort]) plots.state_cmap(coor, eigs, states, n=4, savenm='prob_density_nodule_n=4.png') plots.state_cmap(coor, eigs, states, n=5, savenm='prob_density_nodule_n=5.png') plots.state_cmap(coor, eigs, states, n=6, savenm='prob_density_nodule_n=6.png')
col.append(i) bool_inSC, which = check.is_in_SC(x, y, Wsc, Wj, Sx, cutx, cuty) if bool_inSC: data.append(0) else: data.append(1) I_Zeeman = sparse.csc_matrix((data, (row, col)), shape=(N, N)) H_G0 = spop.HBDG( coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, gammaz=0, qx=0, Tesla=False, Zeeman_in_SC=False, SOC_in_SC=False ) #Matrix that consists of everything in the Hamiltonian except for the Zeeman energy in the x-direction H_G1 = spop.HBDG( coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx,
LE_Bands = np.zeros((qx.shape[0], mu.shape[0], gamx.shape[0])) top_array = np.zeros((mu.shape), dtype='int') for m in range(mu.shape[0]): for g in range(gamx.shape[0]): start = time.perf_counter() for q in range(qx.shape[0]): print(mu.shape[0] - m, gamx.shape[0] - g, qx.shape[0] - q) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu[m], alpha=alpha, delta=delta, phi=phi, gamx=gamx[g], qx=qx[q]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] LE_Bands[q, m, g] = eigs[int(k / 2)] #if q == 0: # top_array[i] = bc(LE_Bands[0, i, :], gx, max_gam = 1.0) # print(top_array[i]) end = time.perf_counter()
if not os.path.exists(dirS): os.makedirs(dirS) try: PLOT = str(sys.argv[1]) except: PLOT = 'F' if PLOT != 'P': eig_arr = np.zeros((phi_steps, k)) for i in range(phi_steps): print(phi_steps - i) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, mu=mu, gamx=gx, alpha=alpha, delta=delta, phi=phi[i]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] eig_arr[i, :] = np.sort(eigs) np.save( "%s/eig_arr Lx = %.1f Ly = %.1f Wsc = %.1f Wj = %.1f nodx = %.1f nody = %.1f alpha = %.1f delta = %.2f mu = %.1f gx = %.1f.npy" % (dirS, Lx * .1, Ly * .1, Wsc, Junc_width, Nod_widthx, Nod_widthy, alpha, delta, mu, gx), eig_arr) gc.collect()
################################################### dirS = 'gap_data' if not os.path.exists(dirS): os.makedirs(dirS) try: PLOT = str(sys.argv[1]) except: PLOT = 'F' if PLOT != 'P': for i in range(q_steps): if i == 0: Q = 1e-4*(np.pi/Lx) else: Q = qx[i] H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu, alpha=alpha, delta=delta, phi=phi, gamx=1e-4, qx=Q) #gives low energy basis eigs_0, vecs_0 = spLA.eigsh(H0, k=k, sigma=0, which='LM') vecs_0_hc = np.conjugate(np.transpose(vecs_0)) #hermitian conjugate H_G0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu, gamx=0, alpha=alpha, delta=delta, phi=phi, qx=qx[i]) #Matrix that consists of everything in the Hamiltonian except for the Zeeman energy in the x-direction H_G1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu, gamx=1, alpha=alpha, delta=delta, phi=phi, qx=qx[i]) #Hamiltonian with ones on Zeeman energy along x-direction sites HG = H_G1 - H_G0 #the proporitonality matrix for gamma-x, it is ones along the sites that have a gamma value HG0_DB = np.dot(vecs_0_hc, H_G0.dot(vecs_0)) HG_DB = np.dot(vecs_0_hc, HG.dot(vecs_0)) for g in range(gx.shape[0]): print(qx.shape[0]-i, gx.shape[0]-g) H_DB = HG0_DB + gx[g]*HG_DB eigs_DB, U_DB = LA.eigh(H_DB) LE_Bands[i, g] = eigs_DB[int(k/2)]
def GoldenSearch(coor, ax, ay, NN, mu, kcenter, deltak, NNb=None, Wj=0, cutx=0, cuty=0, gamx=0, delta=0, alpha=0, phi=0, V=0): ka = kcenter - (deltak) kb = kcenter + (deltak) GR = 0.6180339887 #(np.sqrt(5) + 1.0)/2.0 omgr = 1 - GR d = GR * (kb - ka) k1 = ka + omgr * (kb - ka) k2 = ka + GR * (kb - ka) if kcenter == 0: H1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=0) eigs1, vecs1 = spLA.eigsh(H1, k=4, sigma=0, which='LM') idx_sort1 = np.argsort(eigs1) eigs1 = eigs1[idx_sort1] f1 = min(np.abs(eigs1)) return f1, kcenter H1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=k1) eigs1, vecs1 = spLA.eigsh(H1, k=4, sigma=0, which='LM') idx_sort1 = np.argsort(eigs1) eigs1 = eigs1[idx_sort1] f1 = min(np.abs(eigs1)) H2 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=k2) eigs2, vecs2 = spLA.eigsh(H2, k=4, sigma=0, which='LM') idx_sort2 = np.argsort(eigs2) eigs2 = eigs2[idx_sort2] f2 = min(np.abs(eigs2)) k1_list = [ka] k2_list = [kb] eigs1_list = [f1] eigs2_list = [f2] #Ha = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=ka) #eigsa, vecsa = spLA.eigsh(Ha, k=4, sigma=0, which='LM') #idx_sorta = np.argsort(eigsa) #eigsa = eigsa[idx_sorta] #fa = min(np.abs(eigsa)) #Hb = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=kb) #eigsb, vecsb = spLA.eigsh(Hb, k=4, sigma=0, which='LM') #idx_sortb = np.argsort(eigsb) #eigsb = eigsb[idx_sortb] #fb = min(np.abs(eigsb)) #plt.scatter(k1, f1, c='blue') #plt.scatter(k2, f2, c='red') #plt.scatter(ka, fa, c= 'green') #plt.scatter(kb, fb, c = 'orange') #plt.show() #print(k1, f1) #print(k2, f2) #print(kcenter, fc) #print(ka, fa) #print(kb, fb) while True: if f1 < f2: kb = k2 k2 = k1 f2 = f1 d = GR * (kb - ka) k1 = ka + omgr * (kb - ka) H1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=k1) eigs1, vecs1 = spLA.eigsh(H1, k=4, sigma=0, which='LM') idx_sort1 = np.argsort(eigs1) eigs1 = eigs1[idx_sort1] f1 = min(np.abs(eigs1)) k1_list.append(ka) k2_list.append(kb) eigs1_list.append(f1) eigs2_list.append(f2) else: ka = k1 k1 = k2 f1 = f2 d = GR * (kb - ka) k2 = ka + GR * (kb - ka) H2 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=mu, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=k2) eigs2, vecs2 = spLA.eigsh(H2, k=4, sigma=0, which='LM') idx_sort2 = np.argsort(eigs2) eigs2 = eigs1[idx_sort2] f2 = min(np.abs(eigs2)) k1_list.append(ka) k2_list.append(kb) eigs1_list.append(f1) eigs2_list.append(f2) tol = 1e-8 #np.sqrt((delta/1000000)*(2/const.xi)) if abs(ka - kb) < tol: if f1 < f2: return f1, k1 else: return f2, k2
def mu_scan(coor, ax, ay, NN, mui, muf, NNb=None, Wj=0, cutx=0, cuty=0, gamx=0, alpha=0, delta=0, phi=0, Vj=0): V = Vjj(coor, Wj=Wj, Vsc=0, Vj=Vj, cutx=cutx, cuty=cuty) k_sq = 0 k = 0 k_step = (0.001 / Wj) #0.022/(Wj) #k_sq_step = 0.0005/(Wj**2) k_sq_list = [] k_list = [] E_list = [] tol = 5 k_sq_max = max([4 * muf / (const.xi), 4 * (muf - Vj) / const.xi]) while True: #k_sq = k_sq + k_sq_step #k = np.sqrt(k_sq) k_sq = k**2 print(k, k_sq) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, mu=muf, V=V, alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=k) eigs, vecs = spLA.eigsh(H, k=4, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] k_sq_list.append(k_sq) k_list.append(k) E_list.append(np.min(np.abs(eigs))) if k_sq > k_sq_max: break k += k_step k_arr = np.array(k_list) E_arr = np.array(E_list) local_min_idx = np.array(argrelextrema(E_arr, np.less)[0]) local_min_idx = np.concatenate((np.array([0]), local_min_idx)) min_energy = E_arr[local_min_idx] k_min_arr = k_arr[local_min_idx] print(k_min_arr[0]) #sys.exit() #plt.scatter(k_min_arr, min_energy, c='r', marker = 'X') #plt.plot(k_arr, E_arr) #plt.show() #delta_k_sq = 2*m_eff*delta_mu/(hbar**2) #delta_k = np.sqrt(delta_k_sq)*10 delta_k_arr = k_min_arr[1:] - k_min_arr[:-1] delta_k = min(delta_k_arr) #print(delta_k) delta_k = k_step delta_mu = (const.xi / 2) * (delta_k / 4)**2 delta_mu = 0.01 #print(delta_mu) Nmu = int((muf - mui) / delta_mu + 1) mu_arr = np.linspace(muf, mui, Nmu) E_min_arr = np.zeros((mu_arr.shape[0], k_min_arr.shape[0])) k_MIN_arr = np.zeros((mu_arr.shape[0], k_min_arr.shape[0])) E_min_Global_arr = np.zeros(mu_arr.shape[0]) for j in range(mu_arr.shape[0]): for i in range(k_min_arr.shape[0]): E_min_i, k_min_i = GoldenSearch(coor, ax, ay, NN, mu_arr[j], k_min_arr[i], delta_k, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, gamx=gamx, delta=delta, alpha=alpha, phi=phi, Vj=Vj) k_MIN_arr[j, i] = k_min_i E_min_arr[j, i] = E_min_i k_min_arr[i] = k_min_i print(mu_arr.shape[0] - j, k_min_arr.shape[0] - i, k_min_i, E_min_i) E_min_Global_arr[j] = min(E_min_arr[j, :]) return E_min_Global_arr, mu_arr
if qmax >= np.pi/Lx or cutxT != 0 or cutxB != 0: qmax = np.pi/(Lx) qx = np.linspace(0, qmax, steps) ################################################### dirS = 'bands_data' if not os.path.exists(dirS): os.makedirs(dirS) try: PLOT = str(sys.argv[1]) except: PLOT = 'F' if PLOT != 'P': bands = np.zeros((steps, k)) for i in range(steps): print(steps - i) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutxT=cutxT, cutyT=cutyT, cutxB = cutxB, cutyB = cutyB, Vj=Vj, mu=mu, alpha=alpha, delta=delta, phi=phi, gamx=gx, qx=qx[i]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] bands[i, :] = eigs np.save("%s/bands Lx = %.1f Wj = %.1f cutxT = %.1f cutyT = %.1f cutxB = %.1f cutyB = %.1f Vj = %.1f phi = %.3f mu = %.1f gam = %.1f.npy" % (dirS, Lx*.1, Junc_width, cutxT_width, cutyT_width, cutxB_width, cutyB_width, Vj, phi, mu, gx), bands) local_min_idx = np.array(argrelextrema(bands, np.less)[0]) mins = [] kx_of_mins = [] for i in range(local_min_idx.shape[0]): print("i: ", local_min_idx.shape[0]-i) if bands[local_min_idx[i], int(k/2)] >= 1.1*min(bands[:, int(k/2)]): pass else: qx_lower = qx[local_min_idx[i]-1]
try: PLOT = str(sys.argv[1]) except: PLOT = 'F' if PLOT != 'P': for i in range(q_steps): for j in range(mu.shape[0]): print(q_steps - i, mu.shape[0] - j) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=mu[j], alpha=alpha, delta=delta, phi=phi, gamx=gamx, qx=qx[i]) #gives low energy basis eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] LE_Bands[i, j] = eigs[int(k / 2)] gap = np.zeros((mu.shape[0])) q_minima = [] for i in range(LE_Bands.shape[1]):
VVJ = Vj[i] qmax = np.sqrt(2 * (min_mu[i] - VVJ) * m_eff / const.hbsqr_m0) * 1.25 qx = np.linspace(0, qmax, steps) bands = np.zeros(steps) for j in range(steps): print(Vj.shape[0] - i) print(steps - j) H = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj_int, cutxT=cutxT, cutyT=cutyT, cutxB=cutxB, cutyB=cutyB, Vj=Vj[i], mu=min_mu[i], alpha=alpha, delta=delta, phi=phi, gamx=min_Ez[i], qx=qx[j]) eigs, vecs = spLA.eigsh(H, k=k, sigma=0, which='LM') idx_sort = np.argsort(eigs) eigs = eigs[idx_sort] bands[j] = eigs[int(k / 2)] local_min_idx = np.array(argrelextrema(bands, np.less)[0]) mins = []
Ny = 1 #int(Wj/ay) + 2 nodx = 0 nody = 0 Wj_int = int(Wj / ay) coor = shps.square(Nx, Ny) #square lattice NN = nb.NN_sqr(coor) NNb = nb.Bound_Arr(coor) #print((.1/Wj)*(Nx*ax), "?") H1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj_int, alpha=0, delta=1, phi=np.pi, qx=0, meff_normal=0.026) #H2 = snrg.Junc_Ham_gen(Wj, ay, kx=0, m_eff=0.023, alp_l=100, alp_t=100, mu=0,V_J=0,Gam=0) #(omega, Wj, Lx, nodx, nody, ax, ay_targ, kx, m_eff, alp_l, alp_t, mu, Vj, Gam, delta, phi, Gam_SC_factor=0, iter=50, eta=0) #snrgN.Junc_eff_Ham_gen(0, Wj, (Nx*ax), 0, 0, ax, ay, (.1/Wj), 0.023, 100, 100, 0, 0, 0, delta=1, phi=np.pi) #print() #H1 = H1.todense() #H2 = H2.todense() #Junc_eff_Ham_gen(omega, Wj, nodx, nody, ax, ay_targ, kx, m_eff, alp_l, alp_t, mu, Vj, Gam, delta, phi, Gam_SC_factor=0, iter=50, eta=0) #print(np.around(H1.real, decimals=2)) #print() #print(np.around(H2.imag, decimals=1))
Wj_int = int( Wj / ay ) # number of lattice sites in the junction region (in the y-direction) Ny = 800 coor = shps.square(Nx, Ny) #square lattice NN = nb.NN_sqr(coor) NNb = nb.Bound_Arr(coor) H_sp = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj_int, cutx=nodx, cuty=nody, Vj=Vj, mu=mu, gamx=gam, alpha=alpha, delta=delta, phi=phi, meff_normal=m_eff, meff_sc=m_eff, qx=np.pi / Lx) #eigs, vecs = spLA.eigsh(H_sp, k=k, sigma=0, which='LM') #idx_sort = np.argsort(eigs) #eigs = eigs[idx_sort] #print("Real eig =", eigs[int(k/2)]) w_steps = 200 w = np.linspace(-2 * delta * 0, 5 * delta,
def local_min_gam_finder(coor, NN, NNb, ax, ay, mu, gi, gf, Wj=0, cutxT=0, cutyT=0, cutxB=0, cutyB=0, Vj=0, Vsc=0, meff_normal=0.026 * const.m0, meff_sc=0.026 * const.m0, g_normal=26, g_sc=26, alpha=0, delta=0, phi=0, Tesla=False, diff_g_factors=True, Rfactor=0, diff_alphas=False, diff_meff=False, k=50, tol=0.001): Lx = (max(coor[:, 0]) - min(coor[:, 0]) + 1) * ax #Unit cell size in x-direction #gamz and qx are finite in order to avoid degneracy issues H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutxT=cutxT, cutyT=cutyT, cutxB=cutxB, cutyB=cutyB, Vj=Vj, Vsc=Vsc, mu=mu, gamx=1e-4, alpha=alpha, delta=delta, phi=phi, qx=0, Tesla=Tesla, diff_g_factors=diff_g_factors, Rfactor=Rfactor, diff_alphas=diff_alphas, diff_meff=diff_meff) #gives low energy basis eigs_0, vecs_0 = spLA.eigsh(H0, k=k, sigma=0, which='LM') vecs_0_hc = np.conjugate(np.transpose(vecs_0)) #hermitian conjugate H_G1 = spop.HBDG( coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutxT=cutxT, cutyT=cutyT, cutxB=cutxB, cutyB=cutyB, Vj=Vj, Vsc=Vsc, mu=mu, gamx=1 + 1e-4, alpha=alpha, delta=delta, phi=phi, qx=0, Tesla=Tesla, diff_g_factors=diff_g_factors, Rfactor=Rfactor, diff_alphas=diff_alphas, diff_meff=diff_meff ) #Hamiltonian with ones on Zeeman energy along x-direction sites HG = H_G1 - H0 #the proporitonality matrix for gam-x, it is ones along the sites that have a gam value HG0_DB = np.dot(vecs_0_hc, H0.dot(vecs_0)) HG_DB = np.dot(vecs_0_hc, HG.dot(vecs_0)) G_crit = [] delta_gam = abs(gf - gi) steps = int((delta_gam / (0.5 * tol))) + 1 gx = np.linspace(gi, gf, steps) eig_arr = np.zeros((gx.shape[0])) for i in range(gx.shape[0]): H_DB = HG0_DB + gx[i] * HG_DB eigs_DB, U_DB = LA.eigh(H_DB) eig_arr[i] = eigs_DB[int(k / 2)] #checking edge cases if eig_arr[0] < tol: G_crit.append(gx[0]) if eig_arr[-1] < tol: G_crit.append(gx[-1]) local_min_idx = np.array(argrelextrema( eig_arr, np.less)[0]) #local minima indices in the E vs gam plot print(local_min_idx.size, "Energy local minima found at gx = ", gx[local_min_idx]) #plt.plot(gx, eig_arr, c='b') #plt.scatter(gx[local_min_idx], eig_arr[local_min_idx], c='r', marker = 'X') #plt.show() tol = tol / 10 for i in range(0, local_min_idx.size): #eigs_min.size gx_c = gx[ local_min_idx[i]] #gx[ZEC_idx[i]]""" #first approx g_critical gx_lower = gx[local_min_idx[i] - 1] #gx[ZEC_idx[i]-1]""" #one step back gx_higher = gx[local_min_idx[i] + 1] #gx[ZEC_idx[i]+1]""" #one step forward delta_gam = (gx_higher - gx_lower) n_steps = (int((delta_gam / (0.5 * tol))) + 1) gx_finer = np.linspace( gx_lower, gx_higher, n_steps ) #high res gam around supposed zero energy crossing (local min) eig_arr_finer = np.zeros((gx_finer.size)) #new eigenvalue array for j in range(gx_finer.shape[0]): H_DB = HG0_DB + gx_finer[j] * HG_DB eigs_DB, U_DB = LA.eigh(H_DB) eig_arr_finer[j] = eigs_DB[int( k / 2)] #k/2 -> lowest postive energy state min_idx_finer = np.array(argrelextrema( eig_arr_finer, np.less)[0]) #new local minima indices eigs_min_finer = eig_arr_finer[min_idx_finer] #isolating local minima #plt.plot(gx_finer, eig_arr_finer, c = 'b') #plt.scatter(gx_finer[min_idx_finer], eig_arr_finer[min_idx_finer], c='r', marker = 'X') #plt.plot(gx_finer, 0*gx_finer, c='k', lw=1) for m in range(eigs_min_finer.shape[0]): if eigs_min_finer[m] < tol: crossing_gam = gx_finer[min_idx_finer[m]] G_crit.append(crossing_gam) print("Crossing found at Gx = {} | E = {} meV".format( crossing_gam, eigs_min_finer[m])) #plt.scatter(G_crit, eigs_min_finer[m], c= 'r', marker = 'X') #plt.show() G_crit = np.array(G_crit) return G_crit
Vsc = 0 #Amplitude of potential in SC region: [meV] Vj = 0 #Amplitude of potential in junction region: [meV] V = Vjj(coor, Wj = Wj, Vsc = Vsc, Vj = Vj, cutx = cutx, cuty = cuty) mu_i = 0 mu_f = 20.0 dmu = 0 res = 0.1 delta_mu = mu_f - mu_i steps = int(delta_mu/(0.5*res)) + 1 mu = np.linspace(mu_i, mu_f, steps) #Chemical Potential: [meV] k = 200 ################################################### #phase diagram mu vs gamx H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=0, alpha=alpha, delta=delta, phi=phi, gamz=1e-5, qx=1e-5) eigs_0, vecs_0 = spLA.eigsh(H0, k=k, sigma=0, which='LM') vecs_0_hc = np.conjugate(np.transpose(vecs_0)) H_M0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=0, alpha=alpha, delta=delta, phi=phi, qx=0) H_M1 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=1, alpha=alpha, delta=delta, phi=phi, qx=0) HM = H_M1 - H_M0 HM0_DB = np.dot(vecs_0_hc, H_M0.dot(vecs_0)) HM_DB = np.dot(vecs_0_hc, HM.dot(vecs_0)) eig_arr = np.zeros((mu.shape[0], k)) eig_arr_NB = np.zeros((mu.shape[0], k)) for i in range(mu.shape[0]): print(mu.shape[0]-i) H_DB = HM0_DB + (mu[i]+dmu)*HM_DB H = H_M0 + (mu[i]+dmu)*HM
phi = np.pi #SC phase difference delta = 1.0 #Superconducting Gap: [meV] Vj = 0 #Amplitude of potential: [meV] V = Vjj(coor, Wj=Wj, Vsc=0, Vj=Vj, cutx=cutx, cuty=cuty) MU = 10 #Chemical Potential: [meV] ################################################### #Energy plot vs Zeeman energy in x-direction k = 200 #number of perturbation energy eigs H0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj, cutx=cutx, cuty=cuty, V=V, mu=MU, alpha=alpha, delta=delta, phi=phi, qx=1e-4 * (np.pi / Lx)) eigs_0, vecs_0 = spLA.eigsh(H0, k=k, sigma=0, which='LM') vecs_0_hc = np.conjugate(np.transpose(vecs_0)) H_G0 = spop.HBDG(coor, ax, ay, NN, NNb=NNb, Wj=Wj,