Skip to content

Commit bd4ddcb

Browse files
authored
Fix parallel VUMPS and complex number support (#37)
1 parent 6e16161 commit bd4ddcb

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

src/nullspace.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function blocksparsetensor(blocks::Dict{B,TB}) where {B,TB}
5959
b1, Tb1 = first(pairs(blocks))
6060
N = length(b1)
6161
indstypes = typeof.(inds(Tb1))
62+
blocktype = eltype(Tb1)
6263
indsT = getindex.(indstypes)
6364
# Determine the indices from the blocks
6465
for (b, Tb) in pairs(blocks)
@@ -72,7 +73,7 @@ function blocksparsetensor(blocks::Dict{B,TB}) where {B,TB}
7273
indsTn[bn] = indsTb[n]
7374
end
7475
end
75-
T = BlockSparseTensor(indsT)
76+
T = BlockSparseTensor(blocktype, indsT)
7677
for (b, Tb) in pairs(blocks)
7778
if !isempty(Tb)
7879
T[b] = Tb

src/vumps_localham.jl

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,23 @@ function tdvp_iteration_parallel(
380380
end
381381

382382
# Sum the Hamiltonian terms in the unit cell
383-
for n in 2:Nsites
384-
hᴸ[n] = hᴸ[n - 1] * ψ.AL[n] * ψ̃.AL[n] + hᴸ[n]
383+
function left_environment_cell(ψ, ψ̃, hᴸ, n)
384+
Nsites = nsites(ψ)
385+
𝕙ᴸ = copy(hᴸ)
386+
for k in reverse((n - Nsites + 2):n)
387+
𝕙ᴸ[k] = 𝕙ᴸ[k - 1] * ψ.AL[k] * ψ̃.AL[k] + 𝕙ᴸ[k]
388+
end
389+
return 𝕙ᴸ[n]
385390
end
386-
Hᴸ = left_environment(hᴸ, ψ; tol=_solver_tol)
391+
392+
#for k in 2:Nsites
393+
# hᴸ[k] = hᴸ[k - 1] * ψ.AL[k] * ψ̃.AL[k] + hᴸ[k]
394+
#end
395+
𝕙ᴸ = copy(hᴸ)
396+
for k in 1:Nsites
397+
𝕙ᴸ[k] = left_environment_cell(ψ, ψ̃, hᴸ, k)
398+
end
399+
Hᴸ = left_environment(hᴸ, 𝕙ᴸ, ψ; tol=_solver_tol)
387400

388401
for n in 2:Nsites
389402
hᴿ[n] = hᴿ[n + 1] * ψ.AR[n + 1] * ψ̃.AR[n + 1] + hᴿ[n]
@@ -398,21 +411,27 @@ function tdvp_iteration_parallel(
398411
Hᴬᶜ(∑h, Hᴸ, Hᴿ, ψ, n), time_step, ψ.AL[n] * ψ.C[n], _solver_tol
399412
)
400413

401-
C̃[n] = Cvecsₙ[1]
402-
Ãᶜ[n] = Avecsₙ[1]
414+
C̃[n] = Cvecsₙ
415+
Ãᶜ[n] = Avecsₙ
416+
end
417+
418+
function ortho_overlap(AC, C)
419+
AL, _ = polar(AC * dag(C), uniqueinds(AC, C))
420+
return noprime(AL)
403421
end
404422

405-
# TODO: based on minimum singular values of C̃, use more accurate
406-
# method for finding Ãᴸ, Ãᴿ
423+
function ortho_polar(AC, C)
424+
UAC, _ = polar(AC, uniqueinds(AC, C))
425+
UC, _ = polar(C, commoninds(C, AC))
426+
return noprime(UAC) * noprime(dag(UC))
427+
end
428+
429+
407430
Ãᴸ = InfiniteMPS(Vector{ITensor}(undef, Nsites))
408431
Ãᴿ = InfiniteMPS(Vector{ITensor}(undef, Nsites))
409432
for n in 1:Nsites
410-
Ãᴸⁿ, X = polar(Ãᶜ[n] * dag(C̃[n]), uniqueinds(Ãᶜ[n], C̃[n]))
411-
Ãᴿⁿ, _ = polar(Ãᶜ[n] * dag(C̃[n - 1]), uniqueinds(Ãᶜ[n], C̃[n - 1]))
412-
Ãᴸⁿ = noprime(Ãᴸⁿ)
413-
Ãᴿⁿ = noprime(Ãᴿⁿ)
414-
Ãᴸ[n] = Ãᴸⁿ
415-
Ãᴿ[n] = Ãᴿⁿ
433+
Ãᴸ[n] = ortho_polar(Ãᶜ[n], C̃[n])
434+
Ãᴿ[n] = ortho_polar(Ãᶜ[n], C̃[n-1])
416435
end
417436

418437
for n in 1:Nsites

0 commit comments

Comments
 (0)