Commit 43f34a54 authored by Joseph Weston's avatar Joseph Weston
Browse files

update system consumers where they assume the old system format

Previously infinite vectorized systems explicitly stored the sites
of the previous unit cell, and one of the tests and 'hamiltonian'
relied upon this fact. We therefore need to change these places
now that infinite vectorized systems store only the sites of the FD.
parent 868f2ed2
......@@ -1860,6 +1860,15 @@ class _VectorizedFinalizedBuilderMixin(_FinalizedBuilderMixin):
return onsite[0]
else:
edge_id = self.graph.first_edge_id(i, j)
# Map sites in previous cell to fundamental domain; vectorized
# infinite systems only store sites in the FD. We already know
# that this hopping is between unit cells because this is encoded
# in the edge_id and term id.
# Using 'is_infinite' is a bit of a hack, but 'hamiltonian' is
# deprecated anyway, and refactoring everything to avoid this check
# is not worth it.
if system.is_infinite(self):
i, j = i % self.cell_size, j % self.cell_size
which_term = self._hopping_term_by_edge_id[edge_id]
herm_conj = which_term < 0
if herm_conj:
......
......@@ -366,6 +366,12 @@ def check_hoppings(fsyst, hops):
if vectorized:
term = fsyst._hopping_term_by_edge_id[edge_id]
# Map sites in previous cell to fundamental domain; vectorized
# infinite systems only store sites in the FD. We already know
# that this hopping is between unit cells because this is encoded
# in the edge_id and term id.
if system.is_infinite(fsyst):
i, j = i % fsyst.cell_size, j % fsyst.cell_size
if term < 0: # Hermitian conjugate
assert (head, tail) in hops
else:
......
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