Hi! Please check the documentation for lattice.shape over here: https://kwant-project.org/doc/1/reference/generated/kwant.lattice.Polyatomic#kwant.lattice.Polyatomic.shape
Let me know if the documentation or the error message are unclear then. Best, Anton On Mon, 16 Dec 2019 at 10:09, tavakkolidjawad <tavakkolidja...@ut.ac.ir> wrote: > > > Hello everyone > > I want to create a lead for a 3D structure, but when I run the program, I get > the following error: > > ###No sites close to (0, 0, 14) are inside the desired shape.### > > Please help me find the mistake. > > > > Thanks in advance for your reply. > > > #### > > import kwant > from matplotlib import pyplot > > > lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5, 0)], > [(0, 0, 0), (0.25, 0.25, 0.25)], name=['a1', 'a2']) > a1, a2 = lat.sublattices > > > def make_cuboid(a=10, b=10, c=15): > def cuboid_shape(pos): > x, y, z = pos > return 0 <= x < a and 0 <= y < b and 0 <= z < c > > > > syst = kwant.Builder() > syst[a1.shape(cuboid_shape, (0, 0, 0))] = 1 ## the same on-site foar a1 and b1 > syst[a2.shape(cuboid_shape, (0, 0, 0))] = 1 > syst[lat.neighbors()] = 1 > > > def lead_shape(pos): > x,y,z = pos > return 0 <= x < a and 0 <= y < b and 14 <= z < c > > lead = kwant.Builder(kwant.TranslationalSymmetry([1,0,0])) > lead[lat.shape(lead_shape, (0, 0, 14))] = 1 > lead[lat.neighbors()] = 1 > > > return syst,lead > > def main(): > > syst,lead = make_cuboid() > > kwant.plot(syst) > > syst = syst.finalized() > > syst = make_cuboid(a=1.1, b=1.1, c=1.1) > > def family_colors(site): > return 'r' if site.family == a1 else 'g' > > syst.attach_lead(lead) > > > kwant.plot(syst, site_size=0.18, site_lw=0.01, hop_lw=0.05, > site_color=family_colors) > > > > if __name__ == '__main__': > main() > > #####