Hi Srilok, Right now plotting of detached finalized leads isn't supported and is tracked in the issue https://gitlab.kwant-project.org/kwant/kwant/issues/18
Cheers, Anton On Tue, Nov 20, 2018 at 9:22 AM Srilok Srinivasan <[email protected]> wrote: > > Sorry I forgot to mention that I am using the Kwant version 1.4.01a1 > > Thanks > > On Mon, Nov 19, 2018 at 5:38 PM Srilok Srinivasan <[email protected]> wrote: >> >> >> Hello Kwant users, >> >> I am very new to kwant and I am still learning to use the code. So my >> apologizes for any trivial questions. >> >> I working on the tutorial notebooks I found in the here >> (https://kwant-project.org/mm16). In the tutorial 3.4.graphene_qshe.ipynb I >> am trying to visualize the zigzag graphene lattice created using the >> kwant.Builder and .shape() module using kwant.plot(sys). I am getting the >> following error >> >> zigzag_ribbon = kwant.Builder(kwant.TranslationalSymmetry([1, 0])) >> #zigzag_ribbon[graphene.shape((lambda pos: abs(pos[1]) < 9 and pos[1]%2 >> ==1), (0, 0))] = 0.2 >> #zigzag_ribbon[graphene.shape((lambda pos: abs(pos[1]) < 9 and pos[1]%2 >> ==0), (0, 0))] = -0.2 >> zigzag_ribbon[graphene.shape((lambda pos: abs(pos[1]) < 9), (0, 0))] = 0 >> zigzag_ribbon[graphene.neighbors(1)] = 1 >> zigzag_ribbon.finalized() >> kwant.plotter.plot(zigzag_ribbon) >> #kwant.plotter.bands(zigzag_ribbon.finalized()); >> >> --------------------------------------------------------------------------- >> KeyError Traceback (most recent call last) >> <ipython-input-84-0b886d56dec5> in <module> >> 5 zigzag_ribbon[graphene.neighbors(1)] = 1 >> 6 zigzag_ribbon.finalized() >> ----> 7 kwant.plotter.plot(zigzag_ribbon) >> 8 #kwant.plotter.bands(zigzag_ribbon.finalized()); >> >> ~/anaconda3/lib/python3.6/site-packages/kwant/plotter.py in plot(sys, >> num_lead_cells, unit, site_symbol, site_size, site_color, site_edgecolor, >> site_lw, hop_color, hop_lw, lead_site_symbol, lead_site_size, lead_color, >> lead_site_edgecolor, lead_site_lw, lead_hop_lw, pos_transform, cmap, >> colorbar, file, show, dpi, fig_size, ax) >> 962 >> 963 site_size = make_proper_site_spec(site_size, fancy_indexing) >> --> 964 site_color = make_proper_site_spec(site_color, fancy_indexing) >> 965 site_edgecolor = make_proper_site_spec(site_edgecolor, >> fancy_indexing) >> 966 site_lw = make_proper_site_spec(site_lw, fancy_indexing) >> >> ~/anaconda3/lib/python3.6/site-packages/kwant/plotter.py in >> make_proper_site_spec(spec, fancy_indexing) >> 907 def make_proper_site_spec(spec, fancy_indexing=False): >> 908 if callable(spec): >> --> 909 spec = [spec(i[0]) for i in sites if i[1] is None] >> 910 if (fancy_indexing and _p.isarray(spec) >> 911 and not isinstance(spec, np.ndarray)): >> >> ~/anaconda3/lib/python3.6/site-packages/kwant/plotter.py in <listcomp>(.0) >> 907 def make_proper_site_spec(spec, fancy_indexing=False): >> 908 if callable(spec): >> --> 909 spec = [spec(i[0]) for i in sites if i[1] is None] >> 910 if (fancy_indexing and _p.isarray(spec) >> 911 and not isinstance(spec, np.ndarray)): >> >> ~/anaconda3/lib/python3.6/site-packages/kwant/plotter.py in site_color(site) >> 956 color_mapping = dict(zip(families, cycle)) >> 957 def site_color(site): >> --> 958 return color_mapping[site.family] >> 959 else: >> 960 # Unknown finalized system, no sites access. >> >> KeyError: kwant.lattice.Monatomic([[1.0, 0.0], [0.5, 0.8660254037844386]], >> [0.0, 0.5773502691896258], '1', None) >> >> However, I am able to plot the dispersion and all that. Also, I am able to >> visualize the square lattice presented in other tutorials. Do we have to do >> something different to visualize non-square lattice ? >> >> Thanks for your help >> -- >> Srilok Srinivasan >> Graduate Student >> Mechanical Engineering >> Iowa State University, Ames, IA >> > > > -- > Srilok Srinivasan > Graduate Student > Mechanical Engineering > Iowa State University, Ames, IA >
