In [1]:
from __future__ import print_function, division

import kwant

import numpy as np
from numpy import sqrt
%matplotlib inline

Define the system

In [2]:
HZ = sqrt(6) / 6.0
h = 1 / (sqrt(3) * 4)
lat = kwant.lattice.general([(1, 0, 0), (0.5, -sqrt(3) * 0.5, 0), (0, 1 / sqrt(3), 2 * HZ)],
                            [(0, 0, 0), (0.5, 0, 0), (0.25, -0.25 * sqrt(3), 0), (0.25, -h, HZ)])

def make_latticeperiodic_pyrochlore_slab(t_1, t_2, t_perp, lambda_1, lambda_2, shape=(5, 4, 2)):
    """
    create a pyrochlore slab in a parallelepiped shape,a s given by the lattice vectors
    with periodic boundary conditions along the second lattice vector
    and leads attached at tle left and right (x direction)
    """
    a, b, c, d = lat.sublattices

    def initialize_hopping(sys):
        # construct all hoppings with SO explicit
        sys[kwant.HoppingKind((0, 0, 0), b, a)] = t_1 + 1j * lambda_1
        sys[kwant.HoppingKind((-1, 0, 0), b, a)] = t_1 - 1j * lambda_1

        sys[kwant.HoppingKind((0, 0, 0), c, a)] = t_1 - 1j * lambda_1
        sys[kwant.HoppingKind((0, -1, 0), c, a)] = t_1 - 1j * lambda_1

        sys[kwant.HoppingKind((0, 0, 0), c, b)] = t_1 + 1j * lambda_1
        sys[kwant.HoppingKind((1, -1, 0), c, b)] = t_1 + 1j * lambda_1

        # construct all NNN hoppings with SO explicit
        sys[kwant.HoppingKind((0, -1, 0), b, a)] = t_2 - 1j * lambda_2
        sys[kwant.HoppingKind((-1, 1, 0), b, a)] = t_2 - 1j * lambda_2

        sys[kwant.HoppingKind((-1, 0, 0), c, a)] = t_2 + 1j * lambda_2
        sys[kwant.HoppingKind((1, -1, 0), c, a)] = t_2 + 1j * lambda_2

        sys[kwant.HoppingKind((0, -1, 0), c, b)] = t_2 - 1j * lambda_2
        sys[kwant.HoppingKind((1, 0, 0), c, b)] = t_2 - 1j * lambda_2

        nn_hoppings = lat.neighbors(n=1)
        for hop in nn_hoppings:
            # hoppings in z-direction
            if hop.family_a == d or hop.family_b == d:
                sys[hop] = t_perp

    # Build ancillary system with y-periodic BCs.  This system cannot be
    # finalized in Kwant 1.0.
    sym = kwant.TranslationalSymmetry(lat.vec((0, shape[1], 0)))

    anc = kwant.Builder(sym)
    anc[lat.shape(lambda p: 0 <= p[0] < shape[0] and 0 <= p[2] < shape[2], (0, 0, 0))] = None
    initialize_hopping(anc)

    sys = kwant.Builder()

    sys[anc.sites()] = 0
    for s1, s2 in anc.hoppings():
        sys[sym.to_fd(s1), sym.to_fd(s2)] = anc[s1, s2]

    # leads
    # TRICK ancestor only periodic in Y-direction to catch also the x-direction hoppings later on
    anc_sym = kwant.TranslationalSymmetry(lat.vec((0, shape[1], 0)))

    anc_lead = kwant.Builder(anc_sym)
    anc_lead[lat.shape(lambda p: -2 <= p[0] <= 2 and 0 <= p[2] < shape[2], (0, 0, 0))] = 0
    initialize_hopping(anc_lead)

    # at the left
    lead_symmetry = kwant.TranslationalSymmetry(lat.vec([-1, 0, 0]))
    lead = kwant.Builder(lead_symmetry)

    lead[anc_lead.sites()] = 0
    for s1 in anc_lead.sites():
        lead[s1] = 1

    for s1, s2 in anc_lead.hoppings():
        lead[s1, anc_sym.to_fd(s2)] = anc_lead[s1, s2]

    sys.attach_lead(lead)
    # and right
    sys.attach_lead(lead.reversed())

    sys.parameter = dict(t_1=t_1,
                         t_2=t_2,
                         t_perp=t_perp,
                         lambda_1=lambda_1,
                         lambda_2=lambda_2,
                         shape=shape,
                         peridoic=True)
    return sys, lat


def make_periodic_pyrochlore_slab(t_1, t_2, t_perp, lambda_1, lambda_2, shape=(5, 4, 2)):
    """
    create a pyrochlore slab in a rectangular shape
    with periodic boundary conditions in y-direction
    and leads attached at tle left and right (x direction)
    """
    a, b, c, d = lat.sublattices

    def initialize_hopping(sys):
        # construct all hoppings with SO explicit
        sys[kwant.HoppingKind((0, 0, 0), b, a)] = t_1 + 1j * lambda_1
        sys[kwant.HoppingKind((-1, 0, 0), b, a)] = t_1 - 1j * lambda_1

        sys[kwant.HoppingKind((0, 0, 0), c, a)] = t_1 - 1j * lambda_1
        sys[kwant.HoppingKind((0, -1, 0), c, a)] = t_1 - 1j * lambda_1

        sys[kwant.HoppingKind((0, 0, 0), c, b)] = t_1 + 1j * lambda_1
        sys[kwant.HoppingKind((1, -1, 0), c, b)] = t_1 + 1j * lambda_1

        # construct all NNN hoppings with SO explicit
        sys[kwant.HoppingKind((0, -1, 0), b, a)] = t_2 - 1j * lambda_2
        sys[kwant.HoppingKind((-1, 1, 0), b, a)] = t_2 - 1j * lambda_2

        sys[kwant.HoppingKind((-1, 0, 0), c, a)] = t_2 + 1j * lambda_2
        sys[kwant.HoppingKind((1, -1, 0), c, a)] = t_2 + 1j * lambda_2

        sys[kwant.HoppingKind((0, -1, 0), c, b)] = t_2 - 1j * lambda_2
        sys[kwant.HoppingKind((1, 0, 0), c, b)] = t_2 - 1j * lambda_2

        nn_hoppings = lat.neighbors(n=1)
        for hop in nn_hoppings:
            # hoppings in z-direction
            if hop.family_a == d or hop.family_b == d:
                sys[hop] = t_perp

    # Build ancillary system with y-periodic BCs.  This system cannot be
    # finalized in Kwant 1.0.
    sym = kwant.TranslationalSymmetry(lat.vec((-shape[1] / 2, shape[1], 0)))

    # Define unit cell ('fundamental domain') to be along y-axis and not along lattice vector
    for fam in (a, b, c, d):
        sym.add_site_family(fam, other_vectors=[[-1, 0, 0], [-1, 2, 3]])

    anc = kwant.Builder(sym)
    anc[lat.shape(lambda p: 0 <= p[0] < shape[0] and 0 <= p[2] < shape[2], (0, 0, 0))] = None
    initialize_hopping(anc)

    sys = kwant.Builder()

    sys[anc.sites()] = 0
    for s1, s2 in anc.hoppings():
        sys[sym.to_fd(s1), sym.to_fd(s2)] = anc[s1, s2]

    # leads
    # TRICK ancestor only periodic in Y-direction to catch also the x-direction hoppings later on
    anc_sym = kwant.TranslationalSymmetry(lat.vec((-shape[1] / 2, shape[1], 0)))

    # Define unit cell ('fundamental domain') to be along y-axis and not along lattice vector
    for fam in (a, b, c, d):
        anc_sym.add_site_family(fam, other_vectors=[[-1, 0, 0], [-1, 2, 3]])

    anc_lead = kwant.Builder(anc_sym)
    anc_lead[lat.shape(lambda p: -2 <= p[0] <= 2 and 0 <= p[2] < shape[2], (0, 0, 0))] = 0
    initialize_hopping(anc_lead)

    # at the left
    lead_symmetry = kwant.TranslationalSymmetry(lat.vec([-1, 0, 0]))
    lead = kwant.Builder(lead_symmetry)

    # Define unit cell ('fundamental domain') to be along y-axis and not along lattice vector
    for fam in (a, b, c, d):
        lead_symmetry.add_site_family(fam, other_vectors=[[-1, 2, 0], [-1, 2, 3]])

    lead[anc_lead.sites()] = 0
    for s1 in anc_lead.sites():
        lead[s1] = 1

    for s1, s2 in anc_lead.hoppings():
        lead[s1, anc_sym.to_fd(s2)] = anc_lead[s1, s2]

    sys.attach_lead(lead)
    # and right
    sys.attach_lead(lead.reversed())

    sys.parameter = dict(t_1=t_1,
                         t_2=t_2,
                         t_perp=t_perp,
                         lambda_1=lambda_1,
                         lambda_2=lambda_2,
                         shape=shape,
                         peridoic=True)
    return sys, lat
In [3]:
#lattice
sys, lat = make_latticeperiodic_pyrochlore_slab(
    t_1=-1, t_2=0.3, t_perp=1, lambda_1=0.3, lambda_2=0.2, shape=(5,8,(4*2-1)*HZ))

sys2, lat2 = make_periodic_pyrochlore_slab(
    t_1=-1, t_2=0.3, t_perp=1, lambda_1=0.3, lambda_2=0.2, shape=(5,8,(4*2-1)*HZ))
In [4]:
lattice_sys = sys.finalized()
In [5]:
rectangle_sys = sys2.finalized()

QZ iteration fails

In [6]:
kwant.smatrix(rectangle_sys, 1.5).transmission(0, 1)
---------------------------------------------------------------------------
LinAlgError                               Traceback (most recent call last)
<ipython-input-6-a3d46ac6196b> in <module>()
----> 1 kwant.smatrix(rectangle_sys, 1.5).transmission(0, 1)

/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/solvers/common.pyc in smatrix(self, sys, energy, args, out_leads, in_leads, check_hermiticity)
    336 
    337         linsys, lead_info = self._make_linear_sys(sys, in_leads, energy, args,
--> 338                                                   check_hermiticity, False)
    339 
    340         kept_vars = np.concatenate([vars for i, vars in

/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/solvers/common.pyc in _make_linear_sys(self, sys, in_leads, energy, args, check_hermiticity, realspace)
    171             lead = sys.leads[leadnum]
    172             if not realspace:
--> 173                 prop, stab = lead.modes(energy, args)
    174                 lead_info.append(prop)
    175                 u, ulinv, nprop, svd_v = \

/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/system.pyc in modes(self, energy, args)
    211         # Subtract energy from the diagonal.
    212         ham.flat[::ham.shape[0] + 1] -= energy
--> 213         return physics.modes(ham, self.inter_cell_hopping(args))
    214 
    215     def selfenergy(self, energy=0, args=()):

/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/physics/leads.pyc in modes(h_cell, h_hop, tol, stabilization)
    581     matrices, v, extract = setup_linsys(h_cell, h_hop, tol, stabilization)
    582     ev, evanselect, propselect, vec_gen, ord_schur =\
--> 583          unified_eigenproblem(*(matrices + (tol,)))
    584 
    585     if v is not None:

/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/physics/leads.pyc in unified_eigenproblem(a, b, tol)
    374     else:
    375         eps = np.finfo(np.common_type(a, b)).eps * tol
--> 376         s, t, z, alpha, beta = kla.gen_schur(a, b, calc_q=False)
    377 
    378         # Right-decaying modes.

/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/linalg/decomp_schur.pyc in gen_schur(a, b, calc_q, calc_z, calc_ev, overwrite_ab)
    379     gges = getattr(lapack, ltype + "gges")
    380 
--> 381     return gges(a, b, calc_q, calc_z, calc_ev)
    382 
    383 

kwant/linalg/lapack.pyx in kwant.linalg.lapack.zgges (kwant/linalg/lapack.c:28482)()

LinAlgError: QZ iteration failed to converge in zgges

But it works on the lattice-periodic system

In [7]:
kwant.smatrix(lattice_sys, 1.5).transmission(0, 1)
Out[7]:
2.2074478672169042

Persists over large range:

List all energies for which we get the QZ Error

In [8]:
energies = np.linspace(-5, 5, 100)
conductances = []
failures = []
for en in energies:
    try:
        conductances.append((en, kwant.smatrix(rectangle_sys, en).transmission(0, 1)))
    except kwant.linalg.lapack.LinAlgError:
        failures.append(en)
    
In [9]:
failures
Out[9]:
[-1.4646464646464645,
 -1.3636363636363638,
 -1.2626262626262625,
 -1.1616161616161618,
 -1.0606060606060606,
 -0.95959595959595934,
 -0.85858585858585901,
 -0.75757575757575779,
 -0.65656565656565657,
 -0.55555555555555536,
 -0.45454545454545503,
 -0.35353535353535381,
 -0.2525252525252526,
 -0.15151515151515138,
 -0.050505050505050164,
 0.050505050505050164,
 0.15151515151515138,
 0.2525252525252526,
 0.35353535353535381,
 0.45454545454545414,
 0.55555555555555536,
 0.65656565656565657,
 0.75757575757575779,
 0.85858585858585812,
 0.95959595959595934,
 1.0606060606060606,
 1.1616161616161618,
 1.2626262626262621,
 1.3636363636363633,
 1.4646464646464645,
 1.5656565656565657,
 1.666666666666667,
 1.7676767676767673,
 1.8686868686868685,
 1.9696969696969697,
 2.0707070707070709,
 2.1717171717171713,
 2.2727272727272725,
 2.3737373737373737,
 2.4747474747474749,
 2.5757575757575752,
 2.6767676767676765,
 2.7777777777777777,
 2.8787878787878789,
 2.9797979797979792,
 3.0808080808080813,
 3.1818181818181817,
 3.282828282828282,
 3.3838383838383841,
 3.4848484848484844,
 3.5858585858585865,
 3.6868686868686869,
 3.7878787878787872,
 3.8888888888888893,
 3.9898989898989896,
 4.0909090909090899,
 4.191919191919192,
 4.2929292929292924,
 4.3939393939393945,
 4.4949494949494948,
 4.5959595959595951,
 4.6969696969696972,
 4.7979797979797976,
 4.8989898989898997,
 5.0]
In [10]:
conductances
Out[10]:
[(-5.0, 0.0),
 (-4.8989898989898988, 0.0),
 (-4.7979797979797976, 0.0),
 (-4.6969696969696972, 0.0),
 (-4.595959595959596, 0.0),
 (-4.4949494949494948, 0.0),
 (-4.3939393939393936, 0.0),
 (-4.2929292929292933, 0.0),
 (-4.191919191919192, 0.0),
 (-4.0909090909090908, 0.0),
 (-3.9898989898989896, 0.0),
 (-3.8888888888888888, 0.55007622553035029),
 (-3.7878787878787881, 0.60532002089835035),
 (-3.6868686868686869, 1.1607366729190312),
 (-3.5858585858585856, 0.92724644062407424),
 (-3.4848484848484849, 1.3571868690307214),
 (-3.3838383838383841, 2.7535432149985439),
 (-3.2828282828282829, 3.3011378020055369),
 (-3.1818181818181817, 2.9184723900002503),
 (-3.0808080808080809, 0.55372680080489989),
 (-2.9797979797979797, 1.0444039180610929),
 (-2.8787878787878789, 1.2345496926130244),
 (-2.7777777777777777, 0.97824254804513178),
 (-2.6767676767676769, 1.1751680631019943),
 (-2.5757575757575757, 0.19384105607673346),
 (-2.4747474747474749, 1.2874564707397094),
 (-2.3737373737373737, 0.26279405116941068),
 (-2.2727272727272729, 0.094029059607324175),
 (-2.1717171717171717, 0.00458795629984937),
 (-2.0707070707070709, 0.0014454478322902143),
 (-1.9696969696969697, 0.0036447436870508205),
 (-1.868686868686869, 0.0010561508098405376),
 (-1.7676767676767677, 0.00040740066465199087),
 (-1.6666666666666665, 0.0013185156055019946),
 (-1.5656565656565657, 0.0068671498540652043)]
In [ ]: