Commit 45877c2d authored by Joseph Weston's avatar Joseph Weston
Browse files

disable hamiltonian_submatrix for InfiniteVectorizedSystem

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.
parent 675b067e
......@@ -760,6 +760,13 @@ class InfiniteVectorizedSystem(VectorizedSystem, InfiniteSystemMixin, metaclass=
cell_hamiltonian = _system.vectorized_cell_hamiltonian
inter_cell_hopping = _system.vectorized_inter_cell_hopping
def hamiltonian_submatrix(self, args=(), sparse=False,
return_norb=False, *, params=None):
raise ValueError(
"'hamiltonian_submatrix' is not meaningful for infinite"
"systems. Use 'cell_hamiltonian' or 'inter_cell_hopping."
)
def is_infinite(syst):
return isinstance(syst, (InfiniteSystem, InfiniteVectorizedSystem))
......
......@@ -758,10 +758,6 @@ def test_vectorized_hamiltonian_evaluation():
syst_simple[(lat(2, 1), lat(1, 1))] = hopping
fsyst_simple = syst_simple.finalized()
assert np.allclose(
fsyst_vectorized.hamiltonian_submatrix(),
fsyst_simple.hamiltonian_submatrix(),
)
assert np.allclose(
fsyst_vectorized.cell_hamiltonian(),
fsyst_simple.cell_hamiltonian(),
......
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