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

Various (hopefully final) fixes (again) #233

Merged
merged 13 commits into from
Jan 22, 2025
Merged
Binary file modified docs/src/assets/README_ising_finite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 45 additions & 45 deletions docs/src/examples/classic2d/1.hard-hexagon/index.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/src/examples/classic2d/1.hard-hexagon/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"cell_type": "code",
"source": [
"mpo = hard_hexagon()\n",
"P = space(mpo.opp[1], 2)\n",
"P = physicalspace(mpo, 1)\n",
"function virtual_space(D::Integer)\n",
" _D = round(Int, D / sum(dim, values(FibonacciAnyon)))\n",
" return Vect[FibonacciAnyon](sector => _D for sector in (:I, :τ))\n",
Expand Down Expand Up @@ -86,7 +86,7 @@
"source": [
"## The scaling hypothesis\n",
"\n",
"The dominant eigenvector is of course only an approximation. The finite bond dimension enforces a finite correlation length, which effectively introduces a length scale in the system. This can be exploited to formulate a [scaling hypothesis](https://arxiv.org/pdf/0812.2903.pdf), which in turn allows to extract the central charge.\n",
"The dominant eigenvector is of course only an approximation. The finite bond dimension enforces a finite correlation length, which effectively introduces a length scale in the system. This can be exploited to formulate a [pollmann2009](@cite), which in turn allows to extract the central charge.\n",
lkdvos marked this conversation as resolved.
Show resolved Hide resolved
"\n",
"First we need to know the entropy and correlation length at a bunch of different bond dimensions. Our approach will be to re-use the previous approximated dominant eigenvector, and then expanding its bond dimension and re-running VUMPS.\n",
"According to the scaling hypothesis we should have $S \\propto \\frac{c}{6} log(ξ)$. Therefore we should find $c$ using"
Expand Down Expand Up @@ -145,11 +145,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.11.1"
"version": "1.11.2"
},
"kernelspec": {
"name": "julia-1.11",
"display_name": "Julia 1.11.1",
"display_name": "Julia 1.11.2",
"language": "julia"
}
},
Expand Down
407 changes: 221 additions & 186 deletions docs/src/examples/quantum1d/1.ising-cft/index.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/src/examples/quantum1d/1.ising-cft/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"cell_type": "code",
"source": [
"L = 12\n",
"H = periodic_boundary_conditions(transverse_field_ising(), L);"
"H = periodic_boundary_conditions(transverse_field_ising(), L)"
],
"metadata": {},
"execution_count": null
Expand Down Expand Up @@ -97,7 +97,7 @@
"source": [
"id = complex(isomorphism(ℂ^2, ℂ^2))\n",
"@tensor O[-1 -2; -3 -4] := id[-1, -3] * id[-2, -4]\n",
"T = periodic_boundary_conditions(DenseMPO(O), L);"
"T = periodic_boundary_conditions(InfiniteMPO([O]), L)"
],
"metadata": {},
"execution_count": null
Expand Down Expand Up @@ -191,11 +191,11 @@
"outputs": [],
"cell_type": "code",
"source": [
"E_ex, qps = excitations(H, QuasiparticleAnsatz(), ψ, envs; num=16)\n",
"E_ex, qps = excitations(H_mps, QuasiparticleAnsatz(), ψ, envs; num=16)\n",
"states_mps = vcat(ψ, map(qp -> convert(FiniteMPS, qp), qps))\n",
"E_mps = map(x -> expectation_value(x, H_mps), states_mps)\n",
"\n",
"T_mps = periodic_boundary_conditions(DenseMPO(O), L_mps)\n",
"T_mps = periodic_boundary_conditions(InfiniteMPO([O]), L_mps)\n",
"momenta_mps = Float64[]\n",
"append!(momenta_mps, fix_degeneracies(states[1:1]))\n",
"append!(momenta_mps, fix_degeneracies(states[2:2]))\n",
Expand Down Expand Up @@ -232,11 +232,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.11.1"
"version": "1.11.2"
},
"kernelspec": {
"name": "julia-1.11",
"display_name": "Julia 1.11.1",
"display_name": "Julia 1.11.2",
"language": "julia"
}
},
Expand Down
250 changes: 124 additions & 126 deletions docs/src/examples/quantum1d/2.haldane/index.md

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions docs/src/examples/quantum1d/2.haldane/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"outputs": [],
"cell_type": "code",
"source": [
"H = heisenberg_XXX(ComplexF64, SU2Irrep; spin=1, J=1);"
"symmetry = SU2Irrep\n",
"spin = 1\n",
"J = 1"
],
"metadata": {},
"execution_count": null
Expand All @@ -63,9 +65,12 @@
"cell_type": "code",
"source": [
"L = 11\n",
"chain = FiniteChain(L)\n",
"H = heisenberg_XXX(symmetry, chain; J, spin)\n",
"\n",
"physical_space = SU2Space(1 => 1)\n",
"virtual_space = SU2Space(0 => 12, 1 => 12, 2 => 5, 3 => 3)\n",
"ψ₀ = FiniteMPS(rand, ComplexF64, L, physical_space, virtual_space)\n",
"ψ₀ = FiniteMPS(L, physical_space, virtual_space)\n",
"ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0))\n",
"E₀ = real(expectation_value(ψ, H))\n",
"En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(1))\n",
Expand Down Expand Up @@ -114,7 +119,8 @@
"Ls = 12:4:30\n",
"ΔEs = map(Ls) do L\n",
" @info \"computing L = $L\"\n",
" ψ₀ = FiniteMPS(rand, ComplexF64, L, physical_space, virtual_space)\n",
" ψ₀ = FiniteMPS(L, physical_space, virtual_space)\n",
" H = heisenberg_XXX(symmetry, FiniteChain(L); J, spin)\n",
" ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0))\n",
" En_1, st_1 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(1))\n",
" En_2, st_2 = excitations(H, QuasiparticleAnsatz(), ψ, envs; sector=SU2Irrep(2))\n",
Expand Down Expand Up @@ -149,6 +155,8 @@
"outputs": [],
"cell_type": "code",
"source": [
"chain = InfiniteChain(1)\n",
"H = heisenberg_XXX(symmetry, chain; J, spin)\n",
"virtual_space_inf = Rep[SU₂](1 // 2 => 16, 3 // 2 => 16, 5 // 2 => 8, 7 // 2 => 4)\n",
"ψ₀_inf = InfiniteMPS([physical_space], [virtual_space_inf])\n",
"ψ_inf, envs_inf, delta_inf = find_groundstate(ψ₀_inf, H; verbosity=0)\n",
Expand Down Expand Up @@ -179,11 +187,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.11.1"
"version": "1.11.2"
},
"kernelspec": {
"name": "julia-1.11",
"display_name": "Julia 1.11.1",
"display_name": "Julia 1.11.2",
"language": "julia"
}
},
Expand Down
57 changes: 25 additions & 32 deletions docs/src/examples/quantum1d/3.ising-dqpt/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,21 @@ For those ``g`` we expect non-analicities to occur at ``t_n ≈ 2.35 (n + 1/2)``
First we construct the hamiltonian in mpo form, and obtain the pre-quenched groundstate:

````julia
H₀ = transverse_field_ising(; g=-0.5)

L = 20
ψ₀ = FiniteMPS(rand, ComplexF64, L, ℂ^2, ℂ^10)
H₀ = transverse_field_ising(FiniteChain(L); g=-0.5)
ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10)
ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG());
````

````
[ Info: DMRG init: obj = +9.799964091770e+00 err = 1.5223e-01
[ Info: DMRG 1: obj = -2.040021714743e+01 err = 2.4038839149e-02 time = 0.09 sec
[ Info: DMRG 2: obj = -2.040021715170e+01 err = 6.0313575856e-07 time = 0.07 sec
[ Info: DMRG 3: obj = -2.040021773534e+01 err = 1.6799456960e-05 time = 0.14 sec
[ Info: DMRG 4: obj = -2.040021786694e+01 err = 1.9058246307e-06 time = 0.09 sec
[ Info: DMRG 5: obj = -2.040021786703e+01 err = 1.1474711603e-06 time = 0.05 sec
[ Info: DMRG 6: obj = -2.040021786703e+01 err = 4.3837579221e-10 time = 0.02 sec
[ Info: DMRG conv 7: obj = -2.040021786703e+01 err = 1.9834477158e-11 time = 0.50 sec
[ Info: DMRG init: obj = +1.002387808585e+01 err = 1.4432e-01
[ Info: DMRG 1: obj = -2.040021714927e+01 err = 4.0939235067e-03 time = 0.07 sec
[ Info: DMRG 2: obj = -2.040021715177e+01 err = 4.1045749328e-07 time = 0.02 sec
[ Info: DMRG 3: obj = -2.040021782419e+01 err = 4.0893119931e-05 time = 0.11 sec
[ Info: DMRG 4: obj = -2.040021786700e+01 err = 1.5231059570e-06 time = 0.12 sec
[ Info: DMRG 5: obj = -2.040021786703e+01 err = 1.1927466419e-07 time = 0.04 sec
[ Info: DMRG 6: obj = -2.040021786703e+01 err = 1.0958548921e-10 time = 0.02 sec
[ Info: DMRG conv 7: obj = -2.040021786703e+01 err = 2.1531775493e-12 time = 0.43 sec
````

Expand All @@ -63,7 +62,7 @@ echo(ψ₀::FiniteMPS, ψₜ::FiniteMPS) = -2 * log(abs(dot(ψ₀, ψₜ))) / le
We will initially use a two-site TDVP scheme to dynamically increase the bond dimension while time evolving, and later on switch to a faster one-site scheme. A single timestep can be done using

````julia
H₁ = transverse_field_ising(; g=-2.0)
H₁ = transverse_field_ising(FiniteChain(L); g=-2.0)
ψₜ = deepcopy(ψ₀)
dt = 0.01
ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme=truncdim(20)));
Expand All @@ -75,9 +74,11 @@ Putting it all together, we get

````julia
function finite_sim(L; dt=0.05, finaltime=5.0)
ψ₀ = FiniteMPS(rand, ComplexF64, L, ℂ^2, ℂ^10)
ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10)
H₀= transverse_field_ising(FiniteChain(L); g=-0.5)
ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG())

H₁ = transverse_field_ising(FiniteChain(L); g=-2.0)
ψₜ = deepcopy(ψ₀)
envs = environments(ψₜ, H₁)

Expand Down Expand Up @@ -106,27 +107,18 @@ Similarly we could start with an initial infinite state and find the pre-quench

````julia
ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10])
H₀ = transverse_field_ising(; g=-0.5)
ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS());
````

````
[ Info: VUMPS init: obj = +5.000419382862e-01 err = 3.8507e-01
[ Info: VUMPS 1: obj = -1.062780898337e+00 err = 2.4151374798e-02 time = 1.31 sec
┌ Warning: ignoring imaginary component -3.817802691569172e-6 from total weight 2.4343214394239743: operator might not be hermitian?
│ α = 1.7081089443203243 - 3.817802691569172e-6im
│ β₁ = 0.14004438155194618
│ β₂ = 1.7287776826281838
└ @ KrylovKit ~/.julia/packages/KrylovKit/xccMN/src/factorizations/lanczos.jl:170
┌ Warning: ignoring imaginary component -4.33258309393697e-6 from total weight 3.290563788912538: operator might not be hermitian?
│ α = 2.784222669687663 - 4.33258309393697e-6im
│ β₁ = 0.13141322180957496
│ β₂ = 1.7488981501547187
└ @ KrylovKit ~/.julia/packages/KrylovKit/xccMN/src/factorizations/lanczos.jl:170
[ Info: VUMPS 2: obj = -1.063544409753e+00 err = 1.4337063091e-05 time = 0.08 sec
[ Info: VUMPS 3: obj = -1.063544409973e+00 err = 1.7048015038e-07 time = 0.01 sec
[ Info: VUMPS 4: obj = -1.063544409973e+00 err = 1.7183182449e-08 time = 0.01 sec
[ Info: VUMPS 5: obj = -1.063544409973e+00 err = 5.8865202016e-10 time = 0.01 sec
[ Info: VUMPS conv 6: obj = -1.063544409973e+00 err = 6.8020365686e-11 time = 1.42 sec
[ Info: VUMPS init: obj = +4.829091166942e-01 err = 3.8333e-01
[ Info: VUMPS 1: obj = -1.062402142520e+00 err = 2.6498065851e-02 time = 0.02 sec
[ Info: VUMPS 2: obj = -1.063544409278e+00 err = 2.4370573433e-05 time = 0.01 sec
[ Info: VUMPS 3: obj = -1.063544409973e+00 err = 1.2541001144e-07 time = 0.01 sec
[ Info: VUMPS 4: obj = -1.063544409973e+00 err = 2.2271390880e-09 time = 0.01 sec
[ Info: VUMPS 5: obj = -1.063544409973e+00 err = 1.3003499540e-10 time = 0.01 sec
[ Info: VUMPS conv 6: obj = -1.063544409973e+00 err = 1.2478380148e-11 time = 0.08 sec
````

Expand All @@ -138,7 +130,7 @@ dot(ψ₀, ψ₀)
````

````
1.0000000000000018 - 7.06078012856404e-16im
1.0000000000000004 + 1.6174779448250835e-16im
````

so the loschmidth echo takes on the pleasant form
Expand All @@ -155,6 +147,7 @@ Growing the bond dimension by ``5`` can be done by calling:

````julia
ψₜ = deepcopy(ψ₀)
H₁ = transverse_field_ising(; g=-2.0)
ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(5)));
````

Expand Down Expand Up @@ -183,7 +176,7 @@ function infinite_sim(dt=0.05, finaltime=5.0)
if t < 50dt # if t is sufficiently small, we increase the bond dimension
ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(1)), envs)
end
(ψₜ, envs) = timestep(ψₜ, H₁, 0, dt, TDVP(), envs)
ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP(), envs)
push!(echos, echo(ψₜ, ψ₀))
end

Expand Down
19 changes: 11 additions & 8 deletions docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@
"outputs": [],
"cell_type": "code",
"source": [
"H₀ = transverse_field_ising(; g=-0.5)\n",
"\n",
"L = 20\n",
"ψ₀ = FiniteMPS(rand, ComplexF64, L, ℂ^2, ℂ^10)\n",
"H₀ = transverse_field_ising(FiniteChain(L); g=-0.5)\n",
"ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10)\n",
"ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG());"
],
"metadata": {},
Expand Down Expand Up @@ -83,7 +82,7 @@
"outputs": [],
"cell_type": "code",
"source": [
"H₁ = transverse_field_ising(; g=-2.0)\n",
"H₁ = transverse_field_ising(FiniteChain(L); g=-2.0)\n",
"ψₜ = deepcopy(ψ₀)\n",
"dt = 0.01\n",
"ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP2(; trscheme=truncdim(20)));"
Expand All @@ -105,9 +104,11 @@
"cell_type": "code",
"source": [
"function finite_sim(L; dt=0.05, finaltime=5.0)\n",
" ψ₀ = FiniteMPS(rand, ComplexF64, L, ℂ^2, ℂ^10)\n",
" ψ₀ = FiniteMPS(L, ℂ^2, ℂ^10)\n",
" H₀= transverse_field_ising(FiniteChain(L); g=-0.5)\n",
" ψ₀, _ = find_groundstate(ψ₀, H₀, DMRG())\n",
"\n",
" H₁ = transverse_field_ising(FiniteChain(L); g=-2.0)\n",
" ψₜ = deepcopy(ψ₀)\n",
" envs = environments(ψₜ, H₁)\n",
"\n",
Expand Down Expand Up @@ -147,6 +148,7 @@
"cell_type": "code",
"source": [
"ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10])\n",
"H₀ = transverse_field_ising(; g=-0.5)\n",
"ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS());"
],
"metadata": {},
Expand Down Expand Up @@ -201,6 +203,7 @@
"cell_type": "code",
"source": [
"ψₜ = deepcopy(ψ₀)\n",
"H₁ = transverse_field_ising(; g=-2.0)\n",
"ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(5)));"
],
"metadata": {},
Expand Down Expand Up @@ -249,7 +252,7 @@
" if t < 50dt # if t is sufficiently small, we increase the bond dimension\n",
" ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(1)), envs)\n",
" end\n",
" (ψₜ, envs) = timestep(ψₜ, H₁, 0, dt, TDVP(), envs)\n",
" ψₜ, envs = timestep(ψₜ, H₁, 0, dt, TDVP(), envs)\n",
" push!(echos, echo(ψₜ, ψ₀))\n",
" end\n",
"\n",
Expand Down Expand Up @@ -282,11 +285,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.11.1"
"version": "1.11.2"
},
"kernelspec": {
"name": "julia-1.11",
"display_name": "Julia 1.11.1",
"display_name": "Julia 1.11.2",
"language": "julia"
}
},
Expand Down
Loading
Loading