dear sir, I am working on the assignment problem " tweaking the nanowire" from the online course in topology in condensed matter I am trying to apply the magnetic filed in the nanowire using the following code but I am unable to plot the graph.Please help me in this regard.The code is given below.. import kwant import matplotlib from matplotlib import pyplot import numpy as np def nanowire_chain(): lat = kwant.lattice.chain() sys = kwant.Builder(kwant.TranslationalSymmetry(*lat.prim_vecs)) def onsite(onsite, p): return (2 * p.t - p.mu) * pauli.szs0 + p.B * (np.cos(p.phi)*pauli.s0sz+ np.sin(p.phi)*np.sin(p.theta)*pauli.s0sy+np.sin(p.phi)*np.sin(p.theta)*pauli.s0sx)+ p.delta * pauli.sxs0 sys[lat(0)] = onsite def hop(site1, site2, p): return -p.t * pauli.szs0 - .5j * p.alpha * pauli.szsx sys[kwant.HoppingKind((1,), lat)] = hop return sys def spinful_kitaev_chain(): lat = kwant.lattice.chain() sys = kwant.Builder(kwant.TranslationalSymmetry(*lat.prim_vecs)) def onsite(site, p): return (2 * p.t - p.mu) * pauli.szs0 + p.B * pauli.szsz sys[lat(0)] = onsite def hop(site1, site2, p): return -p.t * pauli.szs0 - 1j * p.delta * pauli.sys0 sys[kwant.HoppingKind((1,), lat)] = hop return sys def find_gap(sys, p, resolution=1e-4): """Find gap in a system by doing a binary search in energy.""" # This tells us if there are modes at a certain energy. if len(sys.modes(energy=0, args=[p])[0].momenta): return 0 gap = step = min(abs(kwant.physics.Bands(sys, args=[p])(k=0))) / 2 while step > resolution: step /= 2 if len(sys.modes(gap, args=[p])[0].momenta): gap -= step else: gap += step return gap def spinorbit_band_gap(sys, mu, t, delta, Bs): sys = sys.finalized() alphas = [0.0, 0.1, 0.2, 0.3] p = SimpleNamespace(mu=mu, t=t, delta=delta,theta=theta,phi=phi) def gap(sys, p, alpha, B): p.alpha = alpha p.B = B return find_gap(sys, p) gaps = [gap(sys, p, alpha, B) for alpha in alphas for B in Bs] gaps = np.reshape(gaps, (len(alphas), -1)) dims = {'kdims': [r'$B$'], 'vdims': ['Band gap']} B_crit = holoviews.VLine(np.sqrt(p.delta**2 + p.mu**2)) plot = [holoviews.Curve((Bs, gaps[i]), label=r'$\alpha={}$'.format( alphas[i]), **dims) * B_crit for i, alpha in enumerate(alphas)] title = r'$\Delta={delta}$, $\mu={mu}$'.format(delta=np.round(p.delta, 2), mu=np.round(p.mu, 2)) style = {'xticks': [0, 0.1, 0.2, 0.3], 'yticks': [0, 0.05, 0.1], 'fig_size': 150} plot = holoviews.Overlay(plot) return plot(plot=style) def title(p): try: title = r"$\alpha={alpha}$, $\mu={mu}$, $B={B}$, $\Delta={delta}$" title = title.format(alpha=np.round(p.alpha, 2), mu=np.round(p.mu, 2), B=np.round(p.B, 2), delta=np.round(p.delta, 2)) except AttributeError: title = r"$\mu={mu}$, $B={B}$, $\Delta={delta}$" title = title.format(mu=np.round(p.mu, 2), B=np.round(p.B, 2), delta=np.round(p.delta, 2)) return title style = {'k_x': np.linspace(-1, 1, 101), 'xdim': r'$k$', 'ydim': r'$E/t$', 'xticks': [-1, 0, 1], 'yticks': [-1, 0, 1], 'xlims': [-1, 1], 'ylims': [-1.5, 1.5], 'title': title} Regards Shyam Lochan Bora
participants (1)
-
shyam lochan bora