hamiltonian_submatrix is not meaningful for
infinite systems, and (unlike un-vectorized systems)
is not even used for constructing cell_hamiltonian and
inter_cell_hopping in the vectorized case.
... | ... |
@@ -760,6 +760,13 @@ class InfiniteVectorizedSystem(VectorizedSystem, InfiniteSystemMixin, metaclass= |
760 | 760 |
cell_hamiltonian = _system.vectorized_cell_hamiltonian |
761 | 761 |
inter_cell_hopping = _system.vectorized_inter_cell_hopping |
762 | 762 |
|
763 |
+ def hamiltonian_submatrix(self, args=(), sparse=False, |
|
764 |
+ return_norb=False, *, params=None): |
|
765 |
+ raise ValueError( |
|
766 |
+ "'hamiltonian_submatrix' is not meaningful for infinite" |
|
767 |
+ "systems. Use 'cell_hamiltonian' or 'inter_cell_hopping." |
|
768 |
+ ) |
|
769 |
+ |
|
763 | 770 |
|
764 | 771 |
def is_infinite(syst): |
765 | 772 |
return isinstance(syst, (InfiniteSystem, InfiniteVectorizedSystem)) |
... | ... |
@@ -758,10 +758,6 @@ def test_vectorized_hamiltonian_evaluation(): |
758 | 758 |
syst_simple[(lat(2, 1), lat(1, 1))] = hopping |
759 | 759 |
fsyst_simple = syst_simple.finalized() |
760 | 760 |
|
761 |
- assert np.allclose( |
|
762 |
- fsyst_vectorized.hamiltonian_submatrix(), |
|
763 |
- fsyst_simple.hamiltonian_submatrix(), |
|
764 |
- ) |
|
765 | 761 |
assert np.allclose( |
766 | 762 |
fsyst_vectorized.cell_hamiltonian(), |
767 | 763 |
fsyst_simple.cell_hamiltonian(), |