Prevent duplicate connectors in Hamiltonian
Created by: femtobit
Continuing the discussion from #27:
But it is also because FindConn is not supposed to return duplicate terms (this is also checked for in one of the unit tests).
If I am not mistaken, the test you refer to currently checks for a different kind of duplication, namely, for duplicate target quantum numbers within each connector. Whether the connectors
vector has duplicate entries, i.e., there exist k != j
such that connectors[k] == connectors[j]
, is not checked. That case happens for the 2x2 PBC cube example, as there e.g. site (0,0)
has two connectors to (0,1)
(one "direct" and one "through the boundary").
This pull request adds a check for this scenario and disallows periodic boundaries for L<=2 hypercubes to prevent duplicate connectors there.
The case of merging local operators in CustomHamiltonian
is still open for now.