Commit cd29e9ae by Kloss

catch problem with no bands open

parent b49e5210
 ... ... @@ -804,7 +804,11 @@ class BandSketching: assert _is_type(band, 'integer') energy = self.__call__(k, band) modes = self._modes(energy=energy)[0] try: # kwant fails if energy is exactly at the bandgap modes = self._modes(energy=energy)[0] except ValueError: return -1 momenta = modes.momenta velocities = modes.velocities ... ...
 ... ... @@ -139,7 +139,7 @@ def test_gap_detection_tolerance(): def test_scale_invariance(): def make_lead(scale=1): syst = kwant.Builder(kwant.TranslationalSymmetry((-1, 0))) lat = kwant.lattice.square() lat = kwant.lattice.square(norbs=1) syst[lat(0, 0)] = 1*scale syst[lat(0, 1)] = 8*scale syst[lat(1, 0), lat(0, 0)] = -1*scale ... ... @@ -160,7 +160,7 @@ def test_band_analysis_methods(): # a simple testcase with 3 crossing bands def make_lead(): syst = kwant.Builder(kwant.TranslationalSymmetry((-2, 0))) lat = kwant.lattice.square(1) lat = kwant.lattice.square(1, norbs=1) syst[lat(0, 0)] = 0 syst[lat(0, 1)] = 0 syst[lat(1, 0)] = 0 ... ... @@ -171,7 +171,7 @@ def test_band_analysis_methods(): # a simple testcase with 3 non-crossing bands def make_simple_lead(W=3): lat = kwant.lattice.square(1) lat = kwant.lattice.square(1, norbs=1) sym = kwant.TranslationalSymmetry((-1, 0)) H = kwant.Builder(sym) H[(lat(0, y) for y in range(W))] = 0 ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment