Dear Colleagues, I want to measure the decay of wave-function in magnetic field. For that I create a 2D shape and want to attach a 1D lead to only one internal lattice site of a 2D shape. (imagine, that this 1D chain is pointing in the third direction, although this embedding does not matter for physics) Does this make sense? There is a technical problem that 1D families differ from 2D ones and I get a message: "ValueError: Sites with site families (kwant.lattice.Monatomic([[1.0]], [0.0], ''),) do not appear in the system, hence the system does not interrupt the lead." <mailto:kwant-discuss@kwant-project.org> Any hints? Thank you, Sergey
Dear Sergey, Indeed, the automatic routine that does the attachment can only work on one unique lattice. There are many solutions to your problem. - You can work on 3D cubic lattice. (that's probably the easiest). Note that Kwant works in arbitrary dimension so you can also embed a 3D problem in a 4D one. - You can attatch your 1D lead to a single site 1D system and then add a hopping between this site and your 2D system. Best regards, Xavier Le 14 avr. 2015 à 02:00, Sergey <sereza@gmail.com> a écrit :
Dear Colleagues, I want to measure the decay of wave-function in magnetic field. For that I create a 2D shape and want to attach a 1D lead to only one internal lattice site of a 2D shape. (imagine, that this 1D chain is pointing in the third direction, although this embedding does not matter for physics) Does this make sense? There is a technical problem that 1D families differ from 2D ones and I get a message: "ValueError: Sites with site families (kwant.lattice.Monatomic([[1.0]], [0.0], ''),) do not appear in the system, hence the system does not interrupt the lead." Any hints?
Thank you, Sergey
Dear Xavier, Thank you for rapid and useful reply! I am using a 3D embedding route, so, I cannot use the map function to plot the wave-function density. So, I need to find a way to get positions for the array returned by wave_function. I tried the command coords=[kwant.plotter.sys_leads_pos(sys,site) for site in kwant.plotter.sys_leads_sites(sys, num_lead_cells=0)[0]] but this does not work for some reason. Is there a more obvious way to get an array of site coordinates for finalized system? Thank you, Sergey
Dear Sergey, First you get the wave function through a call of wf = kwant.wave_function(finalized_sys, energy) Second your finalized sytem contains a list of the sites of the system finalized_sys.sites And each site contains its positions. Best regards, Xavier Le 15 avr. 2015 à 02:15, Sergey <sereza@gmail.com> a écrit :
Dear Xavier, Thank you for rapid and useful reply! I am using a 3D embedding route, so, I cannot use the map function to plot the wave-function density. So, I need to find a way to get positions for the array returned by wave_function. I tried the command
coords=[kwant.plotter.sys_leads_pos(sys,site) for site in kwant.plotter.sys_leads_sites(sys, num_lead_cells=0)[0]]
but this does not work for some reason. Is there a more obvious way to get an array of site coordinates for finalized system?
Thank you, Sergey
Dear Xavier, It's still not obvious to me, how to extract site coordinates in an easy way. The sys.sites is a long tuple with entries like Site(kwant.lattice.Monatomic([[1.0, 0.0, 0.0], [0.5, 0.8660254037844386, 0.0], [0.0, 0.0, 1.0]], [0.0, 0.0, 0.0], '0'), array([-4, 3, 0])) and "Site" is an unknown object. Best wishes, Sergey On 15/04/15 08:09, Xavier Waintal wrote:
Dear Sergey,
First you get the wave function through a call of wf = kwant.wave_function(finalized_sys, energy) Second your finalized sytem contains a list of the sites of the system finalized_sys.sites And each site contains its positions.
Best regards, Xavier
Le 15 avr. 2015 à 02:15, Sergey <sereza@gmail.com> a écrit :
Dear Xavier, Thank you for rapid and useful reply! I am using a 3D embedding route, so, I cannot use the map function to plot the wave-function density. So, I need to find a way to get positions for the array returned by wave_function. I tried the command
coords=[kwant.plotter.sys_leads_pos(sys,site) for site in kwant.plotter.sys_leads_sites(sys, num_lead_cells=0)[0]]
but this does not work for some reason. Is there a more obvious way to get an array of site coordinates for finalized system?
Thank you, Sergey
Hi Sergey, You could have used the search box of the kwant documentation to find out what is Site. Site refers to kwant.builder.Site. Please see the reference documentation of this class. To get the real-space position of a site, use its attribute “pos”, i.e. sys.sites[12].pos is the position of site #12. To get the lattice-space coordinates, use the attribute “tag”. Christoph
Hi Christoph, Yes, I have read all that... Just several other mistakes that spoilt my code. To close the discussion, here's a solution for 2d embedded in 3d: coords= [list(site.pos)[0:2] for site in sys.sites] Thank you, Sergey
Hi Sergey, Currently kwant.plotter.map() only works when site positions are 2-d. We could add a pos_transform argument (like in kwant.plot()). I've made a note about this. For now, the cleanest solution will be to build your system as you did originally, i.e. with a 2-d scattering region and a 1-d lead. You cannot attach such a lead automatically using attach_lead(), but it’s actually very easy to attach it manually. Unfortunately, the documentation of Kwant 1.0 doesn’t explain how to attach leads manually. But the one of the development version does. Have a look at the docstring of the class “Lead”: http://git.kwant-project.org/kwant/tree/kwant/builder.py#n433 Let’s say that you have a scattering region called “sys” and a lead called “lead”, both are instances of kwant.Builder with appropriate symmetries. “sys” contains sites from a 2-d lattice called “lat”. The site “lat(1, 2)” belongs to “sys” and that’s where you would like to attach the lead. Then all you have to do is this: sys.leads.append(kwant.builder.BuilderLead(lead, [lat(1, 2)])) Please see the documentation of kwant.builder.BuilderLead. Every Builder instance has a list of attached leads, and you can simply append instances of kwant.builder.Lead to that list. attach_lead() actually does the same, but it determines the lead interface automatically and adds sites to the scattering region if necessary to create a clean interface. Let me know if anything is unclear. Christoph
Dear Christoph, I decided to try the 2D route you proposed for attaching 1D lead. I have graphene lattice with sublattices a , b and define a 1D lead as a 2D shape. sym = kwant.TranslationalSymmetry([1,0]) lead = kwant.Builder(sym) def lead_shape(pos): x,y = pos return (y==0) lead = kwant.Builder(sym) lead[lat.shape(lead_shape, (0, 0))] = 0 lead[lat.neighbors()] = 1.0 sys.leads.append(kwant.builder.BuilderLead(lead, [a(0, 0)])) This produces a error: (line 1213 of builder.py) 'interface site:\n' + str(iface_site)) ValueError: Problem finalizing lead 0: A site in interface_order is not an interface site: [-1 0] of Monatomic lattice 0, vectors [1.0 0.0], [0.5 0.866025403784], origin 0.0 0.0 Now I try to make a genuine 1D lead: sin_30, cos_30 = (1 / 2, sqrt(3) / 2) lat = kwant.lattice.general([(1, 0), (sin_30, cos_30)], [(0, 0), (0, 1 / sqrt(3))]) sys = kwant.Builder() a, b = lat.sublattices sys[lat.shape(central_region, (0, 0))] = onsite sys[lat.neighbors()] = hopping lat1D=kwant.lattice.chain() sym = kwant.TranslationalSymmetry([1]) lead = kwant.Builder(sym) lead[lat1D(0)] = 0 lead[lat.neighbors()] = 1.0 sys.leads.append(kwant.builder.BuilderLead(lead, [a(0, 0)])) This also does not work, giving a error: bravais_periods = np.dot(self._periods, inv) ValueError: Problem finalizing lead 0: matrices are not aligned Could you comment how to make this correctly, please. Best wishes, Sergey On 15/04/15 10:10, Christoph Groth wrote:
Hi Sergey,
Currently kwant.plotter.map() only works when site positions are 2-d. We could add a pos_transform argument (like in kwant.plot()). I've made a note about this.
For now, the cleanest solution will be to build your system as you did originally, i.e. with a 2-d scattering region and a 1-d lead. You cannot attach such a lead automatically using attach_lead(), but it’s actually very easy to attach it manually.
Unfortunately, the documentation of Kwant 1.0 doesn’t explain how to attach leads manually. But the one of the development version does. Have a look at the docstring of the class “Lead”: http://git.kwant-project.org/kwant/tree/kwant/builder.py#n433
Let’s say that you have a scattering region called “sys” and a lead called “lead”, both are instances of kwant.Builder with appropriate symmetries. “sys” contains sites from a 2-d lattice called “lat”. The site “lat(1, 2)” belongs to “sys” and that’s where you would like to attach the lead. Then all you have to do is this:
sys.leads.append(kwant.builder.BuilderLead(lead, [lat(1, 2)]))
Please see the documentation of kwant.builder.BuilderLead.
Every Builder instance has a list of attached leads, and you can simply append instances of kwant.builder.Lead to that list. attach_lead() actually does the same, but it determines the lead interface automatically and adds sites to the scattering region if necessary to create a clean interface.
Let me know if anything is unclear.
Christoph
participants (3)
-
Christoph Groth
-
Sergey
-
Xavier Waintal