Hi,

The problem is that your ‘lat’ lattice exists in R^3, whereas your ‘honeycomb’ lattice exists in R^2. Kwant won’t try to guess what embedding you want to use for the ‘honeycomb’ lattice, so if you want to use both in the same system you
will have to specify your honeycomb lattice using vectors in R^3.

If, for example, you wanted to embed your honeycomb lattice in the x-y plane you would do:

honeycomb = kwant.lattice.general([(1, 0, 0), (1 / 2, sqrt(3) / 2, 0)], [(0, 0, 0), (0, 1 / sqrt(3), 0)])

Note the extra zeros compared to the vectors provided in your code.

It’s true that the error message is not very informative in this case. There is actually an issue already open about this:
https://gitlab.kwant-project.org/kwant/kwant/-/issues/222, however nobody yet took the time to fix it.

Happy Kwanting,

Joe

**From:** Kwant-discuss <kwant-discuss-bounces@kwant-project.org>
**On Behalf Of **tavakkolidjawad

**Sent:** Sunday, May 3, 2020 9:10 AM

**To:** kwant-discuss@kwant-project.org

**Subject:** [EXTERNAL] [Kwant] An issue with plotting two systems with different dimension in one system

dear all

I want to plot two different structures in one system. Although it is easy to plot separate lattices with the same structure, I will not be able to solve the problem
when the structures are different. For example, I plotted two lattices with the same diamond structure, but when I replaced one of them with a honeycomb structure, I got an error after plotting the system. Apparently and logically, I think there is no bug
in my code.

Is there a way to solve this problem?

I ask you to take a look at my code and report any possible bugs to me.

Thanks

###################################################################

import kwant

from math import sqrt

lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5, 0)],

[(15, 15, 15), (15.25, 15.25, 15.25)], name=['a1', 'a2'])

a1, a2 = lat.sublattices

honeycomb = kwant.lattice.general([(1, 0), (1 / 2, sqrt(3) / 2)],

[(0, 0), (0, 1 / sqrt(3))])

subA , subB = honeycomb.sublattices

def make_system(a=25, b=25, c=30):

syst = kwant.Builder()

def cuboid_shape(pos):

x, y, z = pos

return 15 <= x < a and 15 <= y < b and 15 <= z < c

syst[a1.shape(cuboid_shape, (15, 15, 15))] = 1

syst[a2.shape(cuboid_shape, (15, 15, 15))] = 1

syst[lat.neighbors()] = 1

def graphene_shape(pos):

x,y = pos

return 0 <= x < 10 and 0 <= y < 10

syst[honeycomb.shape(graphene_shape,(0,0))] = 1

syst[honeycomb.neighbors()] = 1

return syst

def main():

syst= make_system()

kwant.plot(syst)

syst = make_system(a=1.1, b=1.1, c=1.1)

if __name__ == '__main__':

main()

###################################################################