putting disorder (kwant.digest.uniform) in graphene with shape function
Dear Sir, I'm trying to put disorder in graphene with shape function. I got some help from the link: http://nullege.com/codes/show/src@k@w@kwant-1.0.0@kwant@tests@test_comprehen... But when I want to see the onsite values using the comment below, kwant.plotter.plot(sys_2['sys'],site_color=lambda site: sys_2['sys'][site],colorbar = True, cmap='gist_heat') It says, "cannot convert argument to rgb sequence". Is there any way to see the onsite values through plot? Also it seems that all the onsite values have the same disorder. Can I make them different using kwant.digest.uniform()? Here is my code. #==================================== import kwant from matplotlib import pyplot def onsite(site, salt): return kwant.digest.uniform(repr(site), salt) - 0.5 def make_sys(l, w): def rect(pos): x, y = pos return 0 < x < l and 0 < y < w sys=kwant.Builder() lat = kwant.lattice.honeycomb() a,b= lat.sublattices sys[lat.shape(rect, (1, 1))] = onsite sys[lat.neighbors()] = -1 # left lead sym = kwant.TranslationalSymmetry((-1,0)) sym.add_site_family(lat.sublattices[0], other_vectors=[(-1, 2)]) sym.add_site_family(lat.sublattices[1], other_vectors=[(-1, 2)]) def lead_shape(pos): x, y = pos return 0 < y < w lead = kwant.Builder(sym) lead[lat.shape(lead_shape, (1, 1))] = 0 lead[lat.neighbors()] = -1 sys.attach_lead(lead) sys.attach_lead(lead.reversed()) return {'sys': sys } def main(): sys_2 = make_sys(l=10, w=23) kwant.plotter.plot(sys_2['sys'],site_color=lambda site: sys_2['sys'][site],colorbar = True, cmap='gist_heat') # Call the main function if the script gets executed (as opposed to imported). # See <http://docs.python.org/library/__main__.html>. if __name__ == '__main__': main() #============================================ With Regards, Sudin
Hi,
kwant.plotter.plot(sys_2['sys'],site_color=lambda site: sys_2['sys'][site],colorbar = True, cmap='gist_heat')
The line lambda site: sys_2['sys'][site] defines a function that takes a site and returns a **function** (i.e. the onsite function). You actually want to return the **value computed by the onsite function** so you should call it: lambda site: sys_2['sys'][site](site, '0') Hope that helps, Joe
Dear Sir, Thank you for the quick reply. By using the line: lambda site: sys_2['sys'][site](site, '0') I got another error massage, which says that, "TypeError: 'int' object is not callable". With Regards, Sudin
participants (2)
-
Joseph Weston
-
Sudin Ganguly