Skip to content
Snippets Groups Projects
Commit 811c030c authored by Christoph Groth's avatar Christoph Groth
Browse files

fix import in test

parent 2af4495c
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,9 @@
from __future__ import division
import numpy as np
from numpy.testing import assert_almost_equal
import kwant.physics.selfenergy as se
from kwant.physics import leads
modes_se = lambda h, t: se.self_energy(se.modes(h, t))
modes_se = lambda h, t: leads.self_energy(leads.modes(h, t))
def h_slice(t, w, e):
h = (4 * t - e) * np.identity(w)
......@@ -25,7 +25,7 @@ def test_analytic_numeric():
t = 0.78 # hopping element
e = 1.3 # Fermi energy
assert_almost_equal(se.square_self_energy(w, t, e),
assert_almost_equal(leads.square_self_energy(w, t, e),
modes_se(h_slice(t, w, e), -t * np.identity(w)))
......@@ -48,8 +48,8 @@ def test_regular_fully_degenerate():
h_onslice[w:, w:] = h_onslice_s
g = np.zeros((2*w, 2*w), dtype=complex)
g[:w, :w] = se.square_self_energy(w, t, e)
g[w:, w:] = se.square_self_energy(w, t, e)
g[:w, :w] = leads.square_self_energy(w, t, e)
g[w:, w:] = leads.square_self_energy(w, t, e)
assert_almost_equal(g, modes_se(h_onslice, h_hop))
......@@ -78,8 +78,8 @@ def test_regular_degenerate_with_crossing():
h_onslice[w:, w:] = -h_onslice_s
g = np.zeros((2*w, 2*w), dtype=complex)
g[:w, :w] = se.square_self_energy(w, t, e)
g[w:, w:] = -np.conj(se.square_self_energy(w, t, e))
g[:w, :w] = leads.square_self_energy(w, t, e)
g[w:, w:] = -np.conj(leads.square_self_energy(w, t, e))
assert_almost_equal(g, modes_se(h_onslice, hop))
......@@ -104,7 +104,7 @@ def test_singular():
h_onslice[:w, w:] = h_hop_s
h_onslice[w:, :w] = h_hop_s
h_onslice[w:, w:] = h_onslice_s
g = se.square_self_energy(w, t, e)
g = leads.square_self_energy(w, t, e)
print np.round(g, 5) / np.round(modes_se(h_onslice, h_hop), 5)
assert_almost_equal(g, modes_se(h_onslice, h_hop))
......@@ -132,7 +132,7 @@ def test_singular_but_square():
h_onslice[w:, w:] = h_onslice_s
g = np.zeros((2*w, 2*w), dtype=complex)
g[:w, :w] = se.square_self_energy(w, t, e)
g[:w, :w] = leads.square_self_energy(w, t, e)
assert_almost_equal(g, modes_se(h_onslice, h_hop))
def test_singular_fully_degenerate():
......@@ -163,8 +163,8 @@ def test_singular_fully_degenerate():
h_onslice[3*w:4*w, 3*w:4*w] = h_onslice_s
g = np.zeros((2*w, 2*w), dtype=complex)
g[:w, :w] = se.square_self_energy(w, t, e)
g[w:, w:] = se.square_self_energy(w, t, e)
g[:w, :w] = leads.square_self_energy(w, t, e)
g[w:, w:] = leads.square_self_energy(w, t, e)
assert_almost_equal(g, modes_se(h_onslice, h_hop))
......@@ -197,8 +197,8 @@ def test_singular_degenerate_with_crossing():
h_onslice[3*w:4*w, 3*w:4*w] = -h_onslice_s
g = np.zeros((2*w, 2*w), dtype=complex)
g[:w, :w] = se.square_self_energy(w, t, e)
g[w:, w:] = -np.conj(se.square_self_energy(w, t, e))
g[:w, :w] = leads.square_self_energy(w, t, e)
g[w:, w:] = -np.conj(leads.square_self_energy(w, t, e))
assert_almost_equal(g, modes_se(h_onslice, h_hop))
......@@ -212,7 +212,7 @@ def test_singular_h_and_t():
def test_modes():
h, t = .3, .7
vecs, vecslinv, nrprop, svd = se.modes(np.array([[h]]), np.array([[t]]))
vecs, vecslinv, nrprop, svd = leads.modes(np.array([[h]]), np.array([[t]]))
assert nrprop == 1
assert svd is None
np.testing.assert_almost_equal((vecs[0] * vecslinv[0].conj()).imag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment