Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There might be a bug in the methods for constructing Hamiltonian. #43

Closed
ZongYongyue opened this issue Jan 23, 2025 · 3 comments
Closed

Comments

@ZongYongyue
Copy link

For [email protected],

H = hubbard_model(Float64, U1Irrep, U1Irrep, FiniteChain(2); t=1, U=8);
H.W

gives

2-element Vector{BlockTensorKit.SparseBlockTensorMap{AbstractTensorMap{Float64, GradedSpace{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, Int64}}, 2, 2}, Float64, GradedSpace{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, Int64}}, 2, 2, 4}}:
 1×1×1×3 SparseBlockTensorMap(((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1, (1, 1, 1/2)=>1, (1, 1, -1/2)=>1, (0, 2, 0)=>1)))  ((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1, (1, 1, 1/2)=>1, (1, 1, -1/2)=>1, (0, 2, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, 1, 1/2)=>1, (1, 1, -1/2)=>1, (1, -1, 1/2)=>1, (1, -1, -1/2)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)))):
* Block for sector (FermionParity(0)  Irrep[U₁](0)  Irrep[U₁](0)):
[1.0 1.4142135623730945 1.4142135623730945 -0.0]* Block for sector (FermionParity(1)  Irrep[U₁](1)  Irrep[U₁](1/2)):
[1.0 1.4142135623730945 1.414213562373095 -0.0]* Block for sector (FermionParity(1)  Irrep[U₁](1)  Irrep[U₁](-1/2)):
[1.0 1.4142135623730945 -1.414213562373095 -0.0]* Block for sector (FermionParity(0)  Irrep[U₁](2)  Irrep[U₁](0)):
[1.0 -1.414213562373095 1.414213562373095 -0.0]
 3×1×1×1 SparseBlockTensorMap(((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, 1, 1/2)=>1, (1, 1, -1/2)=>1, (1, -1, 1/2)=>1, (1, -1, -1/2)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1, (1, 1, 1/2)=>1, (1, 1, -1/2)=>1, (0, 2, 0)=>1)))  ((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1, (1, 1, 1/2)=>1, (1, 1, -1/2)=>1, (0, 2, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)))):
* Block for sector (FermionParity(0)  Irrep[U₁](0)  Irrep[U₁](0)):
[-0.0; -0.7071067811865476; -0.7071067811865476; 1.0;;]* Block for sector (FermionParity(1)  Irrep[U₁](1)  Irrep[U₁](1/2)):
[-0.0; -0.7071067811865476; 0.7071067811865475; 1.0;;]* Block for sector (FermionParity(1)  Irrep[U₁](1)  Irrep[U₁](-1/2)):
[-0.0; -0.7071067811865476; -0.7071067811865475; 1.0;;]* Block for sector (FermionParity(0)  Irrep[U₁](2)  Irrep[U₁](0)):
[-0.0; 0.7071067811865475; -0.7071067811865475; 1.0;;]

in which the U value disappeared. But when I construct the same model by FiniteMPOHamiltonian

H = FiniteMPOHamiltonian(fill(pspace, len), mpos...)

it gives:

H.W
2-element Vector{BlockTensorKit.SparseBlockTensorMap{AbstractTensorMap{Float64, GradedSpace{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, Int64}}, 2, 2}, Float64, GradedSpace{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, TensorKit.SortedVectorDict{ProductSector{Tuple{FermionParity, U1Irrep, U1Irrep}}, Int64}}, 2, 2, 4}}:
 1×1×1×6 SparseBlockTensorMap(((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 1)=>1, (0, 0, -1)=>1, (1, 1, 0)=>1, (1, -1, 0)=>1)))  ((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 1)=>1, (0, 0, -1)=>1, (1, 1, 0)=>1, (1, -1, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, 1, -1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, -1, 1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, -1, -1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, 1, 1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)))):
* Block for sector (FermionParity(0)  Irrep[U₁](0)  Irrep[U₁](1)):
[1.0 -1.4142135623730945 -1.4142135623730945 8.0]* Block for sector (FermionParity(0)  Irrep[U₁](0)  Irrep[U₁](-1)):
[1.0 -1.4142135623730945 -1.4142135623730945 0.0]* Block for sector (FermionParity(1)  Irrep[U₁](1)  Irrep[U₁](0)):
[1.0 -1.414213562373095 1.414213562373095 0.0]* Block for sector (FermionParity(1)  Irrep[U₁](-1)  Irrep[U₁](0)):
[1.0 -1.414213562373095 1.414213562373095 0.0]
 6×1×1×1 SparseBlockTensorMap(((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, 1, -1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, -1, 1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, -1, -1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((1, 1, 1)=>1)  Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 1)=>1, (0, 0, -1)=>1, (1, 1, 0)=>1, (1, -1, 0)=>1)))  ((Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 1)=>1, (0, 0, -1)=>1, (1, 1, 0)=>1, (1, -1, 0)=>1))  (Vect[(FermionParity  Irrep[U₁]  Irrep[U₁])]((0, 0, 0)=>1)))):
* Block for sector (FermionParity(0)  Irrep[U₁](0)  Irrep[U₁](1)):
[8.0; -0.7071067811865475; -0.7071067811865475; 1.0;;]* Block for sector (FermionParity(0)  Irrep[U₁](0)  Irrep[U₁](-1)):
[0.0; 0.7071067811865475; 0.7071067811865475; 1.0;;]* Block for sector (FermionParity(1)  Irrep[U₁](1)  Irrep[U₁](0)):
[0.0; -0.7071067811865476; -0.7071067811865476; 1.0;;]* Block for sector (FermionParity(1)  Irrep[U₁](-1)  Irrep[U₁](0)):
[0.0; 0.7071067811865476; 0.7071067811865476; 1.0;;]

which seems to be correct (it has the U value 8), at least for the ground state energy:

expectation_value(gs, H)
-0.4721359549995791

is same as the value my ED code gives:-0.4721359549995797.
But the former one gives

expectation_value(gs, H)
-1.9999999999999996

which is the exact energy for U=0 but not for U=8.

@lkdvos
Copy link
Member

lkdvos commented Jan 23, 2025

Thanks for reporting this, I should be able to fix this soon.

As a side note, do you happen to have more of these benchmark results for the Hubbard model? I would love to add them as simple tests to avoid future issues.

@ZongYongyue
Copy link
Author

I’d be happy to do so. I’m planning to explore the new versions of MPSKit and MPSKitModels soon, and I’ll add some of the test cases under this issue.

@lkdvos
Copy link
Member

lkdvos commented Jan 23, 2025

This issue should now be solved as of MPSKit v0.12.1, so I will close this.
I would still be incredibly happy with some benchmark results to validate our operators.

@lkdvos lkdvos closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants