Example #1
0
def plot_local_dos(bar, energy, disorder, probability, seed):
    smatrix = kwant.smatrix(bar, energy, args = [disorder, probability, seed])
    print('seed : {}, transmission: {}'.format(seed, smatrix.transmission(1, 0)))

    local_dos = kwant.ldos(bar, energy=energy, args=[disorder, probability, seed])
    kwant.plot(bar, #site_color = -local_dos,
               site_color=np.minimum(-np.log(local_dos), 10*np.ones_like(local_dos)),
               hop_color='white', cmap='afmhot')
def ldos(cishu):
    en = 0.4
    salt = cishu + random.random() * 100
    sys = make_system2(width, length, str(salt))
    local_dos = kwant.ldos(sys, en)
    ld = local_dos.reshape(-1, 2)

    coord = np.array([sys.pos(i) for i in range(ld.shape[0])])
    ans = np.concatenate((coord, ld), axis=1)
    myDict = {'ans': ans}
    completeName = os.path.join('E:/dwell/11/', str(cishu) + ".mat")
    sio.savemat(completeName, myDict, oned_as='row')
Example #3
0
def density_of_states(sys, energies, L, W, show=False, J="N/A", spin="N/A"):
    """Calculate the density of states"""
    dos = []
    for energy in energies:
        dos.append(np.sum(kwant.ldos(sys, energy)))
    dos = [x / (W * L) for x in dos]
    if show is True:
        plt.figure()
        plt.title("Density of States (J=" + str(J) + ", Spin=" + spin + ")")
        plt.plot(energies, dos)
        plt.xlabel("Energies [t]")
        plt.ylabel("Density of States [Energy^-1 m^-2]")
        plt.grid(True)
        plt.show()
    return dos
Example #4
0
def density_of_states(sys, energies, L, W, show=False):
    """Calculate the density of states in system"""
    dos = []
    for energy in energies:
        dos.append(np.sum(kwant.ldos(sys, energy)))
    dos = [x / (W * L) for x in dos]
    if show is True:
        plt.figure()
        plt.title("Density of States")
        plt.plot(energies, dos)
        plt.xlabel("Energies [t]")
        plt.ylabel("Density of States [t^-1 a^-2]")
        plt.grid(True)
        plt.show()
    return dos
def TM(cishu):
    en = 0.4
    salt = cishu + random.random() * 100
    syst = make_system(width, length, str(salt))
    attach_lead(syst)
    sys = syst.finalized()
    wf = kwant.wave_function(sys, en)(0)

    gf_mode = kwant.smatrix(sys, en).submatrix(1, 0)
    #    s=np.linalg.svd(gf_mode, full_matrices=False, compute_uv=False) #u, s, vh
    ldos = kwant.ldos(sys, en)
    if cishu == 0:
        coord = np.array([sys.pos(i) for i in range(ldos.shape[0])])
        sio.savemat('E:/dwell3/703/coord.mat', {'coord': coord}, oned_as='row')
    myDict = {'gf_mode': gf_mode, 'wf': wf, 'ld': ldos}  #'s':s,
    completeName = os.path.join('E:/dwell3/703/', str(cishu) + ".mat")
    sio.savemat(completeName, myDict, oned_as='row')
Example #6
0
def tau_n(cishu):
    en = 0.4
    salt = cishu + random.random() * 1000
    sys = make_system(length, width, str(salt))
    gf_mode = kwant.smatrix(sys, en).submatrix(1, 0)
    #    s=np.linalg.svd(gf_mode, full_matrices=False, compute_uv=False) #u, s, vh

    wf = kwant.wave_function(sys, en)(0)
    #    kwant.plotter.map(sys, (abs(wf[14])**2),num_lead_cells=5,fig_size=(15, 10),colorbar=False)

    ldos = kwant.ldos(sys, en)
    if cishu == 0:
        coord = np.array([sys.pos(i) for i in range(ldos.shape[0])])
        sio.savemat('E:/dwell3/167/coord.mat', {'coord': coord}, oned_as='row')
    myDict = {'gf_mode': gf_mode, 'wf': wf, 'ld': ldos}
    completeName = os.path.join('E:/dwell3/167/', str(cishu) + ".mat")
    sio.savemat(completeName, myDict, oned_as='row')
def TM(cishu):
    salt = cishu + random.random() * 100
    syst = make_system(width, length, str(salt))
    attach_lead(syst)
    sys = syst.finalized()
    #kwant.plot(sys, fig_size=(10, 3))
    wf = kwant.wave_function(sys, 0.4)(0)
    #    kwant.plotter.map(sys, (abs(wf[14])**2),num_lead_cells=5,fig_size=(15, 10),colorbar=False)
    #
    #    t=kwant.smatrix(sys,.35).transmission(1,0)

    gf_mode = kwant.smatrix(sys, 0.4).submatrix(1, 0)
    #    s=np.linalg.svd(gf_mode, full_matrices=False, compute_uv=False) #u, s, vh
    ldos = kwant.ldos(sys, 0.4)
    if cishu == 0:
        coord = np.array([sys.pos(i) for i in range(ldos.shape[0])])
        sio.savemat('E:/dwell3/327/coord.mat', {'coord': coord}, oned_as='row')
    myDict = {'gf_mode': gf_mode, 'wf': wf, 'ld': ldos}  #'s':s,
    completeName = os.path.join('E:/dwell3/327/', str(cishu) + ".mat")
    sio.savemat(completeName, myDict, oned_as='row')
Example #8
0
def local_dos(sys, energies, L, W, show=False):
    """Calculate the local density of states of the system. Returns
    the total ldos of the system, spin up ldos, and spin down
    ldos as numpy arrays."""
    ldos = np.empty((0, (L + 1) * (W + 1)))
    ldos_sys_p = np.empty((0, (L + 1) * (W + 1)))
    ldos_sys_m = np.empty((0, (L + 1) * (W + 1)))
    for energy in energies:
        ldos_e = kwant.ldos(sys, energy)
        # Extract the individual spin up and spin down ldos components.
        ldos_sys_p_e = ldos_e.reshape(-1, 2)[:, 0]
        ldos_sys_m_e = ldos_e.reshape(-1, 2)[:, 1]
        # Calculate ldos per site, by summing spin up and
        # spin down components.
        ldos_e = np.sum(ldos_e.reshape(-1, 2), axis=1)
        ldos = np.append(ldos, [ldos_e], axis=0)
        ldos_sys_p = np.append(ldos_sys_p, [ldos_sys_p_e], axis=0)
        ldos_sys_m = np.append(ldos_sys_m, [ldos_sys_m_e], axis=0)
    if show is True:
        kwant.plotter.map(sys, ldos_sys_p, num_lead_cells=3)
        kwant.plotter.map(sys, ldos_sys_m, num_lead_cells=3)
        kwant.plotter.map(sys, ldos, num_lead_cells=3)
    return ldos, ldos_sys_p, ldos_sys_m
Example #9
0
import kwant    
from matplotlib import pyplot

def stadium(position):
    x, y = position
    x = max (abs(x)-7, 0)
    return x**2 + y**2 < 10**2

sys = kwant.Builder()
sqlat = kwant.lattice.square()

sys[sqlat.shape(stadium, (0, 0))] = 4
sys[sqlat.neighbors()] = -1

lead_symmetry = kwant.TranslationalSymmetry([0, -1])
for start, end in [(-9, -3), (4, 10)]:
    lead = kwant.Builder(lead_symmetry)
    lead[(sqlat(x, 0) for x in range(start, end))] = 4
    lead[sqlat.neighbors()] = -1
    sys.attach_lead(lead)

sys = sys.finalized()

energies = [0.5 + 1e-4*i for i in range(300)]
conductances = [kwant.smatrix(sys, en).transmission(1, 0)
                                        for en in energies]
local_dos = kwant.ldos(sys, energy=0.4)
pyplot.plot(energies, conductances)
pyplot.show()
kwant.plotter.map(sys, local_dos, num_lead_cells=10)
Example #10
0
def DOS(cishu):  # ONLY FOR UNITARY SYSTEM
    return sum(kwant.ldos(sys, ens[cishu]))
Example #11
0
#lead[lat.neighbors()]=-1/n2**2
#sys.attach_lead(lead)
sys = sys.finalized()
#en=1
energies = [1 + 1e-3 * t for t in range(100)]
shape = []
final_T = []
final_tau_sqrt = []
#save_path = 'E:/kwant/23/'
ld = []
kwant.plot(sys)
for cishu in np.arange(0, 2000):
    salt = str(cishu + random.random())
    #    temp=[kwant.greens_function(sys,en).submatrix(1,0)[30,30] for en in energies]
    #    plt.plot(energies,abs(np.array(temp)**2))
    aa = kwant.ldos(sys, 1)
    temp = np.mean(kwant.ldos(sys, 1).reshape((length + 1 + 40, width - 1)), 1)
    ld.append(temp)

#    kwant.smatrix(sys,1).lead_info[0].velocities
#    gf_mode=kwant.smatrix(sys,2.5).submatrix(1,0)
#    try:
#        u, s, v = np.linalg.svd(gf_mode, full_matrices=True)
#        wf=kwant.wave_function(sys,en)(0)
#        T=kwant.smatrix(sys,en).transmission(1,0)
#        completeName = os.path.join(save_path, str(cishu)+".mat")
#        myDict = {'u':u,'v':v,'s':s,'wf':wf,'T':T,'gf_mode':gf_mode}
#    ##    myDict['u'] = u
#        sio.savemat(completeName,myDict,oned_as='row')
#    except:
#        continue
Example #12
0
param_pot_2=param_pot(theta_min=-90/180*pi,theta_max=-45/180*pi,choice_pot=choice_pot_2)


H=make_system(param, param_pot_1,param_pot_2)
kwant.plot(H)

Hf=H.finalized()

## potential plot
if param.potential_activated==1:
    vals=[potential(Hf.sites[n], phi,param_pot_1,param_pot_2) for n in range(Hf.graph.num_nodes)]
    kwant.plotter.map(Hf, vals)


## density of state plot
local_dos = kwant.ldos(Hf, energy=.05,args=[phi,param_pot_1,param_pot_2])
kwant.plotter.map(Hf, local_dos, num_lead_cells=10)
#kwant.plotter.savefig('test.png')

# current density plot
wfs = kwant.wave_function(Hf, energy=0.05,args=[phi,param_pot_1,param_pot_2]) # to obtain the wave functions of the system 
J0 = kwant.operator.Current(Hf)
wf_left = wfs(0)
current = sum(J0(p) for p in wf_left)

kwant.plotter.current(Hf, current, cmap='viridis')

#%% [markdown]
# ## Analysis of the transmission

#%%