Skip to content

Commit 1818581

Browse files
hzhangxyzCopilot
andauthored
Fix electron number bound in qmb/hubbard.py
Co-authored-by: Copilot <[email protected]>
1 parent 57aae3d commit 1818581

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qmb/hubbard.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def __post_init__(self) -> None:
4343
if self.m <= 0 or self.n <= 0:
4444
raise ValueError("The dimensions of the Hubbard model must be positive integers.")
4545

46-
if self.electron_number < 0 or self.electron_number > self.m * self.n:
47-
raise ValueError(f"The electron number {self.electron_number} is out of bounds for a {self.m}x{self.n} lattice.")
46+
if self.electron_number < 0 or self.electron_number > 2 * self.m * self.n:
47+
raise ValueError(f"The electron number {self.electron_number} is out of bounds for a {self.m}x{self.n} lattice. Each site can host up to two electrons (spin up and spin down).")
4848

4949

5050
class Model(ModelProto[ModelConfig]):

0 commit comments

Comments
 (0)