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 <[email protected]> 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.html > ) > > 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
