Hi Srilok,
> > 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 > > > --------------------------------------------------------------------------- > KeyError Traceback (most recent call > last) > <ipython-input-84-0b886d56dec5> in <module> > 5 zigzag_ribbon[graphene.neighbors(1)] = 1 > 6 zigzag_ribbon.finalized() > ----> 7kwant.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) > --> 964site_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): > --> 909spec = [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): > --> 909spec = [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): > --> 958return 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) > Thanks for the bug report! This is very strange; when I download the notebook and run it I indeed see the error that you reported, however when I try to run the following minimal example it succeeds: > import numpy as np > import matplotlib.pyplot > import kwant > > graphene = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # > lattice vectors > [[0, 0], [0, 1/np.sqrt(3)]]) # > Coordinates of the sites > > zigzag_ribbon = kwant.Builder(kwant.TranslationalSymmetry([1, 0])) > zigzag_ribbon[graphene.shape((lambda pos: abs(pos[1]) < 9), (0, 0))] = 0 > zigzag_ribbon[graphene.neighbors(1)] = 1 > > print(kwant.__version__) > kwant.plot(zigzag_ribbon); I'll investigate a bit more and report my results. Happy Kwanting, Joe