From 09e9038a8cc4d52dc40886df671e49669f235a88 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:25:21 +0000 Subject: [PATCH 1/2] Initial plan From f29607e73c8d1afc15846a353a97e770265fd9af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:31:18 +0000 Subject: [PATCH 2/2] Add chemical potential parameter mu to Hubbard model Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com> --- qmp/models/hubbard.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/qmp/models/hubbard.py b/qmp/models/hubbard.py index ecc4773..4669423 100644 --- a/qmp/models/hubbard.py +++ b/qmp/models/hubbard.py @@ -28,8 +28,11 @@ class ModelConfig: t: float = 1 # The coefficient of U u: float = 0 + # The chemical potential mu + mu: float = 0 - # The electron number, left empty for half-filling + # The electron number, left empty for half-filling. + # Note: if a network without particle number conservation is used, this parameter will be ignored. electron_number: int | None = None # The ref energy of the model @@ -65,11 +68,6 @@ def _index(i: int, j: int, o: int) -> int: hamiltonian_dict: dict[tuple[tuple[int, int], ...], complex] = {} for i in range(args.m): for j in range(args.n): - # On-site interaction - hamiltonian_dict[ - (_index(i, j, 0), 1), (_index(i, j, 0), 0), (_index(i, j, 1), 1), (_index(i, j, 1), 0) - ] = args.u - # Nearest neighbor hopping if i != 0: hamiltonian_dict[(_index(i, j, 0), 1), (_index(i - 1, j, 0), 0)] = -args.t @@ -82,6 +80,15 @@ def _index(i: int, j: int, o: int) -> int: hamiltonian_dict[(_index(i, j, 1), 1), (_index(i, j - 1, 1), 0)] = -args.t hamiltonian_dict[(_index(i, j - 1, 1), 1), (_index(i, j, 1), 0)] = -args.t + # On-site interaction + hamiltonian_dict[ + (_index(i, j, 0), 1), (_index(i, j, 0), 0), (_index(i, j, 1), 1), (_index(i, j, 1), 0) + ] = args.u + + # Chemical potential + hamiltonian_dict[(_index(i, j, 0), 1), (_index(i, j, 0), 0)] = -args.mu + hamiltonian_dict[(_index(i, j, 1), 1), (_index(i, j, 1), 0)] = -args.mu + return hamiltonian_dict def __init__(self, args: ModelConfig): @@ -90,11 +97,12 @@ def __init__(self, args: ModelConfig): self.n: int = args.n self.electron_number: int = args.electron_number logging.info( - "Constructing Hubbard model: width = %d, height = %d, t = %.4f, U = %.4f, N = %d, ref_energy = %.4f", + "Constructing Hubbard model: width = %d, height = %d, t = %.4f, U = %.4f, mu = %.4f, N = %d, ref_energy = %.4f", self.m, self.n, args.t, args.u, + args.mu, args.electron_number, args.ref_energy, )