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

minor bugfix: no longer allow hoppings between a site and itself

parent f14957c9
Branches
Tags
No related merge requests found
...@@ -672,6 +672,8 @@ class Builder(object): ...@@ -672,6 +672,8 @@ class Builder(object):
a, b = hopping a, b = hopping
except: except:
raise KeyError(hopping) raise KeyError(hopping)
if a == b:
raise KeyError(hopping)
if isinstance(value, HermConjOfFunc): if isinstance(value, HermConjOfFunc):
a, b = b, a a, b = b, a
value = value.function value = value.function
......
...@@ -114,7 +114,9 @@ def test_construction_and_indexing(): ...@@ -114,7 +114,9 @@ def test_construction_and_indexing():
hoppings = [(gr(0, 0), gr(0, 1)), hoppings = [(gr(0, 0), gr(0, 1)),
(gr(0, 1), gr(1, 0)), (gr(0, 1), gr(1, 0)),
(gr(1, 0), gr(0, 0))] (gr(1, 0), gr(0, 0))]
failing_hoppings = [(gr(0, 1), gr(7, 8)), (gr(12, 14), gr(0, 1))] failing_hoppings = [(gr(0, 1), gr(0, 1)),
(gr(0, 1), gr(7, 8)),
(gr(12, 14), gr(0, 1))]
check_construction_and_indexing(sites, sites, hoppings, hoppings, check_construction_and_indexing(sites, sites, hoppings, hoppings,
failing_hoppings) failing_hoppings)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment