Skip to content

Issues Encountered with IDMRG2 Algorithm #292

Open
@sunnowrun

Description

@sunnowrun

I’m currently using IDMRG2 in MPSKit, but have encountered some unexpected behavior.
Below is the relevant code snippet (I’m using the MPS2MPO function to handle Grassmann MPSs).

using TensorKit, MPSKit

function MPS2MPO(mps::MPSKit.InfiniteMPS)
	mpo = [zeros(scalartype(mps.AL[i]), codomain(mps.AL[i]) ← space(mps.AL[i],2) ⊗ space(mps.AL[i],3)') for i in eachindex(mps.AL)]
	for i in eachindex(mpo)
		for (f1,f2) in fusiontrees(mpo[i])
			f1′ = FusionTree((f1.uncoupled[1], Irrep[ℤ₂](f1.uncoupled[2].n + 1 % 2)), Irrep[ℤ₂](f1.coupled.n+1%2), f1.isdual)
			f2′ = FusionTree(f2.uncoupled[[2]], f2.uncoupled[2], f2.isdual[[2]])
			if f2.uncoupled[1].n == 0
				copyto!(mpo[i][f1,f2] , mps.AL[i][f1,f2′])
			elseif f1.uncoupled[2].n == 1
				copyto!(mpo[i][f1,f2] , mps.AL[i][f1′,f2′])
			end
		end
		for (f1,f2) in fusiontrees(mpo[i])
			if f1.uncoupled[1].n == 1 && f2.uncoupled[1].n == 1
				mpo[i][f1,f2] .*= -1
			end
		end

	end
	return MPSKit.InfiniteMPO(mpo)

end
function test(T = ComplexF64, L = 2)
	Dh = 3
	x = MPSKit.InfiniteMPS(randn, T, fill(Rep[ℤ₂](0=>1, 1=>1), L), fill(Rep[ℤ₂](0=>Dh, 1=>Dh), L))
	y = MPSKit.InfiniteMPS(randn, T, fill(Rep[ℤ₂](0=>1, 1=>1), L), fill(Rep[ℤ₂](0=>Dh, 1=>Dh), L))
	x′ = MPS2MPO(x)

	res0 = x′ * y

	Dh = 18
	z1 = MPSKit.InfiniteMPS(randn, T, fill(Rep[ℤ₂](0=>1, 1=>1), L), fill(Rep[ℤ₂](0=>Dh, 1=>Dh), L))
	res1, _ = approximate(z1, (x′, y), MPSKit.IDMRG(verbosity=1, tol=1e-12, maxiter=100))

	z2 = MPSKit.InfiniteMPS(randn, T, fill(Rep[ℤ₂](0=>1, 1=>1), L), fill(Rep[ℤ₂](0=>Dh, 1=>Dh), L))
	trunc = truncdim(2*Dh)
	res2, _ = approximate(z2, (x′, y), MPSKit.IDMRG2(verbosity=1, tol=1e-12, maxiter=100, trscheme=trunc))

	@assert norm(dot(res0, res0) - 1) < 1e-10
	@assert norm(dot(res1, res1) - 1) < 1e-10
	@assert norm(dot(res2, res2) - 1) < 1e-10

	println(dot(res0, res1))
	println(dot(res0, res2))
	return res1, res2
end
test(Float64, 2)
test(ComplexF64, 2)
test(Float64, 4)
test(ComplexF64, 4)

belwo is the output

┌ Warning: non-unique fixedpoint detected
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/fixedpoint.jl:27
┌ Warning: non-unique fixedpoint detected
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/fixedpoint.jl:27
┌ Warning: IDMRG cancel 100:	err = 1.6503699291e-06	time = 1.04 sec
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/approximate/idmrg.jl:44
0.9999999992086777 - 8.43769498715119e-15im
0.9022513012776303 + 8.326672684688674e-16im
┌ Warning: IDMRG cancel 100:	err = 4.2302533960e-07	time = 0.98 sec
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/approximate/idmrg.jl:44
0.9999999999803788 + 2.1895713171580676e-14im
0.5670804416153772 - 0.10941681962026244im
┌ Warning: non-unique fixedpoint detected
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/fixedpoint.jl:27
┌ Warning: non-unique fixedpoint detected
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/fixedpoint.jl:27
┌ Warning: IDMRG cancel 100:	err = 3.7099543139e-08	time = 0.16 sec
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/approximate/idmrg.jl:44
0.9999999999999138 - 1.4464098719947963e-16im
0.9999999999999991 + 1.0607145446866777e-16im
┌ Warning: IDMRG cancel 100:	err = 1.4863279294e-09	time = 0.21 sec
└ @ MPSKit ~/.julia/packages/MPSKit/bM5WR/src/algorithms/approximate/idmrg.jl:44
0.999999999999998 + 9.922618282587337e-16im
-0.16548138653124678 + 0.7396622075311708im

IDMRG2 returns incorrect results for L = 2, and also for T = ComplexF64, L = 4.

I’m currently using MPSKit v0.13.1 and TensorKit v0.14.6.

Do you know what might be causing this? Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions