From 69ed8907601488aedfd7f2d55a1997b534c06401 Mon Sep 17 00:00:00 2001 From: Anton Akhmerov <anton.akhmerov@gmail.com> Date: Tue, 27 Nov 2012 09:25:47 -0500 Subject: [PATCH] fix advanced_construction to use tinyarray and new symmetry --- examples/advanced_construction.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/advanced_construction.py b/examples/advanced_construction.py index e019c7f3..deb35103 100644 --- a/examples/advanced_construction.py +++ b/examples/advanced_construction.py @@ -2,25 +2,25 @@ from __future__ import division import kwant -import numpy -from math import tanh, sqrt +import tinyarray as ta +from math import tanh def make_system(R=50): - sigma_0 = numpy.identity(2) - sigma_x = numpy.array([[0, 1], [1, 0]]) - sigma_y = numpy.array([[0, -1j], [1j, 0]]) - sigma_z = numpy.array([[1, 0], [0, -1]]) + sigma_0 = ta.identity(2) + sigma_x = ta.array([[0, 1], [1, 0]]) + sigma_y = ta.array([[0, -1j], [1j, 0]]) + sigma_z = ta.array([[1, 0], [0, -1]]) def in_ring(pos): - return R**2 / 4 < pos[0]**2 + pos[1]**2 < R**2 + return R ** 2 / 4 < pos[0] ** 2 + pos[1] ** 2 < R ** 2 def pot(site): x, y = site.pos return (0.1 * tanh(x / R) + tanh(2 * y / R)) * sigma_z def in_lead(pos): - return -1 < pos[0] < 1.3 and - R/4 < pos[1] < R/4 + return -1 < pos[0] < 1.3 and -R / 4 < pos[1] < R / 4 lat = kwant.lattice.Honeycomb() @@ -29,8 +29,8 @@ def make_system(R=50): for hopping in lat.nearest: sys[sys.possible_hoppings(*hopping)] = sigma_y - lead = kwant.Builder(kwant.TranslationalSymmetry([lat.vec((-1, 0))])) - lead[lat.shape(in_lead, (0,0))] = sigma_0 + lead = kwant.Builder(kwant.TranslationalSymmetry(lat.vec((-1, 0)))) + lead[lat.shape(in_lead, (0, 0))] = sigma_0 for hopping in lat.nearest: lead[lead.possible_hoppings(*hopping)] = sigma_x sys.attach_lead(lead) -- GitLab