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

Fix bug in DMRG-X with QNs #61

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dmrg_x.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function dmrg_x_solver(PH, t, psi0; kwargs...)
H = contract(PH, ITensor(true))
D, U = eigen(H; ishermitian=true)
u = uniqueind(U, H)
max_overlap, max_ind = findmax(abs, array(psi0 * U))
max_overlap, max_ind = findmax(abs, array(psi0 * dag(U)))
U_max = U * dag(onehot(u => max_ind))
return U_max, nothing
end
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
ITensorTDVP = "25707e16-a4db-4a07-99d9-4d67b7af0342"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 1 addition & 1 deletion test/test_dmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using Test
H, psi; nsweeps, maxdim, cutoff, nsite, solver_krylovdim=3, solver_maxiter=1
)

e2, psi2 = dmrg(H, psi, sweeps; normalize=false, outputlevel=0)
e2, psi2 = dmrg(H, psi, sweeps; outputlevel=0)

@test inner(psi', H, psi) ≈ inner(psi2', H, psi2)
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_dmrg_x.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using ITensorTDVP
using Random
using Test

@testset "DMRG-X" begin
@testset "DMRG-X (conserve_qns=$conserve_qns)" for conserve_qns in [false, true]
function heisenberg(n; h=zeros(n))
os = OpSum()
for j in 1:(n - 1)
Expand All @@ -20,7 +20,7 @@ using Test
end

n = 10
s = siteinds("S=1/2", n)
s = siteinds("S=1/2", n; conserve_qns)

Random.seed!(12)

Expand Down
Loading