Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

# Copyright 2011-2013 Kwant authors. 

# 

# This file is part of Kwant. It is subject to the license terms in the file 

# LICENSE.rst found in the top-level directory of this distribution and at 

# http://kwant-project.org/license. A list of Kwant authors can be found in 

# the file AUTHORS.rst at the top-level directory of this distribution and at 

# http://kwant-project.org/authors. 

 

import math 

import numpy as np 

from .. import system 

from .._common import ensure_isinstance 

 

__all__ = ['Bands'] 

 

 

class Bands: 

""" 

Class of callable objects for the computation of energy bands. 

 

Parameters 

---------- 

sys : `kwant.system.InfiniteSystem` 

The low level infinite system for which the energies are to be 

calculated. 

args : tuple, defaults to empty 

Positional arguments to pass to the ``hamiltonian`` method. 

Mutually exclusive with 'params'. 

params : dict, optional 

Dictionary of parameter names and their values. Mutually exclusive 

with 'args'. 

 

Notes 

----- 

An instance of this class can be called like a function. Given a momentum 

(currently this must be a scalar as all infinite systems are quasi-1-d), it 

returns a NumPy array containing the eigenenergies of all modes at this 

momentum 

 

Examples 

-------- 

>>> bands = kwant.physics.Bands(some_syst) 

>>> momenta = numpy.linspace(-numpy.pi, numpy.pi, 101) 

>>> energies = [bands(k) for k in momenta] 

>>> pyplot.plot(momenta, energies) 

>>> pyplot.show() 

""" 

 

def __init__(self, sys, args=(), *, params=None): 

syst = sys 

ensure_isinstance(syst, system.InfiniteSystem) 

self.ham = syst.cell_hamiltonian(args, params=params) 

if not np.allclose(self.ham, self.ham.T.conj()): 

raise ValueError('The cell Hamiltonian is not Hermitian.') 

hop = syst.inter_cell_hopping(args, params=params) 

self.hop = np.empty(self.ham.shape, dtype=complex) 

self.hop[:, : hop.shape[1]] = hop 

self.hop[:, hop.shape[1]:] = 0 

 

def __call__(self, 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 

return np.sort(np.linalg.eigvalsh(mat).real)