Skip to content
Snippets Groups Projects
Commit 70065a07 authored by Michael Wimmer's avatar Michael Wimmer Committed by Christoph Groth
Browse files

fix momentum sign convention of Bands (k -> -k)

parent 936be07e
No related branches found
No related tags found
No related merge requests found
What's new in Kwant 1.1
=======================
This article explains the user-visible changes in Kwant 1.1.
Harmonize `~kwant.physics.Bands` with `~kwant.physics.modes`
------------------------------------------------------------
Kwant's convention is that momenta are positive in the direction of
`~kwant.lattice.TranslationalSymmetry`. While the momenta returned by
`~kwant.physics.modes` did respect this convention, the momenta read off the
band structure as given by `~kwant.physics.Bands` had the wrong sign. This has
been fixed now.
...@@ -2,5 +2,6 @@ What's new in Kwant ...@@ -2,5 +2,6 @@ What's new in Kwant
=================== ===================
.. toctree:: .. toctree::
1.1
1.0 1.0
0.2 0.2
...@@ -49,6 +49,8 @@ class Bands(object): ...@@ -49,6 +49,8 @@ class Bands(object):
self.hop[:, hop.shape[1]:] = 0 self.hop[:, hop.shape[1]:] = 0
def __call__(self, k): def __call__(self, k):
mat = self.hop * complex(math.cos(k), math.sin(k)) # Note: Equation to solve is
# (V^\dagger e^{ik} + H + V e^{-ik}) \psi = E \psi
mat = self.hop * complex(math.cos(k), -math.sin(k))
mat += mat.conjugate().transpose() + self.ham mat += mat.conjugate().transpose() + self.ham
return np.sort(np.linalg.eigvalsh(mat).real) return np.sort(np.linalg.eigvalsh(mat).real)
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
# the AUTHORS file at the top-level directory of this distribution and at # the AUTHORS file at the top-level directory of this distribution and at
# http://kwant-project.org/authors. # http://kwant-project.org/authors.
from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_almost_equal, assert_almost_equal
import kwant import kwant
from math import pi, cos from math import pi, cos, sin
def test_band_energies(N=5): def test_band_energies(N=5):
sys = kwant.Builder(kwant.TranslationalSymmetry((-1, 0))) sys = kwant.Builder(kwant.TranslationalSymmetry((-1, 0)))
...@@ -23,3 +23,16 @@ def test_band_energies(N=5): ...@@ -23,3 +23,16 @@ def test_band_energies(N=5):
energies = band_energies(k) energies = band_energies(k)
assert_array_almost_equal(sorted(energies), assert_array_almost_equal(sorted(energies),
sorted([2 - 2 * cos(k), 4 - 2 * cos(k)])) sorted([2 - 2 * cos(k), 4 - 2 * cos(k)]))
def test_same_as_lead():
sys = kwant.Builder(kwant.TranslationalSymmetry((-1,)))
lat = kwant.lattice.chain()
sys[lat(0)] = 0
sys[lat(0), lat(1)] = complex(cos(0.2), sin(0.2))
sys = sys.finalized()
momenta = sys.modes()[0].momenta
bands = kwant.physics.Bands(sys)
for momentum in momenta:
assert_almost_equal(bands(momentum)[0], 0)
...@@ -194,8 +194,8 @@ class InfiniteSystem(System): ...@@ -194,8 +194,8 @@ class InfiniteSystem(System):
def inter_cell_hopping(self, args=(), sparse=False): def inter_cell_hopping(self, args=(), sparse=False):
"""Hopping Hamiltonian between two cells of the infinite system.""" """Hopping Hamiltonian between two cells of the infinite system."""
cell_sites = xrange(self.cell_size) cell_sites = xrange(self.cell_size)
neighbor_sites = xrange(self.cell_size, self.graph.num_nodes) interface_sites = xrange(self.cell_size, self.graph.num_nodes)
return self.hamiltonian_submatrix(args, cell_sites, neighbor_sites, return self.hamiltonian_submatrix(args, cell_sites, interface_sites,
sparse=sparse) sparse=sparse)
def modes(self, energy=0, args=()): def modes(self, energy=0, args=()):
......
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