import numpy as np import matplotlib.pyplot as plt import scipy.sparse.linalg as spLA import majoranaJJ.operators.sparse.qmsops as spop #sparse operators import majoranaJJ.lattice.nbrs as nb #neighbor arrays import majoranaJJ.lattice.shapes as shps #lattice shapes import majoranaJJ.modules.plots as plots #plotting functions R = 50 r = 15 ax = 10 #[A] ay = 10 #[A] coor = shps.donut(R, r) NN = nb.NN_Arr(coor) print("lattice size", coor.shape[0]) alpha = 0 #Spin-Orbit Coupling constant: [eV*A] gammaz = 0 #Zeeman field energy contribution: [T] delta = 0 #Superconducting Gap: [eV] V0 = 0.0 #Amplitude of potential : [eV] mu = 0 #Chemical Potential: [eV] H = spop.H0(coor, ax, ay, NN) print("H shape: ", H.shape) num = 75 # This is the number of eigenvalues and eigenvectors you want sigma = 0 # This is the eigenvalue we search around which = 'LM' eigs, vecs = spLA.eigsh(H, k=num, sigma=sigma, which=which)
if cutx == 0 and cuty == 0: nod_bool = False Junc_width = Wj*ay*.10 #nm SC_width = ((Ny - Wj)*ay*.10)/2 #nm Nod_widthx = cutx*ax*.1 #nm Nod_widthy = cuty*ay*.1 #nm print("Nodule Width in x-direction = ", Nod_widthx, "(nm)") print("Nodule Width in y-direction = ", Nod_widthy, "(nm)") print("Junction Width = ", Junc_width, "(nm)") print("Supercondicting Lead Width = ", SC_width, "(nm)") ################################################### coor = shps.square(Nx, Ny) #square lattice NN = nb.NN_Arr(coor) #neighbor array NNb = nb.Bound_Arr(coor) #boundary array lat_size = coor.shape[0] print("Lattice Size: ", lat_size) Lx = (max(coor[:, 0]) - min(coor[:, 0]) + 1)*ax #Unit cell size in x-direction Ly = (max(coor[:, 1]) - min(coor[:, 1]) + 1)*ay #Unit cell size in y-direction ################################################### #Hamiltonian Parameters alpha = 100 #Spin-Orbit Coupling constant: [meV*A] gx = 0.2 #parallel to junction: [meV] gz = 0 #normal to plane of junction: [meV] phi = 0*np.pi #SC phase difference delta = 1.0 #Superconducting Gap: [meV] V0 = 50 #Amplitude of potential: [meV]
#Using old method, scaled by N^2 due to a loop within a loop start = time.time() NN_old = nb2.NN_Arr(coor) end = time.time() print("Time to create Nbr_Arr with original method = {} [s]".format(end - start)) print(NN_old[0:5, :]) idx = 0 plots.lattice(idx, coor, NN=NN_old) print(" ") ########################################### start = time.time() NN_new = nb.NN_Arr(coor) end = time.time() print("Time to create Nbr_Arr with revised method = {} [s]".format(end - start)) print(NN_new[0:5, :]) idx = 0 plots.lattice(idx, coor, NN=NN_new) print(" ") ########################################### #Verifying that the new method creates the same neighbor array as the old one for i in [0, 1, 2, 3]: print("Same Values? ", all(NN_old[:, i] == NN_new[:, i]))
import majoranaJJ.operators.dense.qmdops as dpop #dense operators print(" ") N = range(3, 20) t_sparse = np.zeros(len(N)) t_dense = np.zeros(len(N)) ax = 2 ay = 2 for i in range(0, len(N)): Nx = N[i] #incrementing size of lattice Ny = N[i] #incrementing size of lattice coor = shps.square(Nx, Ny) #creating coordinate array NN = nbrs.NN_Arr(coor) #nearest neighbor array NNb = nbrs.Bound_Arr(coor) #boundary array H_sparse = spop.H0(coor, ax, ay, NN) #creating sparse hamiltonian start = time.time() #Time start for numpy H_dense = dpop.H0(coor, ax, ay, NN) #creating dense hamiltonian eigs, vecs = LA.eigh(H_dense) #diagonalizing end = time.time() #Time end for numpy t_dense[i] = end-start #append time taken to diagonalize start = time.time() #Time start for scipy H_sparse = spop.H0(coor, ax, ay, NN) #creating sparse hamiltonian
import majoranaJJ.operators.sparse.qmsops as spop #sparse operators import majoranaJJ.lattice.nbrs as nb #neighbor arrays import majoranaJJ.lattice.shapes as shps #lattice shapes import majoranaJJ.modules.plots as plots #plotting functions Ny = 25 #number of lattice sites in y direction Nx = 25 #number of lattice sites in x direction N = Ny * Nx print(N) coor = shps.square(Nx, Ny) #square coordinate array NN = nb.NN_Arr(coor) #nearest neighbor array of square lattice NN2 = nb.NN_sqr(coor) NNb = nb.Bound_Arr(coor) Lx = int(max(coor[:, 0]) + 1) idx = 2 * Lx - 1 plots.lattice(idx, coor, NN=NN) plots.lattice(idx, coor, NN=NN2) plots.lattice(idx, coor, NNb=NNb)
import majoranaJJ.lattice.nbrs as nb #neighbor arrays import majoranaJJ.modules.plots as plots #plotting functions print("") N = 45 #Making square lattice, nothing has changed with this method coor = shps.square(N, N) print("size: ", coor.shape[0]) print("") ########################################### #General NN_arr method start = time.time() NN_gen = nb.NN_Arr(coor) end = time.time() print("Time to create Nbr_Arr with general method = {} [s]".format(end - start)) ########################################### start = time.time() NN_sq = nb.NN_sqr(coor) end = time.time() print("Time to create Nbr_Arr with specific square method = {} [s]".format( end - start)) ########################################### #Verifying that the new method creates the same neighbor array as the old one