def gf(cishu): gf = kwant.greens_function(sys, ens[cishu]).submatrix(1, 0) gf1 = kwant.greens_function(sys, ens[cishu] + df).submatrix(1, 0) myDict = {'en': ens, 'gf': gf, 'gf1': gf1} completeName = os.path.join('E:/channel time/30/' + str(cishu) + '.mat') #7_tracet sio.savemat(completeName, myDict, oned_as='row')
def gf_lastslice(salt): sys=dg.make_system_all(width, length, str(salt), dis) p0=kwant.greens_function(sys,ens[0]).submatrix(1,0)[tp,0] for cishu in np.arange(1,ens.size,1): p=kwant.greens_function(sys,ens[cishu]).submatrix(1,0)[tp,0] p0=np.hstack((p0,p)) myDict = {'p':p0} #,'ld':ld 't':t, 'wf':wf, 'trans':trans 'g':g completeName = os.path.join('E:/dwell5/151/', str(salt)+".mat") sio.savemat(completeName,myDict,oned_as='row')
def t_gf(sys): try: gf = kwant.greens_function(sys, e1).submatrix(1, 0) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = kwant.greens_function(sys, e1 + df).submatrix(1, 0) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t = np.diag(eigentime(u0, u1, vh0, vh1))[0] # time ,not dos except: t = 0 return t
def delay_tm(cishu): salt = cishu + random.random() * 100 sys = make_system(length, width, str(salt)) gf = kwant.greens_function(sys, en).submatrix(1, 0) # gf=kwant.smatrix(sys,en).submatrix(1,0) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = kwant.greens_function(sys, en1).submatrix(1, 0) # gf1=kwant.smatrix(sys,en1).submatrix(1,0) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t = eigentime(u0, u1, vh0, vh1) return np.concatenate((np.diag(t)[0:number], s0[0:number]))
def t_gf(sys, e1, df, o, i): # output_site,incident_site, only one mode case g = kwant.greens_function(sys, e1) g1 = kwant.greens_function(sys, e1 + df) try: gf = g.submatrix(o, i) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = g1.submatrix(o, i) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t = np.diag(eigentime(u0, u1, vh0, vh1, df)) # time ,not dos except: t = 0 return t
def gf_01(cishu): en = ens[cishu] gf = kwant.greens_function(sys, en).submatrix(1, 0)[:, 0] # gf=kwant.smatrix(sys,en).submatrix(1,0)[0,0] myDict = {'gf': gf} #,'ld':ld completeName = os.path.join('E:/dwell3/810/', str(cishu) + '.mat') sio.savemat(completeName, myDict, oned_as='row')
def null_H(syst, params, n): """Return the Hamiltonian (inverse of the Green's function) of the electron part at zero phase. Parameters ---------- syst : kwant.builder.FiniteSystem The finilized kwant system. params : dict A container that is used to store Hamiltonian parameters. n : int n-th Matsubara frequency Returns ------- numpy.array The Hamiltonian at zero energy and zero phase.""" en = matsubara_frequency(n, params) gf = kwant.greens_function(syst, en, out_leads=[0], in_leads=[0], check_hermiticity=False, params=params) return np.linalg.inv(gf.data[::2, ::2])
def gf_01(cishu): en = energies[cishu] gf = kwant.greens_function(sys, en).submatrix(1, 0) myDict = {'gf': gf} #,'ld':ld completeName = os.path.join('E:/dwell3/751/69/', str(cishu) + '.mat') sio.savemat(completeName, myDict, oned_as='row') return gf
def con(n): en=energies[n] gf=kwant.greens_function(sys,en).submatrix(1,0) t=kwant.smatrix(sys,en).transmission(1,0) myDict = {'gf':gf,'t':t} completeName = os.path.join('E:/fano/15/', str(n)+".mat") sio.savemat(completeName,myDict,oned_as='row')
def gf_virtual(cishu): en = energies[cishu] gf20 = kwant.greens_function(sys, en).submatrix(2, 0)[:, 0] # gf2=gf.submatrix(2,2) # gf22=gf2[:,3406] # ld=np.diag(gf.submatrix(2,2)) myDict = {'gf20': gf20} completeName = os.path.join('E:/dwell3/797/', str(cishu) + ".mat") sio.savemat(completeName, myDict, oned_as='row')
def spec_gf(cishu): gf = kwant.greens_function(sys, ens[cishu]).submatrix( 1, 0) #,check_hermiticity=False myDict = { 'en': ens, 'gf': gf } #,'ld':ld , 'g':g 't':t, 'wf':wf, 'trans':trans completeName = os.path.join('E:/dwell4/9/', str(cishu) + '.mat') sio.savemat(completeName, myDict, oned_as='row')
def main(): syst = System((10, 5), 1) energies = [0.04 * i for i in range(100)] data = [kwant.greens_function(syst, energy).transmission(1, 0) for energy in energies] pyplot.plot(energies, data) pyplot.xlabel("energy [in units of t]") pyplot.ylabel("conductance [in units of e^2/h]") pyplot.show()
def loc_length(cishu): # loc length from green function en = 0.4 salt = cishu + random() sys = make_system(length, width, str(salt)) gf = kwant.greens_function(sys, en).submatrix(1, 0) abs_diag_gf = abs(np.diag(gf)) max_d = max(abs_diag_gf) log_trace_d = 2 * np.log(max_d) + np.log(sum((abs_diag_gf / max_d)**2)) xi_inverse = -log_trace_d / 2 / length xi = 1 / xi_inverse return xi
def main(): syst = System((10, 5), 1) energies = [0.04 * i for i in range(100)] data = [ kwant.greens_function(syst, energy).transmission(1, 0) for energy in energies ] pyplot.plot(energies, data) pyplot.xlabel("energy [in units of t]") pyplot.ylabel("conductance [in units of e^2/h]") pyplot.show()
def tranmission_DIY(sys,energy): # based on fisher-lee relation, different from kwant Gr = kwant.greens_function(sys, energy,check_hermiticity=False).submatrix(1,0) flead0 = sys.leads[0] prop_modes, _ = flead0.modes(energy) v=prop_modes.velocities#*2*np.pi # 0: left 1:right n=v.size//2 # number of channel v_matrix_sqrt= np.diag([v[i]**0.5 for i in range(n,2*n)]) # v_matrix_sqrt2= np.diag([i**1 for i in range(n,2*n)]) wf_lead=prop_modes.wave_functions[:,n:2*n] wf_lead_n=np.sum(np.abs(wf_lead)**2,0)**0.5 wf_lead_unit=wf_lead/wf_lead_n t_s=1j*v_matrix_sqrt @ (wf_lead_unit).T @ Gr @ np.conj(wf_lead_unit) @ v_matrix_sqrt return t_s
def uv(energies, sys): # get u,v from TM or TM_gf, TM_gf is right, but TM does not work u_mat = [] v_mat = [] u2_mat = [] v2_mat = [] for en in energies: gf = kwant.greens_function(sys, en).submatrix(1, 0) # TM_gf not TM !!! u, s, vh = np.linalg.svd(gf, full_matrices=True, compute_uv=True) u_mat.append(u[:, 0]) v_mat.append(vh.conj().T[:, 0]) u2_mat.append(u[:, 1]) v2_mat.append(vh.conj().T[:, 1]) return u_mat, v_mat, u2_mat, v2_mat
def t_gf_all(sys, e1, df): # only one mode case g = kwant.greens_function(sys, e1) g1 = kwant.greens_function(sys, e1 + df) try: gf = g.submatrix(1, 0) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = g1.submatrix(1, 0) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t10 = np.diag(eigentime(u0, u1, vh0, vh1, df))[0] # time ,not dos except: t10 = 0 try: gf = g.submatrix(0, 1) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = g1.submatrix(0, 1) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t01 = np.diag(eigentime(u0, u1, vh0, vh1, df))[0] # time ,not dos except: t01 = 0 try: gf = g.submatrix(0, 0) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = g1.submatrix(0, 0) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t00 = np.diag(eigentime(u0, u1, vh0, vh1, df))[0] # time ,not dos except: t00 = 0 try: gf = g.submatrix(1, 1) u0, s0, vh0 = np.linalg.svd(gf, full_matrices=True, compute_uv=True) gf1 = g1.submatrix(1, 1) u1, s1, vh1 = np.linalg.svd(gf1, full_matrices=True, compute_uv=True) t11 = np.diag(eigentime(u0, u1, vh0, vh1, df))[0] # time ,not dos except: t11 = 0 return np.array([t10, t01, t00, t11])
def test_ModesLead_and_SelfEnergyLead(): lat = builder.SimpleSiteFamily() hoppings = [builder.HoppingKind((1, 0), lat), builder.HoppingKind((0, 1), lat)] rng = Random(123) L = 5 t = 1 energies = [0.9, 1.7] syst = builder.Builder() for x in range(L): for y in range(L): syst[lat(x, y)] = 4 * t + rng.random() - 0.5 syst[hoppings] = -t # Attach a lead from the left. lead = builder.Builder(VerySimpleSymmetry(-1)) for y in range(L): lead[lat(0, y)] = 4 * t lead[hoppings] = -t syst.attach_lead(lead) # Make the right lead and attach it. lead = builder.Builder(VerySimpleSymmetry(1)) for y in range(L): lead[lat(0, y)] = 4 * t lead[hoppings] = -t syst.attach_lead(lead) fsyst = syst.finalized() ts = [kwant.smatrix(fsyst, e).transmission(1, 0) for e in energies] # Replace lead with it's finalized copy. lead = fsyst.leads[1] interface = [lat(L-1, lead.sites[i].tag[1]) for i in range(L)] # Re-attach right lead as ModesLead. syst.leads[1] = builder.ModesLead(lead.modes, interface) fsyst = syst.finalized() ts2 = [kwant.smatrix(fsyst, e).transmission(1, 0) for e in energies] assert_almost_equal(ts2, ts) # Re-attach right lead as SelfEnergyLead. syst.leads[1] = builder.SelfEnergyLead(lead.selfenergy, interface) fsyst = syst.finalized() ts2 = [kwant.greens_function(fsyst, e).transmission(1, 0) for e in energies] assert_almost_equal(ts2, ts)
def s(en): prop_modes, _ = flead.modes(energy=en) velo_lead = prop_modes.velocities[n:2 * n] wf_lead = np.abs(prop_modes.wave_functions[:, n:2 * n]) @ np.diag(velo_lead **0.5) g = kwant.greens_function(sys, en) g10 = g.submatrix(1, 0) g00 = g.submatrix(0, 0) g11 = g.submatrix(1, 1) g01 = g.submatrix(0, 1) t10 = 1j * (wf_lead.conj().T @ g10 @ wf_lead) t01 = 1j * (wf_lead.conj().T @ g01 @ wf_lead) t00 = -np.eye(n) + 1j * (wf_lead.conj().T @ g00 @ wf_lead) t11 = -np.eye(n) + 1j * (wf_lead.conj().T @ g11 @ wf_lead) s1 = np.bmat([[t00, t01], [t10, t11]]) return s1
def spin_conductance(sys, energies, lead_out, lead_in, sigma=sigma_z): """Calculate the spin conductance between two leads. Uses the expression G = Tr[ σ_{α} Γ_{q} G_{qp} Γ_{p} G^+_{qp} ] (1) Where Γ_{q} is the coupling matrix to lead q ( = i[Σ - Σ^+] ) and G_{qp} is the submatrix of the system's Greens function between sites interfacing with lead p and q (not to be confused with the "G" on the left-hand-side, which is the spin conductance between the two leads). Parameters ---------- G : `kwant.solvers.common.GreensFunction` The Greens function of the system as returned by `kwant.greens_function`. lead_out : positive integer The lead where spin current is collected lead_in : positive integer The lead where spin current is injected sigma : `numpy.ndarray` of shape (2, 2) The Pauli matrix of the quantization axis along which to measure the spin current Notes ----- Assumes that the spin structure is encoded in the matrix structure of the Hamiltonian elements (i.e. there are not separate lattices/ sites for the spin degree of freedom). If you have the spin degree of freedom on a separate lattice already you can trivially get the spin conductance by using separate spin up/down leads. See http://dx.doi.org/10.1103/PhysRevB.89.195418 for a derivation of equation (1). """ # calculate Γ G Γ G^+ energy = energies G = kwant.greens_function(sys, energy) ttdagger = G._a_ttdagger_a_inv(lead_out, lead_in) shp = attdagger.shape[0] // sigma.shape[0] # build spin matrix over whole lead interface sigma_matrix = np.kron(np.eye(shp), sigma) return np.trace(sigma_matrix.dot(ttdagger)).real
def gf_virtual(cishu): salt = cishu + random.random() * 100 syst = make_system(width, length, str(salt)) attach_lead(syst) greens_function_sites = syst0.sites() mount_vlead(syst, greens_function_sites, 1) sys = syst.finalized() #kwant.plot(sys, fig_size=(10, 3)) # gf=kwant.greens_function(sys,0.4) # gf20=gf.submatrix(2,0)[:,0] gf20 = kwant.greens_function(sys, 0.4).submatrix(2, 0)[:, 0] # gf2=gf.submatrix(2,2) # gf22=gf2[:,3406] # ld=np.diag(gf.submatrix(2,2)) myDict = { 'coord': coord, 'coord_inject': coord_inject, 'gf20': gf20 } #,'ld':ld completeName = os.path.join('E:/dwell3/53/', str(cishu) + ".mat") sio.savemat(completeName, myDict, oned_as='row')
#pyplot.rcParams["figure.figsize"] = [20,10] #kwant.plot(sys) sys = make_system() wf = kwant.wave_function(sys, en)(0) #wavef1=[] #for i in range(wf.shape[1]): # wavef1.append(wf[0,i]) #kwant.plotter.map(sys,(abs(np.array(wavef1))**2), fig_size=(20, 12)) tpp = (abs(wf)**2)[0, ] kwant.plotter.map(sys, tpp, fig_size=(20, 12)) gf = kwant.greens_function(sys, en).submatrix(1, 0) t1 = kwant.greens_function(sys, en).transmission(1, 0) sg = np.linalg.svd(gf, compute_uv=False) taug1 = sg**2 #gf_measure=np.zeros([14,14],dtype=complex) #for j in range(14): # for jj in range(14): # gf_measure[j,jj]=gf[3*j+1,3*jj+1] #sg_m=np.linalg.svd(gf_measure, compute_uv=False) #taug1_m=sg_m**2 # measured gf_mode = kwant.smatrix(sys, en).submatrix(1, 0) s = np.linalg.svd(gf_mode, compute_uv=False) tau1 = s**2 #for times in range(1):
#vlead = kwant.Builder(kwant.TranslationalSymmetry((a/2, a/2*np.sqrt(3)))) lat = kwant.lattice.chain(dx) vlead = kwant.Builder() vlead[lat.shape( vshape, (0, ) )] = 0 # just define shape, self energy is defined in kwant.builder.SelfEnergyLead kwant.plot(vlead, fig_size=(10, 3)) #vlead[(lat(i) for i in range(L))]=0 gf_sites = vlead.sites() syst = make_system() mount_vlead(syst, gf_sites, 1) sys = syst.finalized() #sys=make_system() kwant.plot(sys, fig_size=(10, 3)) kwant.greens_function(sys, 1.6).submatrix(0, 0) ##en=2 wf = kwant.wave_function(sys, 1.613)(0) ##kwant.plotter.map(sys,(abs(np.array(wf))**2), fig_size=(10, 3)) #plt.plot(abs(np.array(wf[0,]))**2) #energy=np.linspace(.1,.5,21) #spec=[kwant.greens_function(sys,en).submatrix(1,0)[0,0] for en in energy] #2,2 ##ang=np.unwrap(np.angle(spec)) #trans=[abs(sp)**2 for sp in spec] #plt.figure() #plt.plot(energy,trans,'o')
#wavef2=[] #for i in range(wf.shape[1]//2): # wavef2.append(wf[1,2*i+1]) #kwant.plotter.map(sys,(abs(np.array(wavef2))**2)) #s_list=[] #for conf in range(1): # rl=[] # mn=0 #gf_mode=kwant.smatrix(sys,1).submatrix(1,0) #u, s, v = np.linalg.svd(gf_mode, full_matrices=True) # print(s) # s_list.append(s) #kwant.greens_function(sys,en).transmission(1,0) energy = np.linspace(0.11, .16, 400) spec = [kwant.greens_function(sys, en).submatrix(1, 0)[2, 2] for en in energy] #2,2 ang = np.unwrap(np.angle(spec)) #trans=[abs(sp)**2 for sp in spec] pyplot.plot(energy, ang, 'o') #pyplot.figure() #pyplot.plot(energy,trans,'o') #temp=kwant.greens_function(sys,.3).out_block_coords(1) #print(kwant.greens_function(sys,.3).num_propagating(0)) #condu=[kwant.greens_function(sys,en).transmission(1,0) for en in energy] condu = [kwant.smatrix(sys, en).transmission(1, 0) for en in energy] pyplot.figure() pyplot.plot(energy, condu, 'o')
def test_ModesLead_and_SelfEnergyLead(): lat = builder.SimpleSiteFamily() hoppings = [ builder.HoppingKind((1, 0), lat), builder.HoppingKind((0, 1), lat) ] rng = Random(123) L = 5 t = 1 energies = [0.9, 1.7] syst = builder.Builder() for x in range(L): for y in range(L): syst[lat(x, y)] = 4 * t + rng.random() - 0.5 syst[hoppings] = -t # Attach a lead from the left. lead = builder.Builder(VerySimpleSymmetry(-1)) for y in range(L): lead[lat(0, y)] = 4 * t lead[hoppings] = -t syst.attach_lead(lead) # Make the right lead and attach it. lead = builder.Builder(VerySimpleSymmetry(1)) for y in range(L): lead[lat(0, y)] = 4 * t lead[hoppings] = -t syst.attach_lead(lead) fsyst = syst.finalized() ts = [kwant.smatrix(fsyst, e).transmission(1, 0) for e in energies] # Replace lead with it's finalized copy. lead = fsyst.leads[1] interface = [lat(L - 1, lead.sites[i].tag[1]) for i in range(L)] # Re-attach right lead as ModesLead. syst.leads[1] = builder.ModesLead(lead.modes, interface) fsyst = syst.finalized() ts2 = [kwant.smatrix(fsyst, e).transmission(1, 0) for e in energies] assert_almost_equal(ts2, ts) # Re-attach right lead as ModesLead with old-style modes API # that does not take a 'params' keyword parameter. syst.leads[1] = builder.ModesLead( lambda energy, args: lead.modes(energy, args), interface) fsyst = syst.finalized() ts2 = [kwant.smatrix(fsyst, e).transmission(1, 0) for e in energies] assert_almost_equal(ts2, ts) # Re-attach right lead as SelfEnergyLead. syst.leads[1] = builder.SelfEnergyLead(lead.selfenergy, interface) fsyst = syst.finalized() ts2 = [ kwant.greens_function(fsyst, e).transmission(1, 0) for e in energies ] assert_almost_equal(ts2, ts) # Re-attach right lead as SelfEnergyLead with old-style selfenergy API # that does not take a 'params' keyword parameter. syst.leads[1] = builder.SelfEnergyLead( lambda energy, args: lead.selfenergy(energy, args), interface) fsyst = syst.finalized() ts2 = [ kwant.greens_function(fsyst, e).transmission(1, 0) for e in energies ] assert_almost_equal(ts2, ts) # Append a virtual (=zero self energy) lead. This should have no effect. # Also verifies that the selfenergy callback function can return exotic # arraylikes. syst.leads.append( builder.SelfEnergyLead(lambda *args: list(ta.zeros((L, L))), interface)) fsyst = syst.finalized() ts2 = [ kwant.greens_function(fsyst, e).transmission(1, 0) for e in energies ] assert_almost_equal(ts2, ts)
return sys.finalized() dtime = [] freq_num = 6 energies = np.linspace(1.99, 2, freq_num) dis = 6 size = np.arange(4, 16, 1) for a in size: dwell = [] for cishu in range(50): salt = np.random.randint(10000) sys = make_cuboid(a, str(salt)) gf = [] for en in energies: gf.append(kwant.greens_function(sys, en).submatrix(1, 0)[0, 0]) phase = np.unwrap(np.angle(gf)) # plt.plot(phase,'.') phase_de = np.mean((phase[np.arange(1, freq_num, 2)] - phase[np.arange(0, freq_num, 2)]) / (energies[1] - energies[0]) / 2 / np.pi) dwell.append(phase_de) dtime.append(dwell) elapsed = time() - t_ini #plt.plot(np.mean(dtime,1),'.') plt.plot(dtime, '.') plt.ylabel('<dwell>') plt.xlabel('size')
save_path = 'E:/haldane_correlated/g10/' v=2 w=4 for salt in np.arange(5): seed=np.random.randint(10000) pattern=long_range_correlation.correlation_pattern_guassian(t1,t2,v,w,seed) # pattern=long_range_correlation.correlation_pattern(t1,t2,v,w,seed) os.makedirs(os.path.join(save_path,str(salt)+'/')) sys=make_system() cishu=0 for energy in energies: try: gf=kwant.greens_function(sys,energy, [ky]).submatrix(1,0) # gf_mode = kwant.smatrix(sys, energy, [ky]) # T=gf_mode.transmission(1,0) # transmission.append(T) completeName = os.path.join(save_path+str(salt)+'/',str(cishu)+".mat") myDict = {'energy':energy, 'gf':gf, 'length':length,'width':width} sio.savemat(completeName,myDict,oned_as='row') cishu=cishu+1 except: continue elapsed=time()-t_ini #2*sqrt(3)*sys.pos(39)[1]
dis = 3.5 sys0 = qa.make_system_all(width, width_lead, length, '0', dis) #e1=0.19 #wf=kwant.wave_function(sys0,e1)(0) #.403586 #kwant.plotter.map(sys0, (abs(wf[0])),num_lead_cells=5,fig_size=(15, 10),colorbar=False) #t=[kwant.smatrix(sys0,e1).transmission(1,0) for e1 in np.linspace(0.2,0.3,100)] #plt.plot(np.linspace(0.2,0.3,100),t) #coord=qa.coordinate(sys0,e1) #[sys0.pos(sys0.lead_interfaces[0][i]) for i in range(20)] #sys0.pos(sys0.lead_interfaces[1][5]) gf = [ kwant.greens_function(sys0, e1).submatrix(1, 0)[5, 5] for e1 in np.linspace(0.18, 0.22, 50) ] plt.plot(np.linspace(0.18, 0.22, 50), np.unwrap(np.angle(gf))) plt.plot(np.linspace(0.18, 0.22, 50), np.abs(np.angle(gf))) #def stat_I(cishu): # sys=qa.make_system_all(width, width_lead, length, str(cishu), dis) # return qa.I_integral(sys,e1,coord,width_lead) # #I=Parallel(n_jobs=8)(delayed(stat_I)(cishu) for cishu in np.arange(0,1000,1)) # #myDict = {'I':I} #,'ld':ld #completeName = os.path.join('E:/dwell3/829/4.mat') #sio.savemat(completeName,myDict,oned_as='row') elapsed = time() - t_ini
x, y = pos return 0 <= y < a lead[lat.shape(lead_shape, (0, 0))] = 0 lead[lat.neighbors()] = hop sys.attach_lead(lead) sys.attach_lead(lead.reversed()) return sys.finalized() en = 1 sys = make_cuboid(16) gf = kwant.greens_function(sys, en) gfm = gf.submatrix(1, 0) gg = np.zeros(shape=(16, 16), dtype=complex) for m in range(16): for n in range(16): gg[n, m] = np.sin( (1 + np.arange(16)) / 17 * (1 + n) * np.pi) @ gfm @ np.transpose( np.sin((1 + np.arange(16)) / 17 * (1 + m) * np.pi)) / 2 gf_mode = kwant.smatrix(sys, en) t = gf.transmission(1, 0) gfmm = gf_mode.submatrix(1, 0) t_mode = gf_mode.transmission(1, 0) sum(np.linalg.svd(gg, compute_uv=False)**2) sum(np.linalg.svd(gfmm, compute_uv=False)**2) ind = sys.lead_interfaces
# def lead_shape(pos): # x,y=pos # return abs(y)<width # sym = kwant.TranslationalSymmetry((1,0)) # sym.add_site_family(graphene.sublattices[0], other_vectors=[(-1, 2)]) # sym.add_site_family(graphene.sublattices[1], other_vectors=[(-1, 2)]) # # lead = kwant.Builder(sym) # # lead[graphene.shape(lead_shape, (0, width-1))] = 0 # lead[graphene.neighbors()]=1 # lead[[kwant.builder.HoppingKind(*hopping) for hopping in nnn_hoppings]]=1j *m2 # return lead.finalized() #flead=make_lead() # # #prop_modes, _ = flead.modes(energy=e1) #velo_lead=prop_modes.velocities[1]*2*np.pi #t_ballistic=(2*length-1)/velo_lead en = 0.3916 #ens[1255] #energies[522] #wf=kwant.wave_function(sys,en)(0) #.403586 #kwant.plotter.map(sys, (abs(wf[0])),num_lead_cells=5,fig_size=(15, 10)) #,colorbar=False gf10 = kwant.greens_function(sys, en).submatrix(1, 0)[0, 0] gf01 = kwant.greens_function(sys, en).submatrix(0, 1)[0, 0] #coord=np.array([sys.pos(i) for i in range(73600)]) #myDict = {'wf':wf,'coord':coord} #,'ld':ld #completeName = os.path.join('E:/dwell3/807/tt.mat') #sio.savemat(completeName,myDict,oned_as='row') elapsed = time() - t_ini
f_num = 50 ens = np.linspace(5, 6, f_num) # ens # syst = od.make_system(length, dis, '35') sys1 = syst.finalized() ##kwant.plot(sys,fig_size=(5, 10)) tp = kwant.smatrix(sys1, 5.5).data #t=[kwant.smatrix(sys,ens[cishu]).transmission(1,0) for cishu in range(50)] #pyplot.plot(ens,t,'.') syst0 = od.make_system(length, 0, '0') # part of system greens_function_sites = syst0.sites() od.mount_vlead(syst, greens_function_sites, 1) sys = syst.finalized() gf = np.diag( kwant.greens_function(sys, 5.5, check_hermiticity=False).submatrix(2, 2)) #gf=(kwant.greens_function(sys,5.5).submatrix(2,0)) ldos = -np.imag(gf) / np.pi coord = np.array([sys.pos(i) for i in sys.lead_interfaces[2]]) wf_l = kwant.wave_function(sys1, 5.5, check_hermiticity=False)(0)[0] wf_r = kwant.wave_function(sys1, 5.5, check_hermiticity=False)(1)[0] # flead0 = sys1.leads[0] prop_modes, _ = flead0.modes(5.5) v = prop_modes.velocities #*2*np.pi # 0: left 1:right #pyplot.plot(np.abs(gf)*np.sqrt(v[1]),'.') #pyplot.plot(np.abs(wf_l))
lead[graphene.shape((lambda pos: abs(pos[1]) < 10), (0, 0))]=onsite_lead lead[graphene.neighbors()]=-s0 lead[[kwant.builder.HoppingKind(*hopping) for hopping in nnn_hoppings]] = spin_orbit_v_lead #kwant.plot(lead) sys.attach_lead(lead) sys.attach_lead(lead.reversed()) sys=sys.finalized() #kwant.plot(sys, fig_size=(30, 12)) # #matr=kwant.greens_function(sys,0).submatrix(1,0)[67,67] energy=np.linspace(0,.4,100) spec=[kwant.greens_function(sys,en).submatrix(1,0)[67,67] for en in energy] #4,4 and 18,18 spin up/down ang=np.angle(spec) #np.unwrap(np.angle(spec)) trans=[abs(sp)**2 for sp in spec] pyplot.figure(figsize=(10,6)) pyplot.plot(energy,ang,'o') pyplot.title('phase') pyplot.figure() pyplot.figure(figsize=(10,6)) pyplot.plot(energy,trans,'o') pyplot.title('intensity') #save_path = 'E:/TI transmission simulation/vsv12/' #k=1 #for dis in np.arange(.25, .55,.05): # s_list=[] # t_list=[]