Attaching 3D Leads to a 3D System

From my knowledge, this should attach a 2D square lattice lead (or to be
Hello All, I am trying to attach a 3D lead to a 3D system that I have built, but am facing troubles in the same. I am aware of another thread ( https://mailman-mail5.webfaction.com/pipermail/kwant-discuss/2014-May/000125...) highlighting my question, but having gone through that thread I was still unable to successfully attach a lead to my system. Ideally, I want to attach gold leads to my system but I started by attaching a simple cubic lattice (by breaking it into 2 different lattices). Following is my code. *h = 2.707 * np.cos(13.69*np.pi/180)* *dx = 4.43* *dy = 3.27* *shift_x = 2.164 * np.cos(0.5*98.15*np.pi/180)* *shift_y = 2.164 * np.sin(0.5*98.15*np.pi/180)* *lat0 = kwant.lattice.general([(dx, 0, 0), (0, dy, 0)], [(0, 0, 0), (shift_x, shift_y, 0)])* *lat1 = kwant.lattice.general([(dx, 0, 0), (0, dy, 0)], [(0.5*dx, 0.5*dy, h), (0.5*dx + shift_x, 0.5*dy + shift_y, h)])* *a_const = 2* *b_const = 2* *c_const = 1* *def make_cuboid(a = a_const*dx, b = b_const*dy, c = c_const*h):* * def cuboid_shape(pos):* * x, y, z = pos* * return -a <= x <= a and -b <= y <= b and -c <= z <= c* * sys = kwant.Builder()* * sys[lat0.shape(cuboid_shape, (0, 0, 0))] = None* * sys[lat0.neighbors(1)] = 1* * sys[lat0.neighbors(2)] = 1* * sys[lat1.shape(cuboid_shape, (0.5*dx, 0.5*dy, h))] = None* * sys[lat1.neighbors(1)] = 1* * sys[lat1.neighbors(2)] = 1* * # Diagonally going up-right/down_left bonds* * for j in range(-a_const, a_const):* * for i in range(-b_const, b_const):* * sys[lat0.sublattices[1](j,i), lat1.sublattices[0](j,i)] = 1* * # Diagonally going up-left/down-right bonds* * for m in range(a_const, -a_const, -1):* * for n in range(-b_const, b_const):* * sys[lat0.sublattices[0](m,n), lat1.sublattices[1](m-1,n-1)] = 1* * # Define the leads* * lat0_lead = kwant.lattice.square(dy)* * sym_lead0 = kwant.TranslationalSymmetry((dy, 0))* * lead0 = kwant.Builder(sym_lead0)* * lead0[(lat0_lead(0, i) for i in range(-2,3))] = 0* * lead0[lat0_lead.neighbors()] = 1* * sys[(lat0_lead(3, i) for i in range(-2,3))] = 0* * sys[lat0_lead.neighbors()] = 1* * # Manually attach sites from the base (height=0) lattice to square lattice* * sys[((lat0_lead(3, i), lat0.sublattices[0](2, i)) for i in range(-2,3))] = 1* * def family_colors(site):* * if site.family == lat0.sublattices[0]:* * return 'b'* * elif site.family == lat0.sublattices[1]:* * return 'b'* * elif site.family == lat1.sublattices[0]:* * return 'g'* * elif site.family == lat1.sublattices[1]:* * return 'g'* * kwant.plot(sys, site_size=0.2, hop_lw=0.1, site_color=family_colors)* * return sys.finalized()* *def main():* * sys = make_cuboid()* *if __name__ == '__main__':* * main()* precise, just 1 layer of the 2D square lattice lead as shown in https://kwant-project.org/doc/1.3/tutorial/faq) to one side of my 3D system. I would be really glad if someone could help me out with this problem. Best Regards, Shivang -- *Shivang Agarwal* Senior Undergraduate Discipline of Electrical Engineering IIT Gandhinagar Contact: +91-9869321451

Hi,
I am trying to attach a 3D lead to a 3D system that I have built, but am facing troubles in the same. I am aware of another thread (https://mailman-mail5.webfaction.com/pipermail/kwant-discuss/2014-May/000125...) highlighting my question, but having gone through that thread I was still unable to successfully attach a lead to my system.
Ideally, I want to attach gold leads to my system but I started by attaching a simple cubic lattice (by breaking it into 2 different lattices). Following is my code.
You define your scattering region over what you call 'lat0' and 'lat1', which are 2D lattices *embedded in 3D space*. You then create a new lattice 'lat0_lead' using 'kwant.lattice.square', which creates a 2D lattice *embedded in 2D space*. You then add sites from 'lat0_lead' to the scattering region, so the scattering region now contains sites that are embedded in 2D realspace and 3D realspace. Kwant is totally fine with this, but the plotter does not know how to plot this, so an exception is raised. You can easily get around this by defining 'lat0_lead' to be a 2D lattice embedded in 3D: # 2 orthogonal lattice vectors in 3D space lat0_lead = kwant.lattice.general([(dy, 0, 0), (0, dy, 0)]) sym_lead0 = kwant.TranslationalSymmetry((dy, 0, 0)) The exception raised is:
ValueError: Input has irregular shape.
This is a bit cryptic, and I've opened an issue [1] against this usability bug, Happy Kwanting, Joe P.S. I also note that *you never actually attach the lead that you created*; is this really what you want? [1]: https://gitlab.kwant-project.org/kwant/kwant/issues/222

Hi Joseph, Thank you for the quick response. I now understand the reasoning behind the error that I was getting. The code now works as I want it to. PS - I was following the methodology explained in https://kwant-project.org/doc/1.3/tutorial/faq. Here, it was suggested that since the lattice are different for the lead and the system, it is first necessary to manually attach a one atom thick layer of lead to the system (which I was doing using *sys[((lat0_lead(3, i), lat0.sublattices[0](2, i)) for i in range(-2,3))] = 1*). Once this one atom layer is attached, I would then attach the lead to this layer, rather than the system directly. Thank you. Shivang On Mon, Aug 20, 2018 at 6:50 PM Joseph Weston <joseph.weston08@gmail.com> wrote:
Hi,
I am trying to attach a 3D lead to a 3D system that I have built, but am facing troubles in the same. I am aware of another thread (
https://mailman-mail5.webfaction.com/pipermail/kwant-discuss/2014-May/000125... )
highlighting my question, but having gone through that thread I was still unable to successfully attach a lead to my system.
Ideally, I want to attach gold leads to my system but I started by attaching a simple cubic lattice (by breaking it into 2 different lattices). Following is my code.
You define your scattering region over what you call 'lat0' and 'lat1', which are 2D lattices *embedded in 3D space*.
You then create a new lattice 'lat0_lead' using 'kwant.lattice.square', which creates a 2D lattice *embedded in 2D space*.
You then add sites from 'lat0_lead' to the scattering region, so the scattering region now contains sites that are embedded in 2D realspace and 3D realspace. Kwant is totally fine with this, but the plotter does not know how to plot this, so an exception is raised.
You can easily get around this by defining 'lat0_lead' to be a 2D lattice embedded in 3D:
# 2 orthogonal lattice vectors in 3D space lat0_lead = kwant.lattice.general([(dy, 0, 0), (0, dy, 0)]) sym_lead0 = kwant.TranslationalSymmetry((dy, 0, 0))
The exception raised is:
ValueError: Input has irregular shape.
This is a bit cryptic, and I've opened an issue [1] against this usability bug,
Happy Kwanting,
Joe
P.S. I also note that *you never actually attach the lead that you created*; is this really what you want?
[1]: https://gitlab.kwant-project.org/kwant/kwant/issues/222
-- *Shivang Agarwal* Senior Undergraduate Discipline of Electrical Engineering IIT Gandhinagar Contact: +91-9869321451
participants (2)
-
Joseph Weston
-
Shivang Agarwal