-
Notifications
You must be signed in to change notification settings - Fork 137
Open
Labels
bugSomething isn't workingSomething isn't workingfix after v2This will not be worked on until after v2This will not be worked on until after v2
Description
Describe the bug
If a Hamiltonian is exactly 0 (no terms added before generating MPO), charges cannot be correctly assigned to legs of the MPO. This seems like a useless case, but it can come up in some corner cases, and it would be nice if it could be handled gracefully.
Minimal example or code extract
from tenpy.models.model import CouplingMPOModel
from tenpy.models.lattice import Chain
from tenpy.networks.site import SpinHalfSite
class TestModel(CouplingMPOModel):
default_lattice = Chain
force_default_lattice = True
def init_sites(self, model_params):
site = SpinHalfSite(conserve='parity', sort_charge=True)
return site
def init_terms(self, model_params):
pass
# done
def test_build_model():
model_params = {'L':5}
M = TestModel(model_params)Error traceback
Last part is
raise ValueError("can't determine all charges on the very right leg of the MPO!")
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfix after v2This will not be worked on until after v2This will not be worked on until after v2