From 4035315d4cc5f76c7b342a9aeb9ccb8e8f62ee53 Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph@weston.cloud> Date: Tue, 28 May 2019 16:44:12 +0200 Subject: [PATCH] add tutorial --- doc/source/tutorial/discretize.rst | 2 + doc/source/tutorial/index.rst | 1 + doc/source/tutorial/magnetic_field.rst | 232 +++++ ll.ipynb | 1080 ------------------------ 4 files changed, 235 insertions(+), 1080 deletions(-) create mode 100644 doc/source/tutorial/magnetic_field.rst delete mode 100644 ll.ipynb diff --git a/doc/source/tutorial/discretize.rst b/doc/source/tutorial/discretize.rst index 9417d20b..51f94b79 100644 --- a/doc/source/tutorial/discretize.rst +++ b/doc/source/tutorial/discretize.rst @@ -217,6 +217,8 @@ In addition, the function passed as ``V`` expects two input parameters ``x`` and ``y``, the same as in the initial continuum Hamiltonian. +.. _discretize-bhz-model: + Models with more structure: Bernevig-Hughes-Zhang ................................................. diff --git a/doc/source/tutorial/index.rst b/doc/source/tutorial/index.rst index 4fd4d188..0c361fcc 100644 --- a/doc/source/tutorial/index.rst +++ b/doc/source/tutorial/index.rst @@ -12,4 +12,5 @@ Tutorial: learning Kwant through examples plotting kpm discretize + magnetic_field faq diff --git a/doc/source/tutorial/magnetic_field.rst b/doc/source/tutorial/magnetic_field.rst new file mode 100644 index 00000000..6bb6fdcd --- /dev/null +++ b/doc/source/tutorial/magnetic_field.rst @@ -0,0 +1,232 @@ +Adding magnetic field +--------------------- + +Computing Landau levels in a harmonic oscillator basis +...................................................... +When electrons move in an external magnetic field, their motion perpendicular +to the field direction is quantized into discrete Landau levels. Kwant implements +an efficient scheme for computing the Landau levels of arbitrary continuum +Hamiltonians. The general scheme revolves around rewriting the Hamiltonian in terms +of a basis of harmonic oscillator states [#]_, and is commonly illustrated in textbooks +for quadratic Hamiltonians. + +To demonstrate the general scheme, let us consider a magnetic field oriented along +the :math:`z` direction :math:`\vec{B} = (0, 0, B)`, such that electron motion +in the :math:`xy` plane is Landau quantized. The magnetic field enters the Hamiltonian +through the kinetic momentum + +.. math:: \hbar \vec{k} = - i \hbar \nabla + e\vec{A}(x, y). + +In the symmetric gauge :math:`\vec{A}(x, y) = (B/2)[-y, x, 0]`, we introduce ladder +operators with the substitution + +.. math:: + + k_x = \frac{1}{\sqrt{2} l_B} (a + a^\dagger), \quad \quad + k_y = \frac{1}{\sqrt{2} l_B} (a - a^\dagger), + +with the magnetic length :math:`l_B = \sqrt{\hbar/eB}`. The ladder operators obey the +commutation relation + +.. math:: [a, a^\dagger] = 1, + +and define a quantum harmonic oscillator. We can thus write any electron continuum +Hamiltonian in terms of :math:`a` and :math:`a^\dagger`. Such a Hamiltonian has a +simple matrix representation in the eigenbasis of the number operator :math:`a^\dagger a`. +The eigenstates satisfy :math:`a^\dagger a | n \rangle = n | n \rangle` with the integer +Landau level index :math:`n \geq 0`, and in coordinate representation are proportional to + +.. math:: + + \psi_n (x, y) = \left( \frac{\partial}{ \partial w} - \frac{w^*}{4 l_B^2} \right) + w^n e^{-|w|^2/4l_B^2}, + +with :math:`w = x + i y`. The matrix elements of the ladder operators are + +.. math:: + + \langle n | a | m \rangle = \sqrt{m}~\delta_{n, m-1}, \quad \quad + \langle n | a^\dagger | m \rangle = \sqrt{m + 1}~\delta_{n, m+1}. + +Truncating the basis to the first :math:`N` Landau levels allows us to approximate +the Hamiltonian as a discrete, finite matrix. + +We can now formulate the algorithm that Kwant uses to compute Landau levels. + + 1. We take a generic continuum Hamiltonian, written in terms of the kinetic + momentum :math:`\vec{k}`. The Hamiltonian must be translationally + invariant along the directions perpendicular to the field direction. + + 2. We substitute the momenta perpendicular to the magnetic field with the ladder + operators :math:`a` and :math:`a^\dagger`. + + 3. We construct a `kwant.builder.Builder` using a special lattice which includes + the Landau level index :math:`n` as a degree of freedom on each site. The directions + normal to the field direction are not included in the builder, because they are + encoded in the Landau level index. + +This procedure is automated with `kwant.continuum.discretize_landau`. + +As an example, let us take the Bernevig-Hughes-Zhang model that we first considered in the +discretizer tutorial ":ref:`discretize-bhz-model`": + +.. math:: + + C + M σ_0 \otimes σ_z + F(k_x^2 + k_y^2) σ_0 \otimes σ_z + D(k_x^2 + k_y^2) σ_0 \otimes σ_0 + + A k_x σ_z \otimes σ_x + A k_y σ_0 \otimes σ_y. + +We can discretize this Hamiltonian in a basis of Landau levels as follows + +.. jupyter-execute:: + + import numpy as np + import scipy.linalg + from matplotlib import pyplot + + import kwant + import kwant.continuum + +.. jupyter-execute:: boilerplate.py + :hide-code: + +.. jupyter-execute:: + + hamiltonian = """ + + C * identity(4) + M * kron(sigma_0, sigma_z) + - F * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z) + - D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0) + + A * k_x * kron(sigma_z, sigma_x) + - A * k_y * kron(sigma_0, sigma_y) + """ + + syst = kwant.continuum.discretize_landau(hamiltonian, N=10) + syst = syst.finalized() + +We can then plot the spectrum of the system as a function of magnetic field, and +observe a crossing of Landau levels at finite magnetic field near zero energy, +characteristic of a quantum spin Hall insulator with band inversion. + +.. jupyter-execute:: + + params = dict(A=3.645, F =-68.6, D=-51.2, M=-0.01, C=0) + b_values = np.linspace(0.0001, 0.0004, 200) + + fig = kwant.plotter.spectrum(syst, ('B', b_values), params=params, show=False) + pyplot.ylim(-0.1, 0.2); + + +Comparing with tight-binding +============================ +In the limit where fewer than one quantum of flux is threaded through a plaquette of +the discretization lattice we can compare the discretization in Landau levels with +a discretization in realspace. + +.. jupyter-execute:: + + lat = kwant.lattice.square() + syst = kwant.Builder(kwant.TranslationalSymmetry((-1, 0))) + + def peierls(to_site, from_site, B): + y = from_site.tag[1] + return -1 * np.exp(-1j * B * y) + + syst[(lat(0, j) for j in range(-19, 20))] = 4 + syst[lat.neighbors()] = -1 + syst[kwant.HoppingKind((1, 0), lat)] = peierls + syst = syst.finalized() + + landau_syst = kwant.continuum.discretize_landau("k_x**2 + k_y**2", N=5) + landau_syst = landau_syst.finalized() + +Here we plot the dispersion relation for the discretized ribbon and compare it +with the Landau levels shown as dashed lines. + +.. jupyter-execute:: + + fig, ax = pyplot.subplots(1, 1) + ax.set_xlabel("momentum") + ax.set_ylabel("energy") + ax.set_ylim(0, 1) + + params = dict(B=0.1) + + kwant.plotter.bands(syst, ax=ax, params=params) + + h = landau_syst.hamiltonian_submatrix(params=params) + for ev in scipy.linalg.eigvals(h): + ax.axhline(ev, linestyle='--') + +The dispersion and the Landau levels diverge with increasing energy, because the real space +discretization of the ribbon gives a worse approximation to the dispersion at higher energies. + + +Discretizing 3D models +====================== +Although the preceding examples have only included the plane perpendicular to the +magnetic field, the Landau level quantization also works if the direction +parallel to the field is included. In fact, although the system must be +translationally invariant in the plane perpendicular to the field, the system may +be arbitrary along the parallel direction. For example, it is therefore possible to +model a heterostructure and/or set up a scattering problem along the field direction. + +Let's say that we wish to to model a heterostructure with a varying potential +:math:`V` along the direction of a magnetic field, :math:`z`, that includes +Zeeman splitting and Rashba spin-orbit coupling: + +.. math:: + + \frac{\hbar^2}{2m}\sigma_0(k_x^2 + k_y^2 + k_z^2) + + V(z)\sigma_0 + + \frac{\mu_B B}{2}\sigma_z + + \hbar\alpha(\sigma_x k_y - \sigma_y k_x). + +We can discretize this Hamiltonian in a basis of Landau levels as before: + +.. jupyter-execute:: + + continuum_hamiltonian = """ + (k_x**2 + k_y**2 + k_z**2) * sigma_0 + + V(z) * sigma_0 + + mu * B * sigma_z / 2 + + alpha * (sigma_x * k_y - sigma_y * k_x) + """ + + template = kwant.continuum.discretize_landau(continuum_hamiltonian, N=10) + +This creates a system with a single translational symmetry, along +the :math:`z` direction, which we can use as a template +to construct our heterostructure: + +.. jupyter-execute:: + + def hetero_structure(site): + z, = site.pos + return 0 <= z < 10 + + def hetero_potential(z): + if z < 2: + return 0 + elif z < 7: + return 0.5 + else: + return 0.7 + + syst = kwant.Builder() + syst.fill(template, hetero_structure, (0,)) + + syst = syst.finalized() + + params = dict( + B=0.5, + mu=0.2, + alpha=0.4, + V=hetero_potential, + ) + + syst.hamiltonian_submatrix(params=params); + + +.. rubric:: Footnotes + +.. [#] `Wikipedia <https://en.wikipedia.org/wiki/Landau_quantization>`_ has + a nice introduction to Landau quantization. \ No newline at end of file diff --git a/ll.ipynb b/ll.ipynb deleted file mode 100644 index b6f7dda7..00000000 --- a/ll.ipynb +++ /dev/null @@ -1,1080 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/tinkerer/kwant/kwant/solvers/default.py:18: RuntimeWarning: MUMPS is not available, SciPy built-in solver will be used as a fallback. Performance can be very poor in this case.\n", - " \"Performance can be very poor in this case.\", RuntimeWarning)\n" - ] - } - ], - "source": [ - "import numpy as np\n", - "import sympy\n", - "import operator\n", - "import inspect\n", - "import itertools\n", - "import functools\n", - "from copy import deepcopy\n", - "\n", - "import kwant\n", - "import kwant.continuum" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "%matplotlib inline\n", - "import sympy\n", - "import matplotlib.pyplot as plt\n", - "\n", - "sympy.init_printing(print_builtin=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "from kwant.continuum import landau_levels" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "builder = kwant.continuum.discretize('k_x**2 + k_y**2 + V(x, y) + sqrt(B)')" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "# Discrete coordinates: x y\n", - "\n", - "# Onsite element:\n", - "def onsite(site, B, V):\n", - " (x, y, ) = site.pos\n", - " _const_0 = (V(x, y))\n", - " return (B**(1/2) + _const_0 + 4.0)\n", - "\n", - "# Hopping from (1, 0):\n", - "(-1+0j)\n", - "\n", - "# Hopping from (0, 1):\n", - "(-1+0j)\n" - ] - } - ], - "source": [ - "print(builder)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": {}, - "outputs": [], - "source": [ - "a_dag = sympy.symbols('a^\\dagger')" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAABIAAAATBAMAAABvvEDBAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIpmJdu8QRM1mu90yVKvMIHo8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAdUlEQVQIHWNggIDnUJqBAcEyg4mtWBQLY7olwFhvYAyGtVhYb+FiIPMYlVXCGBh0gKxSAY4PDAyGDAxskQxMCxgY3BgYmL4xcDswMAgwMLAuYMg/wAAC+QYM98EMhvwLDC94gXIMDFwOnPuYwYJsT3zk3EEsAMsTFcMrnqiMAAAAAElFTkSuQmCC\n", - "text/latex": [ - "$$a^\\dagger$$" - ], - "text/plain": [ - "a__\\dagger" - ] - }, - "execution_count": 36, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a_dag" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], - "source": [ - "chain = kwant.lattice.chain()" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "kwant.builder.Site" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "type(chain(1))" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Site(kwant.lattice.Monatomic([[1.0]], [0.0], '', None), array([2]))" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "chain(2)" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Site(kwant.lattice.Monatomic([[1.0]], [0.0], '', None), array([1]))" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "kwant.builder.Site(chain, (1,))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "s = kwant.builder.Site(chain, (40,)) # Second argument is the tag, for the chain its the position." - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([40.0])" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "s.pos" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[0;31mInit signature:\u001b[0m \u001b[0mkwant\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbuilder\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfamily\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtag\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_i_know_what_i_do\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mDocstring:\u001b[0m \n", - "A site, member of a `SiteFamily`.\n", - "\n", - "Sites are the vertices of the graph which describes the tight binding\n", - "system in a `Builder`.\n", - "\n", - "A site is uniquely identified by its family and its tag.\n", - "\n", - "Parameters\n", - "----------\n", - "family : an instance of `SiteFamily`\n", - " The 'type' of the site.\n", - "tag : a hashable python object\n", - " The unique identifier of the site within the site family, typically a\n", - " vector of integers.\n", - "\n", - "Raises\n", - "------\n", - "ValueError\n", - " If `tag` is not a proper tag for `family`.\n", - "\n", - "Notes\n", - "-----\n", - "For convenience, ``family(*tag)`` can be used instead of ``Site(family,\n", - "tag)`` to create a site.\n", - "\n", - "The parameters of the constructor (see above) are stored as instance\n", - "variables under the same names. Given a site ``site``, common things to\n", - "query are thus ``site.family``, ``site.tag``, and ``site.pos``.\n", - "\u001b[0;31mFile:\u001b[0m ~/kwant/kwant/builder.py\n", - "\u001b[0;31mType:\u001b[0m type\n", - "\u001b[0;31mSubclasses:\u001b[0m \n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "kwant.builder.Site?" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "\u001b[0;31mSignature:\u001b[0m \u001b[0mchain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mtag\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mType:\u001b[0m Monatomic\n", - "\u001b[0;31mString form:\u001b[0m <unnamed Monatomic lattice, vectors [1.0], origin [0.0]>\n", - "\u001b[0;31mFile:\u001b[0m ~/kwant/kwant/lattice.py\n", - "\u001b[0;31mDocstring:\u001b[0m \n", - "A Bravais lattice with a single site in the basis.\n", - "\n", - "Instances of this class provide the `~kwant.builder.SiteFamily` interface.\n", - "Site tags (see `~kwant.builder.SiteFamily`) are sequences of integers and\n", - "describe the lattice coordinates of a site.\n", - "\n", - "``Monatomic`` instances are used as site families on their own or as\n", - "sublattices of `Polyatomic` lattices.\n", - "\n", - "Parameters\n", - "----------\n", - "prim_vecs : 2d array-like of floats\n", - " Primitive vectors of the Bravais lattice.\n", - "\n", - "offset : vector of floats\n", - " Displacement of the lattice origin from the real space\n", - " coordinates origin.\n", - "\n", - "Attributes\n", - "----------\n", - "``offset`` : vector\n", - " Displacement of the lattice origin from the real space coordinates origin\n", - "\u001b[0;31mCall docstring:\u001b[0m\n", - "A convenience function.\n", - "\n", - "This function allows to write fam(1, 2) instead of Site(fam, (1, 2)).\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "chain?" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "H1 = \"k_x**2 + 10*k_y**2\"\n", - "H2 = \"t_1*k_x**2 + t_2*k_y**2 + t_3*k_z**2\"\n", - "H3 = \"sigma_z*k_x**2 + 10*sigma_x*k_y**2\"" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "ll = landau_levels.ll_hamiltonian(H3)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAS0AAAAyBAMAAAD7OpAnAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEImZRO/dMlQiu6vNZnZmcXX2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFhElEQVRYCcWZTWhcVRTHz3uZJDOZTOZRaRZ+zduoiKWOQhcq6uDCjUJalPpBIRWCtRRkNroSMy4qKkhSEDEiJBtBLEgUpCDaDmTjwkVocZ2JXZlSM7UFU6uO99x73v18b2buE5m7eHPuuff+z++dd+fOOwwAa/vqeHXbeK8Xu17lCXu9w6rX35rv/d5/ApDap61kXuFoMzHNz/H3VyLTY/aClU+G5npx5Yy52OmRWuXlJOZS3ZkjHOPNjAHpnhya6wW5JtsQah+/ImaU/syamcl18CIRe3OFV+9LiybcQq10S8woX0ubiT7OVTziDE+3g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A1Khz1+nERGIpsyKVqWOkWhsYVdKwx7C6YRzzf92wNe1mwK1sZIour1D0AsRaCcWm1jzaApsZVsYZ490Shq7sTLrciUiGyuIIfnvol0sQYl1bDagNoalzWiOg+s9PW/QkX281WZatCZHHpOmgj13VZw1qjA7iC5alNfYXkcipbFcKDSyVZBAl+4o1tvAFc5fhZHUvu+zzP0RBiHdr3Sy17APsDuAoXY2NVki+27+3KVpbJHvkCVcMaYQZyWbNlvlIqWxnCh0seenagAfmypyf5ohJWH5YhfLhUDatLMRvL0f51rbGAc+Eat7KVIXy4VA1rhAFejnpyaSWsLiZD+HDpAq5NSu6A4+H5crymw+Ri35CMht/H/u3/4arzoOPtrNgj4lqMOVBZFGopcCPi2hWPKfnfwwUbDVeQ/C+023GRuGc0XLNHCKdyK0oHG8n/fMVjkua29QyuUfwv+tkmwvwLRnzCe2DCMugAAAAASUVORK5CYII=\n", - "text/latex": [ - "$$\\left \\{ k_{x}^{2} : \\left[\\begin{matrix}1 & 0\\\\0 & -1\\end{matrix}\\right], \\quad k_{y}^{2} : \\left[\\begin{matrix}0 & 10\\\\10 & 0\\end{matrix}\\right]\\right \\}$$" - ], - "text/plain": [ - "⎧ 2 ⎡1 0 ⎤ 2 ⎡0 10⎤⎫\n", - "⎨kâ‚“ : ⎢ ⎥, k_y : ⎢ ⎥⎬\n", - "⎩ ⎣0 -1⎦ ⎣10 0 ⎦âŽ" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.monomials" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.normal_coordinate == None" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [], - "source": [ - "ll.set_ll_momenta([1, 2])" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE8AAAAVBAMAAAD1D64kAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAds0yiUTdELvvmVRmIqtiKJjQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABQklEQVQoFYXTMUjDQBQG4D9tktM2aYODFUEoCAqdsrlmUOe4C8nmJnEQBJVEN9HBScQpjiJCNpeCHZxcFIquWujgKEjJEAdDLgc5k8NbXu5/H/cuw2FmEf8vbcnGGrB3IaDkxM07cgbRE0DUQh4mItiOOKjEIuh4HJRdEVxnDXrHWth8emERV3vo32UBhX604Aw4kG9IIr3+FODDjndQ5dCMO2RQgDdhJQMaV6xBR2/PGSzgqzo6yoMMkok+ATY+sMUzwLffbeBteYgMal8kkWHF9fO/8Bl+ZOH20aCwFeBb1nddKYDf5ewn2qYF7IPCqQjzHTSslgGVn34K6doDScfTn8lOUe1pE7jnTqSbIVY4aDppbpWhPu4HRaiMjgFilKFWv/SK8BBngFZ2NEnvOJs/hbHSFSlASp8CW5ur7Ku6/gLiIEbRKeWmjQAAAABJRU5ErkJggg==\n", - "text/latex": [ - "$$\\left [ k_{y}, \\quad k_{z}\\right ]$$" - ], - "text/plain": [ - "[k_y, k_z]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.ll_momenta" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAATcAAAAzBAMAAAAA6lKjAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEImZRO/dMlQiu6vNZnZmcXX2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFwUlEQVRYCbWZTYgcRRTHX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dncPs/FWvunznftqEIHLwzhIVDu4CLe7V+Fpxv21AI7o0hwOEO0u1o5mZ6ZXHHemfOu20oAheLZYWpV3YB15YbFy+cd9tQBO5JnDR6leyhDKGeK34gDv5I84r8zgdX3LIGI7jortNP24YXNuGUcCtVA5cWVpU2f1UuUbbaInzq67vPoLjznpvrRmfR6/mgintmqODgjHg2zEHbhuYNGst+z1WOAXiEVaXNcLMj1KL0ZWTRopn7CeBAokM3aSO8X7RZruLA4XXVe0/u2dARAHLmMIunhfUmj9W41Bd79/RBcJ8nNovWdVRx12Usy/k2plPN2tAKwmWVj15aeFaV6azGBWtm3Qogfk1Z6lrilompE47Acxpun9WrzJm2uc2ET8OlhcUuhMr0ULjoTwE3VAO5Z0yd5cvnP9FwA/cCbM10lmyvgvMI65IsFK4qStOVoa1ubEyd4pfKkYYzfcYqff+FaZiZ8whzSa3Vtl3Wqpi5laatbmwrdfJ3NX3Guh++NA0LLi28rsr00JnzzH70Ax4dsFJnDtyFUt8H5xEuvKzygVjt2urGtlJnDtzzj5gIYal7ziPMJXX4ssJnAOK3Kd9hp84cuESohksL60o7dFkh/a5Uo9mpcwdwaeHkS3jbBwJmulHGrpNSJ1XcBeFkFvcIq0o7eOaig7911Fy5Z7viLgaHWdwjrCrtYDgXKN2iirsYXFrF9bhwXL66l2SspnsRUMU9GbgWjjXdTw4p2oFwWHFPBI5f/jWqDV3CIDiuuCcCt0U3u/onx6ELguOKexJwkfrPa2vocGEjCI7DJgG3ILbLeNTvpLOA/kuTr8k+TeQvzcoJjXTPZmps/WdwqifpmMifwR8P5DD/AzdT3d3vz5R8AAAAAElFTkSuQmCC\n", - "text/latex": [ - "$$\\left \\{ 1 : \\left[\\begin{matrix}k_{x}^{2} & 0\\\\0 & - k_{x}^{2}\\end{matrix}\\right], \\quad k_{y}^{2} : \\left[\\begin{matrix}0 & 10\\\\10 & 0\\end{matrix}\\right]\\right \\}$$" - ], - "text/plain": [ - "⎧ ⎡ 2 ⎤ ⎫\n", - "⎪ ⎢kâ‚“ 0 ⎥ 2 ⎡0 10⎤⎪\n", - "⎨1: ⎢ ⎥, k_y : ⎢ ⎥⎬\n", - "⎪ ⎢ 2⎥ ⎣10 0 ⎦⎪\n", - "⎩ ⎣ 0 -kâ‚“ ⎦ âŽ" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.monomials" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAAJBAMAAAAWSsseAAAALVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAEHarIkSJZt3NuzJUmW693xMAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABASURBVAgdY2AQUnZVU2BgTGBv4pjAwCbA9pDVgYGRgWsBAwjwKYCpfRuAFI+AHgOTAEPcgXUM7gwMwkpC1wsYABfXCcn8wW65AAAAAElFTkSuQmCC\n", - "text/latex": [ - "$$x$$" - ], - "text/plain": [ - "x" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.normal_coordinate" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [], - "source": [ - "# ll.set_ll_momenta(['k_x', 'k_y'])" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAsAAAAJBAMAAAAWSsseAAAALVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAOrOgAAAADnRSTlMAEHarIkSJZt3NuzJUmW693xMAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABASURBVAgdY2AQUnZVU2BgTGBv4pjAwCbA9pDVgYGRgWsBAwjwKYCpfRuAFI+AHgOTAEPcgXUM7gwMwkpC1wsYABfXCcn8wW65AAAAAElFTkSuQmCC\n", - "text/latex": [ - "$$x$$" - ], - "text/plain": [ - "x" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.normal_coordinate" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAATcAAAAzBAMAAAAA6lKjAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEImZRO/dMlQiu6vNZnZmcXX2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFwUlEQVRYCbWZTYgcRRTHX/fO7szs7GSHqAt+ZQeDiBji5JCLIg65eNJNQOIHgU0gBENA5uRJ3Lko0cuOF3FF2BVvfsAaEC9qBnLJwcNg8JyJOanoTmLAaKJj1Xuvvrqre6t3mT5Mv3rV71+/qeruV28GYJsjfurQNldMuHtvKzXA8vgm+R6Hb1OdjiMej486jpzG9HjczOkWXaz2UVddVjreUaY+v7z2PtlnYaWnvT4jWvswHO7dtYZPw/hYrf6qum61ZTqV9ZIyTsN6W9kZ53I4XCdDwnKT2genyFX9x+pSpoR74Di2VtWXUH3yHP/+mG4WhrODtYrSJLXqHeqo3bAuUCbO3CVsva589vkyLPRUuzCcHcwib4sZIDerPUuTPN9Xo1hnhLstHXHLciuzfhTivmoUhXOCUSS6cLEB7Ga1lSH2zG+qUayzhCvhlF6xvNqc3YSKnvCicE4wS15tALtZbZHmZDELLj4pIkvNUkczaUN8oRLOq/QUhXOCWVLAsVvBEVUm3FyrcqX35vn3GppJG+J7lf5TraJwTrCBY3cg3GL3l6XB8nisIKzzehPKO4Zzgg0cuwPhVvc1HraAbHO9BWVOIbnLmkh+03iHOMEWHGkGwh1u2TyO7axMzrImkh/BOcEGjt2BcOd+HTpEVkPcvJWQByKR/AjOCTZw7A6Di25V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Fy5Z7viLgaHWdwjrCrtYDgXKN2iirsYXFrF9bhwXL66l2SspnsRUMU9GbgWjjXdTw4p2oFwWHFPBI5f/jWqDV3CIDiuuCcCt0U3u/onx6ELguOKexJwkfrPa2vocGEjCI7DJgG3ILbLeNTvpLOA/kuTr8k+TeQvzcoJjXTPZmps/WdwqifpmMifwR8P5DD/AzdT3d3vz5R8AAAAAElFTkSuQmCC\n", - "text/latex": [ - "$$\\left \\{ 1 : \\left[\\begin{matrix}k_{x}^{2} & 0\\\\0 & - k_{x}^{2}\\end{matrix}\\right], \\quad k_{y}^{2} : \\left[\\begin{matrix}0 & 10\\\\10 & 0\\end{matrix}\\right]\\right \\}$$" - ], - "text/plain": [ - "⎧ ⎡ 2 ⎤ ⎫\n", - "⎪ ⎢kâ‚“ 0 ⎥ 2 ⎡0 10⎤⎪\n", - "⎨1: ⎢ ⎥, k_y : ⎢ ⎥⎬\n", - "⎪ ⎢ 2⎥ ⎣10 0 ⎦⎪\n", - "⎩ ⎣ 0 -kâ‚“ ⎦ âŽ" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.monomials" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [], - "source": [ - "ll.shape_func" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": {}, - "outputs": [], - "source": [ - "N = 3" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], - "source": [ - "ham = ll.hamiltonian_matrix(N)" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAATcAAAAzBAMAAAAA6lKjAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEImZRO/dMlQiu6vNZnZmcXX2AAAACXBIWXMAAA7EAAAOxAGVKw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+2UUHNHMvtHs63bSgCV3sR4KGvCGdncPs/FWvunznftqEIHLwzhIVDu4CLe7V+Fpxv21AI7o0hwOEO0u1o5mZ6ZXHHemfOu20oAheLZYWpV3YB15YbFy+cd9tQBO5JnDR6leyhDKGeK34gDv5I84r8zgdX3LIGI7jortNP24YXNuGUcCtVA5cWVpU2f1UuUbbaInzq67vPoLjznpvrRmfR6/mgintmqODgjHg2zEHbhuYNGst+z1WOAXiEVaXNcLMj1KL0ZWTRopn7CeBAokM3aSO8X7RZruLA4XXVe0/u2dARAHLmMIunhfUmj9W41Bd79/RBcJ8nNovWdVRx12Usy/k2plPN2tAKwmWVj15aeFaV6azGBWtm3Qogfk1Z6lrilompE47Acxpun9WrzJm2uc2ET8OlhcUuhMr0ULjoTwE3VAO5Z0yd5cvnP9FwA/cCbM10lmyvgvMI65IsFK4qStOVoa1ubEyd4pfKkYYzfcYqff+FaZiZ8whzSa3Vtl3Wqpi5laatbmwrdfJ3NX3Guh++NA0LLi28rsr00JnzzH70Ax4dsFJnDtyFUt8H5xEuvKzygVjt2urGtlJnDtzzj5gIYal7ziPMJXX4ssJnAOK3Kd9hp84cuESohksL60o7dFkh/a5Uo9mpcwdwaeHkS3jbBwJmulHGrpNSJ1XcBeFkFvcIq0o7eOaig7911Fy5Z7viLgaHWdwjrCrtYDgXKN2iirsYXFrF9bhwXL66l2SspnsRUMU9GbgWjjXdTw4p2oFwWHFPBI5f/jWqDV3CIDiuuCcCt0U3u/onx6ELguOKexJwkfrPa2vocGEjCI7DJgG3ILbLeNTvpLOA/kuTr8k+TeQvzcoJjXTPZmps/WdwqifpmMifwR8P5DD/AzdT3d3vz5R8AAAAAElFTkSuQmCC\n", - "text/latex": [ - "$$\\left \\{ 1 : \\left[\\begin{matrix}k_{x}^{2} & 0\\\\0 & - k_{x}^{2}\\end{matrix}\\right], \\quad k_{y}^{2} : \\left[\\begin{matrix}0 & 10\\\\10 & 0\\end{matrix}\\right]\\right \\}$$" - ], - "text/plain": [ - "⎧ ⎡ 2 ⎤ ⎫\n", - "⎪ ⎢kâ‚“ 0 ⎥ 2 ⎡0 10⎤⎪\n", - "⎨1: ⎢ ⎥, k_y : ⎢ ⎥⎬\n", - "⎪ ⎢ 2⎥ ⎣10 0 ⎦⎪\n", - "⎩ ⎣ 0 -kâ‚“ ⎦ âŽ" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ll.monomials" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "params = dict(t_1 = 1, t_2 = 2, t_3 = 3, k_x=0)" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "matrix([[ 0. +0.j, 5. +0.j, 0. +0.j,\n", - " 0. +0.j, 0. +0.j, 7.07106781+0.j],\n", - " [ 5. +0.j, 0. +0.j, 0. +0.j,\n", - " 0. +0.j, 7.07106781+0.j, 0. +0.j],\n", - " [ 0. +0.j, 0. +0.j, 0. +0.j,\n", - " 15. +0.j, 0. +0.j, 0. +0.j],\n", - " [ 0. +0.j, 0. +0.j, 15. +0.j,\n", - " 0. +0.j, 0. +0.j, 0. +0.j],\n", - " [ 0. +0.j, 7.07106781+0.j, 0. +0.j,\n", - " 0. +0.j, 0. +0.j, 25. +0.j],\n", - " [ 7.07106781+0.j, 0. +0.j, 0. +0.j,\n", - " 0. +0.j, 25. +0.j, 0. +0.j]])" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ham(B=1, params=params).todense()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "H1 = \"k_x**2 + 10*k_y**2\"\n", - "H2 = \"t_1*k_x**2 + t_2*k_y**2 + t_3*k_z**2\"\n", - "H3 = \"sigma_z*k_x**2 + 10*sigma_x*k_y**2\"" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "N = 2\n", - "ham, monomials = ll_hamiltonian(H3, N, momenta=None)" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "<function kwant.continuum.landau_levels.combine.<locals>.final_wrapper(*, B, params=None)>" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ham" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "matrix([[ 0.5+0.j, 5. +0.j, 0. +0.j, 0. +0.j],\n", - " [ 5. +0.j, -0.5+0.j, 0. +0.j, 0. +0.j],\n", - " [ 0. +0.j, 0. +0.j, 1.5+0.j, 15. +0.j],\n", - " [ 0. +0.j, 0. +0.j, 15. +0.j, -1.5+0.j]])" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ham(B=1, params=dict(t_1=1, t_2=1, t_3=1)).todense()" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{k_x**2: <function __main__.ll_hamiltonian.<locals>.<lambda>.<locals>.<lambda>(params=None)>,\n", - " k_y**2: <function __main__.ll_hamiltonian.<locals>.<lambda>.<locals>.<lambda>(params=None)>}" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "monomials" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - "funcs = list(monomials.values())" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "<function __main__.ll_hamiltonian.<locals>.<lambda>.<locals>.<lambda>(params=None)>" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "funcs[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "# funcs[0]().todense()" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "k_x**2 [[ 1.+0.j 0.+0.j]\n", - " [ 0.+0.j -1.+0.j]]\n", - "k_y**2 [[ 0.+0.j 10.+0.j]\n", - " [10.+0.j 0.+0.j]]\n" - ] - } - ], - "source": [ - "params = dict(t_1 = 1, t_2=1, t_3=1)\n", - "for key, value in monomials.items():\n", - " print(key, value(params=params).todense())" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": {}, - "outputs": [], - "source": [ - "f1 = lambda x, y=1, z=2: x*y + z\n", - "f2 = lambda l, y=1, z=2: l*y + z" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": {}, - "outputs": [], - "source": [ - "funcs = [f1, f2]" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "<function __main__.combine.<locals>.final_wrapper(*, l, x, y=1, z=2)>" - ] - }, - "execution_count": 62, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "combine(operator.add, funcs, args_names=None)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "('N_1', None) == ('N_2', None)" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "metadata": {}, - "outputs": [], - "source": [ - "H = \"k_x**2 + k_y**2 + k_z**2\"" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": {}, - "outputs": [], - "source": [ - "disc = kwant.continuum.discretize(H, coords=['y', 'z'])" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "# Discrete coordinates: y z\n", - "\n", - "# Onsite element:\n", - "def onsite(site, k_x):\n", - " return (4.0 + k_x**2)\n", - "\n", - "# Hopping from (1, 0):\n", - "(-1+0j)\n", - "\n", - "# Hopping from (0, 1):\n", - "(-1+0j)" - ], - "text/plain": [ - "<kwant.continuum.discretizer._DiscretizedBuilder at 0x7f8e4a178630>" - ] - }, - "execution_count": 88, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "disc" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[0.0 0.0]\n" - ] - } - ], - "source": [ - "for site in disc.sites():\n", - " print(site.pos)" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": {}, - "outputs": [], - "source": [ - "fsyst = disc.finalized()" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array([[ 2.+0.j, -1.-0.j],\n", - " [-1.+0.j, 2.+0.j]])" - ] - }, - "execution_count": 74, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "fsyst.hamiltonian_submatrix()" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [], - "source": [ - "l = ['a', 'b', 'c', 'd']\n", - "inds = [0, 3]" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "zip argument #1 must support iteration", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m<ipython-input-22-39657fc954cd>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0ml\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0minds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: zip argument #1 must support iteration" - ] - } - ], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "work_env", - "language": "python", - "name": "work_env" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.1" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} -- GitLab