On 2019-11-30 12:58, Adel Belayadi wrote: That was great. Thank you
> Dear Tavakkolidjawad, > Good day > Zinc blende and diamond have closely related structures. The key difference > between zinc blende and diamond structure is that zinc blende has both zinc > and sulfur atoms in its structure while diamond structure has only carbon > atoms in its structure. Additionally, alternative example is graphene and > h-BN (Hexagonal Boron Nitride) since both have the same lattice (honeycomb > lattice), but for the h-BN, the Onsite_energy_of_B differ from the > Onsite_ennergy_of_N that why we have a gap (masse term). > So what does this mean in your case. It means that we use the zinc blend > lattice as defined in kwant tutorial (the exact code you have written down). > Let as say > a1 , a2 = lat.sublattices > Here relevent_on_site_for_a1 = relevent_on_site_for_a2= Onsite > syst[a1.shape(cuboid_shape, (0, 0, 0))] = Onsite > syst[a2.shape(cuboid_shape, (0, 0, 0))] = Onsite > or simply use as was givene syst[lat.shape(cuboid_shape, (0, 0, 0))] = Onsite > However in the zinc blende structure, we have to be cerful since > relevent_on_site_for_a1 does not equal relevent_on_site_for_a2. For this > purpose we write > syst[a1.shape(cuboid_shape, (0, 0, 0))] = relevent_on_site_for_a1 > syst[a2.shape(cuboid_shape, (0, 0, 0))] = relevent_on_site_for_a2 > > ## In the kwant example was left as None and is up to you to decide what to > do. > You have also to care about the hopping since you have a 3D shape. > 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=1.1, b=1.1, c=1.1): > 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 > return syst > def family_colors(site): > return 'r' if site.family == a1 else 'g' > ### Conventional unit cell "FCC" > syst = make_cuboid(a=1.1, b=1.1, c=1.1) > kwant.plot(syst, site_size=0.18, site_lw=0.01, hop_lw=0.05, > site_color=family_colors) > pyplot.show() > > Also, to see the unit cell of the system please see the following scryprt > #### To see the unit cell here the code > 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)]) > a, b = lat.sublattices > def cuboid_shape(pos, a= 2, b = 2, c = 2): > x, y, z = pos > return 0 <= x < a and 0 <= y < b and 0 <= z < c > sym = kwant.TranslationalSymmetry(lat.vec((1, 0, 0)), lat.vec((0, 1, 0)), > lat.vec((0, 0, 1))) > syst = kwant.Builder(sym) > syst[lat.shape(cuboid_shape, (0, 0, 0))] = 1 > syst[lat.neighbors(1)] = 1 > def wraparound_syst(syst): > return kwant.wraparound.wraparound(syst).finalized() > unit_cell = wraparound_syst(syst) > kwant.plot(unit_cell, site_size=0.2, site_lw=0.012) > pyplot.show() > > Ref[1]: > https://www.differencebetween.com/difference-between-zinc-blende-and-diamond-structure/ > > Hope was helpful > Regards, Adel > > Le sam. 30 nov. 2019 à 07:15, tavakkolidjawad <tavakkolidja...@ut.ac.ir> a > écrit : > >> Hi dears >> >> Based on the code for zincblende structure inside the Kwant website, I want >> to build a diamond lattice, but I don't know what I need to change in this >> code to create a diamond structure, also I need to create one lead for this >> structure. >> >> can you help me? >> >> Thank you in advance. >> >>>>> 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)]) >>>>> a, b = lat.sublattices >> >>>>> def make_cuboid(a=15, b=10, c=5): >> def cuboid_shape(pos): >> x, y, z = pos >> return 0 <= x < a and 0 <= y < b and 0 <= z < c >> >>>>> syst = kwant.Builder() >>>>> syst[lat.shape(cuboid_shape, (0, 0, 0))] = None >>>>> syst[lat.neighbors()] = None >> >>>>> return syst >> >>>>> def main(): >>>>> # the standard plotting style for 3D is mainly useful for >>>>> # checking shapes: >>>>> syst = make_cuboid() >> >>>>> kwant.plot(syst) >> >>>>> # visualize the crystal structure better for a very small system >>>>> syst = make_cuboid(a=1.5, b=1.5, c=1.5) >> >>>>> def family_colors(site): >> return 'r' if site.family == a else 'g' >> >>>>> kwant.plot(syst, site_size=0.18, site_lw=0.01, >>>>> hop_lw=0.05)#,site_color=family_colors) >> >>>>> if __name__ == '__main__': >> main()