Created
August 5, 2015 08:51
-
-
Save faucon/729050da5e3f2eae1bb8 to your computer and use it in GitHub Desktop.
QZ iteration Error in kwant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from __future__ import print_function, division\n", | |
"\n", | |
"import kwant\n", | |
"\n", | |
"import numpy as np\n", | |
"from numpy import sqrt\n", | |
"%matplotlib inline" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Define the system" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"HZ = sqrt(6) / 6.0\n", | |
"h = 1 / (sqrt(3) * 4)\n", | |
"lat = kwant.lattice.general([(1, 0, 0), (0.5, -sqrt(3) * 0.5, 0), (0, 1 / sqrt(3), 2 * HZ)],\n", | |
" [(0, 0, 0), (0.5, 0, 0), (0.25, -0.25 * sqrt(3), 0), (0.25, -h, HZ)])\n", | |
"\n", | |
"def make_latticeperiodic_pyrochlore_slab(t_1, t_2, t_perp, lambda_1, lambda_2, shape=(5, 4, 2)):\n", | |
" \"\"\"\n", | |
" create a pyrochlore slab in a parallelepiped shape,a s given by the lattice vectors\n", | |
" with periodic boundary conditions along the second lattice vector\n", | |
" and leads attached at tle left and right (x direction)\n", | |
" \"\"\"\n", | |
" a, b, c, d = lat.sublattices\n", | |
"\n", | |
" def initialize_hopping(sys):\n", | |
" # construct all hoppings with SO explicit\n", | |
" sys[kwant.HoppingKind((0, 0, 0), b, a)] = t_1 + 1j * lambda_1\n", | |
" sys[kwant.HoppingKind((-1, 0, 0), b, a)] = t_1 - 1j * lambda_1\n", | |
"\n", | |
" sys[kwant.HoppingKind((0, 0, 0), c, a)] = t_1 - 1j * lambda_1\n", | |
" sys[kwant.HoppingKind((0, -1, 0), c, a)] = t_1 - 1j * lambda_1\n", | |
"\n", | |
" sys[kwant.HoppingKind((0, 0, 0), c, b)] = t_1 + 1j * lambda_1\n", | |
" sys[kwant.HoppingKind((1, -1, 0), c, b)] = t_1 + 1j * lambda_1\n", | |
"\n", | |
" # construct all NNN hoppings with SO explicit\n", | |
" sys[kwant.HoppingKind((0, -1, 0), b, a)] = t_2 - 1j * lambda_2\n", | |
" sys[kwant.HoppingKind((-1, 1, 0), b, a)] = t_2 - 1j * lambda_2\n", | |
"\n", | |
" sys[kwant.HoppingKind((-1, 0, 0), c, a)] = t_2 + 1j * lambda_2\n", | |
" sys[kwant.HoppingKind((1, -1, 0), c, a)] = t_2 + 1j * lambda_2\n", | |
"\n", | |
" sys[kwant.HoppingKind((0, -1, 0), c, b)] = t_2 - 1j * lambda_2\n", | |
" sys[kwant.HoppingKind((1, 0, 0), c, b)] = t_2 - 1j * lambda_2\n", | |
"\n", | |
" nn_hoppings = lat.neighbors(n=1)\n", | |
" for hop in nn_hoppings:\n", | |
" # hoppings in z-direction\n", | |
" if hop.family_a == d or hop.family_b == d:\n", | |
" sys[hop] = t_perp\n", | |
"\n", | |
" # Build ancillary system with y-periodic BCs. This system cannot be\n", | |
" # finalized in Kwant 1.0.\n", | |
" sym = kwant.TranslationalSymmetry(lat.vec((0, shape[1], 0)))\n", | |
"\n", | |
" anc = kwant.Builder(sym)\n", | |
" anc[lat.shape(lambda p: 0 <= p[0] < shape[0] and 0 <= p[2] < shape[2], (0, 0, 0))] = None\n", | |
" initialize_hopping(anc)\n", | |
"\n", | |
" sys = kwant.Builder()\n", | |
"\n", | |
" sys[anc.sites()] = 0\n", | |
" for s1, s2 in anc.hoppings():\n", | |
" sys[sym.to_fd(s1), sym.to_fd(s2)] = anc[s1, s2]\n", | |
"\n", | |
" # leads\n", | |
" # TRICK ancestor only periodic in Y-direction to catch also the x-direction hoppings later on\n", | |
" anc_sym = kwant.TranslationalSymmetry(lat.vec((0, shape[1], 0)))\n", | |
"\n", | |
" anc_lead = kwant.Builder(anc_sym)\n", | |
" anc_lead[lat.shape(lambda p: -2 <= p[0] <= 2 and 0 <= p[2] < shape[2], (0, 0, 0))] = 0\n", | |
" initialize_hopping(anc_lead)\n", | |
"\n", | |
" # at the left\n", | |
" lead_symmetry = kwant.TranslationalSymmetry(lat.vec([-1, 0, 0]))\n", | |
" lead = kwant.Builder(lead_symmetry)\n", | |
"\n", | |
" lead[anc_lead.sites()] = 0\n", | |
" for s1 in anc_lead.sites():\n", | |
" lead[s1] = 1\n", | |
"\n", | |
" for s1, s2 in anc_lead.hoppings():\n", | |
" lead[s1, anc_sym.to_fd(s2)] = anc_lead[s1, s2]\n", | |
"\n", | |
" sys.attach_lead(lead)\n", | |
" # and right\n", | |
" sys.attach_lead(lead.reversed())\n", | |
"\n", | |
" sys.parameter = dict(t_1=t_1,\n", | |
" t_2=t_2,\n", | |
" t_perp=t_perp,\n", | |
" lambda_1=lambda_1,\n", | |
" lambda_2=lambda_2,\n", | |
" shape=shape,\n", | |
" peridoic=True)\n", | |
" return sys, lat\n", | |
"\n", | |
"\n", | |
"def make_periodic_pyrochlore_slab(t_1, t_2, t_perp, lambda_1, lambda_2, shape=(5, 4, 2)):\n", | |
" \"\"\"\n", | |
" create a pyrochlore slab in a rectangular shape\n", | |
" with periodic boundary conditions in y-direction\n", | |
" and leads attached at tle left and right (x direction)\n", | |
" \"\"\"\n", | |
" a, b, c, d = lat.sublattices\n", | |
"\n", | |
" def initialize_hopping(sys):\n", | |
" # construct all hoppings with SO explicit\n", | |
" sys[kwant.HoppingKind((0, 0, 0), b, a)] = t_1 + 1j * lambda_1\n", | |
" sys[kwant.HoppingKind((-1, 0, 0), b, a)] = t_1 - 1j * lambda_1\n", | |
"\n", | |
" sys[kwant.HoppingKind((0, 0, 0), c, a)] = t_1 - 1j * lambda_1\n", | |
" sys[kwant.HoppingKind((0, -1, 0), c, a)] = t_1 - 1j * lambda_1\n", | |
"\n", | |
" sys[kwant.HoppingKind((0, 0, 0), c, b)] = t_1 + 1j * lambda_1\n", | |
" sys[kwant.HoppingKind((1, -1, 0), c, b)] = t_1 + 1j * lambda_1\n", | |
"\n", | |
" # construct all NNN hoppings with SO explicit\n", | |
" sys[kwant.HoppingKind((0, -1, 0), b, a)] = t_2 - 1j * lambda_2\n", | |
" sys[kwant.HoppingKind((-1, 1, 0), b, a)] = t_2 - 1j * lambda_2\n", | |
"\n", | |
" sys[kwant.HoppingKind((-1, 0, 0), c, a)] = t_2 + 1j * lambda_2\n", | |
" sys[kwant.HoppingKind((1, -1, 0), c, a)] = t_2 + 1j * lambda_2\n", | |
"\n", | |
" sys[kwant.HoppingKind((0, -1, 0), c, b)] = t_2 - 1j * lambda_2\n", | |
" sys[kwant.HoppingKind((1, 0, 0), c, b)] = t_2 - 1j * lambda_2\n", | |
"\n", | |
" nn_hoppings = lat.neighbors(n=1)\n", | |
" for hop in nn_hoppings:\n", | |
" # hoppings in z-direction\n", | |
" if hop.family_a == d or hop.family_b == d:\n", | |
" sys[hop] = t_perp\n", | |
"\n", | |
" # Build ancillary system with y-periodic BCs. This system cannot be\n", | |
" # finalized in Kwant 1.0.\n", | |
" sym = kwant.TranslationalSymmetry(lat.vec((-shape[1] / 2, shape[1], 0)))\n", | |
"\n", | |
" # Define unit cell ('fundamental domain') to be along y-axis and not along lattice vector\n", | |
" for fam in (a, b, c, d):\n", | |
" sym.add_site_family(fam, other_vectors=[[-1, 0, 0], [-1, 2, 3]])\n", | |
"\n", | |
" anc = kwant.Builder(sym)\n", | |
" anc[lat.shape(lambda p: 0 <= p[0] < shape[0] and 0 <= p[2] < shape[2], (0, 0, 0))] = None\n", | |
" initialize_hopping(anc)\n", | |
"\n", | |
" sys = kwant.Builder()\n", | |
"\n", | |
" sys[anc.sites()] = 0\n", | |
" for s1, s2 in anc.hoppings():\n", | |
" sys[sym.to_fd(s1), sym.to_fd(s2)] = anc[s1, s2]\n", | |
"\n", | |
" # leads\n", | |
" # TRICK ancestor only periodic in Y-direction to catch also the x-direction hoppings later on\n", | |
" anc_sym = kwant.TranslationalSymmetry(lat.vec((-shape[1] / 2, shape[1], 0)))\n", | |
"\n", | |
" # Define unit cell ('fundamental domain') to be along y-axis and not along lattice vector\n", | |
" for fam in (a, b, c, d):\n", | |
" anc_sym.add_site_family(fam, other_vectors=[[-1, 0, 0], [-1, 2, 3]])\n", | |
"\n", | |
" anc_lead = kwant.Builder(anc_sym)\n", | |
" anc_lead[lat.shape(lambda p: -2 <= p[0] <= 2 and 0 <= p[2] < shape[2], (0, 0, 0))] = 0\n", | |
" initialize_hopping(anc_lead)\n", | |
"\n", | |
" # at the left\n", | |
" lead_symmetry = kwant.TranslationalSymmetry(lat.vec([-1, 0, 0]))\n", | |
" lead = kwant.Builder(lead_symmetry)\n", | |
"\n", | |
" # Define unit cell ('fundamental domain') to be along y-axis and not along lattice vector\n", | |
" for fam in (a, b, c, d):\n", | |
" lead_symmetry.add_site_family(fam, other_vectors=[[-1, 2, 0], [-1, 2, 3]])\n", | |
"\n", | |
" lead[anc_lead.sites()] = 0\n", | |
" for s1 in anc_lead.sites():\n", | |
" lead[s1] = 1\n", | |
"\n", | |
" for s1, s2 in anc_lead.hoppings():\n", | |
" lead[s1, anc_sym.to_fd(s2)] = anc_lead[s1, s2]\n", | |
"\n", | |
" sys.attach_lead(lead)\n", | |
" # and right\n", | |
" sys.attach_lead(lead.reversed())\n", | |
"\n", | |
" sys.parameter = dict(t_1=t_1,\n", | |
" t_2=t_2,\n", | |
" t_perp=t_perp,\n", | |
" lambda_1=lambda_1,\n", | |
" lambda_2=lambda_2,\n", | |
" shape=shape,\n", | |
" peridoic=True)\n", | |
" return sys, lat" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"#lattice\n", | |
"sys, lat = make_latticeperiodic_pyrochlore_slab(\n", | |
" 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))\n", | |
"\n", | |
"sys2, lat2 = make_periodic_pyrochlore_slab(\n", | |
" 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))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"lattice_sys = sys.finalized()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"rectangle_sys = sys2.finalized()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# QZ iteration fails" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"ename": "LinAlgError", | |
"evalue": "QZ iteration failed to converge in zgges", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[1;31mLinAlgError\u001b[0m Traceback (most recent call last)", | |
"\u001b[1;32m<ipython-input-6-a3d46ac6196b>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mkwant\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msmatrix\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrectangle_sys\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1.5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtransmission\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |
"\u001b[1;32m/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/solvers/common.pyc\u001b[0m in \u001b[0;36msmatrix\u001b[1;34m(self, sys, energy, args, out_leads, in_leads, check_hermiticity)\u001b[0m\n\u001b[0;32m 336\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 337\u001b[0m linsys, lead_info = self._make_linear_sys(sys, in_leads, energy, args,\n\u001b[1;32m--> 338\u001b[1;33m check_hermiticity, False)\n\u001b[0m\u001b[0;32m 339\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 340\u001b[0m kept_vars = np.concatenate([vars for i, vars in\n", | |
"\u001b[1;32m/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/solvers/common.pyc\u001b[0m in \u001b[0;36m_make_linear_sys\u001b[1;34m(self, sys, in_leads, energy, args, check_hermiticity, realspace)\u001b[0m\n\u001b[0;32m 171\u001b[0m \u001b[0mlead\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mleads\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mleadnum\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 172\u001b[0m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mrealspace\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 173\u001b[1;33m \u001b[0mprop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstab\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlead\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmodes\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0menergy\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 174\u001b[0m \u001b[0mlead_info\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mprop\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 175\u001b[0m \u001b[0mu\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mulinv\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnprop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msvd_v\u001b[0m \u001b[1;33m=\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m\\\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/system.pyc\u001b[0m in \u001b[0;36mmodes\u001b[1;34m(self, energy, args)\u001b[0m\n\u001b[0;32m 211\u001b[0m \u001b[1;31m# Subtract energy from the diagonal.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 212\u001b[0m \u001b[0mham\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mflat\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mham\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m-=\u001b[0m \u001b[0menergy\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 213\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mphysics\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmodes\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mham\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minter_cell_hopping\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 214\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 215\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mselfenergy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0menergy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/physics/leads.pyc\u001b[0m in \u001b[0;36mmodes\u001b[1;34m(h_cell, h_hop, tol, stabilization)\u001b[0m\n\u001b[0;32m 581\u001b[0m \u001b[0mmatrices\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mv\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextract\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msetup_linsys\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mh_cell\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mh_hop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtol\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstabilization\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 582\u001b[0m \u001b[0mev\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mevanselect\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpropselect\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvec_gen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mord_schur\u001b[0m \u001b[1;33m=\u001b[0m\u001b[0;31m\\\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 583\u001b[1;33m \u001b[0munified_eigenproblem\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmatrices\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mtol\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 584\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 585\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mv\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/physics/leads.pyc\u001b[0m in \u001b[0;36munified_eigenproblem\u001b[1;34m(a, b, tol)\u001b[0m\n\u001b[0;32m 374\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 375\u001b[0m \u001b[0meps\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfinfo\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcommon_type\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0meps\u001b[0m \u001b[1;33m*\u001b[0m \u001b[0mtol\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 376\u001b[1;33m \u001b[0ms\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mt\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mz\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0malpha\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbeta\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mkla\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen_schur\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcalc_q\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 377\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 378\u001b[0m \u001b[1;31m# Right-decaying modes.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32m/home/maxtre/bin/anaconda/lib/python2.7/site-packages/kwant/linalg/decomp_schur.pyc\u001b[0m in \u001b[0;36mgen_schur\u001b[1;34m(a, b, calc_q, calc_z, calc_ev, overwrite_ab)\u001b[0m\n\u001b[0;32m 379\u001b[0m \u001b[0mgges\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlapack\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mltype\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m\"gges\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 380\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 381\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mgges\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcalc_q\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcalc_z\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcalc_ev\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 382\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 383\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", | |
"\u001b[1;32mkwant/linalg/lapack.pyx\u001b[0m in \u001b[0;36mkwant.linalg.lapack.zgges (kwant/linalg/lapack.c:28482)\u001b[1;34m()\u001b[0m\n", | |
"\u001b[1;31mLinAlgError\u001b[0m: QZ iteration failed to converge in zgges" | |
] | |
} | |
], | |
"source": [ | |
"kwant.smatrix(rectangle_sys, 1.5).transmission(0, 1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"But it works on the lattice-periodic system" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"2.2074478672169042" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"kwant.smatrix(lattice_sys, 1.5).transmission(0, 1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Persists over large range:" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"List all energies for which we get the QZ Error" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"energies = np.linspace(-5, 5, 100)\n", | |
"conductances = []\n", | |
"failures = []\n", | |
"for en in energies:\n", | |
" try:\n", | |
" conductances.append((en, kwant.smatrix(rectangle_sys, en).transmission(0, 1)))\n", | |
" except kwant.linalg.lapack.LinAlgError:\n", | |
" failures.append(en)\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[-1.4646464646464645,\n", | |
" -1.3636363636363638,\n", | |
" -1.2626262626262625,\n", | |
" -1.1616161616161618,\n", | |
" -1.0606060606060606,\n", | |
" -0.95959595959595934,\n", | |
" -0.85858585858585901,\n", | |
" -0.75757575757575779,\n", | |
" -0.65656565656565657,\n", | |
" -0.55555555555555536,\n", | |
" -0.45454545454545503,\n", | |
" -0.35353535353535381,\n", | |
" -0.2525252525252526,\n", | |
" -0.15151515151515138,\n", | |
" -0.050505050505050164,\n", | |
" 0.050505050505050164,\n", | |
" 0.15151515151515138,\n", | |
" 0.2525252525252526,\n", | |
" 0.35353535353535381,\n", | |
" 0.45454545454545414,\n", | |
" 0.55555555555555536,\n", | |
" 0.65656565656565657,\n", | |
" 0.75757575757575779,\n", | |
" 0.85858585858585812,\n", | |
" 0.95959595959595934,\n", | |
" 1.0606060606060606,\n", | |
" 1.1616161616161618,\n", | |
" 1.2626262626262621,\n", | |
" 1.3636363636363633,\n", | |
" 1.4646464646464645,\n", | |
" 1.5656565656565657,\n", | |
" 1.666666666666667,\n", | |
" 1.7676767676767673,\n", | |
" 1.8686868686868685,\n", | |
" 1.9696969696969697,\n", | |
" 2.0707070707070709,\n", | |
" 2.1717171717171713,\n", | |
" 2.2727272727272725,\n", | |
" 2.3737373737373737,\n", | |
" 2.4747474747474749,\n", | |
" 2.5757575757575752,\n", | |
" 2.6767676767676765,\n", | |
" 2.7777777777777777,\n", | |
" 2.8787878787878789,\n", | |
" 2.9797979797979792,\n", | |
" 3.0808080808080813,\n", | |
" 3.1818181818181817,\n", | |
" 3.282828282828282,\n", | |
" 3.3838383838383841,\n", | |
" 3.4848484848484844,\n", | |
" 3.5858585858585865,\n", | |
" 3.6868686868686869,\n", | |
" 3.7878787878787872,\n", | |
" 3.8888888888888893,\n", | |
" 3.9898989898989896,\n", | |
" 4.0909090909090899,\n", | |
" 4.191919191919192,\n", | |
" 4.2929292929292924,\n", | |
" 4.3939393939393945,\n", | |
" 4.4949494949494948,\n", | |
" 4.5959595959595951,\n", | |
" 4.6969696969696972,\n", | |
" 4.7979797979797976,\n", | |
" 4.8989898989898997,\n", | |
" 5.0]" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"failures" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[(-5.0, 0.0),\n", | |
" (-4.8989898989898988, 0.0),\n", | |
" (-4.7979797979797976, 0.0),\n", | |
" (-4.6969696969696972, 0.0),\n", | |
" (-4.595959595959596, 0.0),\n", | |
" (-4.4949494949494948, 0.0),\n", | |
" (-4.3939393939393936, 0.0),\n", | |
" (-4.2929292929292933, 0.0),\n", | |
" (-4.191919191919192, 0.0),\n", | |
" (-4.0909090909090908, 0.0),\n", | |
" (-3.9898989898989896, 0.0),\n", | |
" (-3.8888888888888888, 0.55007622553035029),\n", | |
" (-3.7878787878787881, 0.60532002089835035),\n", | |
" (-3.6868686868686869, 1.1607366729190312),\n", | |
" (-3.5858585858585856, 0.92724644062407424),\n", | |
" (-3.4848484848484849, 1.3571868690307214),\n", | |
" (-3.3838383838383841, 2.7535432149985439),\n", | |
" (-3.2828282828282829, 3.3011378020055369),\n", | |
" (-3.1818181818181817, 2.9184723900002503),\n", | |
" (-3.0808080808080809, 0.55372680080489989),\n", | |
" (-2.9797979797979797, 1.0444039180610929),\n", | |
" (-2.8787878787878789, 1.2345496926130244),\n", | |
" (-2.7777777777777777, 0.97824254804513178),\n", | |
" (-2.6767676767676769, 1.1751680631019943),\n", | |
" (-2.5757575757575757, 0.19384105607673346),\n", | |
" (-2.4747474747474749, 1.2874564707397094),\n", | |
" (-2.3737373737373737, 0.26279405116941068),\n", | |
" (-2.2727272727272729, 0.094029059607324175),\n", | |
" (-2.1717171717171717, 0.00458795629984937),\n", | |
" (-2.0707070707070709, 0.0014454478322902143),\n", | |
" (-1.9696969696969697, 0.0036447436870508205),\n", | |
" (-1.868686868686869, 0.0010561508098405376),\n", | |
" (-1.7676767676767677, 0.00040740066465199087),\n", | |
" (-1.6666666666666665, 0.0013185156055019946),\n", | |
" (-1.5656565656565657, 0.0068671498540652043)]" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"conductances" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment