def test_higher_dim(): # Test 0D finite system lat = kwant.lattice.cubic(norbs=1) syst = kwant.Builder() syst[lat(0, 0, 0)] = 1 syst[lat(1, 1, 0)] = 1 syst[lat(0, 1, 1)] = 1 syst[lat(1, 0, -1)] = 1 syst[lat(0, 0, 0), lat(1, 1, 0)] = -1 syst[lat(0, 0, 0), lat(0, 1, 1)] = -1 syst[lat(0, 0, 0), lat(1, 0, -1)] = -1 H = builder_to_model(syst) sg, cs = symmetries(H, prettify=True) assert len(sg) == 2 assert len(cs) == 5 # Test triangular lattice system embedded in 3D sym = TranslationalSymmetry([1, 1, 0], [0, 1, 1]) lat = kwant.lattice.cubic(norbs=1) syst = kwant.Builder(symmetry=sym) syst[lat(0, 0, 0)] = 1 syst[lat(0, 0, 0), lat(1, 1, 0)] = -1 syst[lat(0, 0, 0), lat(0, 1, 1)] = -1 syst[lat(0, 0, 0), lat(1, 0, -1)] = -1 H = builder_to_model(syst) sg, cs = symmetries(H, hexagonal(sympy_R=False), prettify=True) assert len(sg) == 24 assert len(cs) == 0
def test_honeycomb(): lat = kwant.lattice.honeycomb(norbs=1) # Test simple honeycomb model with constant terms # Add discrete symmetries to the kwant builder as well, to check that they are # returned as well. syst = kwant.Builder(symmetry=TranslationalSymmetry(*lat.prim_vecs)) syst[lat.a(0, 0)] = 1 syst[lat.b(0, 0)] = 1 syst[lat.neighbors(1)] = -1 H = builder_to_model(syst) sg, cs = symmetries(H, hexagonal(sympy_R=False), prettify=True) assert len(sg) == 24 assert len(cs) == 0 # Test simple honeycomb model with value functions syst = kwant.Builder(symmetry=TranslationalSymmetry(*lat.prim_vecs)) syst[lat.a(0, 0)] = lambda site, ma: ma syst[lat.b(0, 0)] = lambda site, mb: mb syst[lat.neighbors(1)] = lambda site1, site2, t: t H = builder_to_model(syst) sg, cs = symmetries(H, hexagonal(sympy_R=False), prettify=True) assert len(sg) == 12 assert len(cs) == 0