diff --git a/docs/src/examples/quantum1d/3.ising-dqpt/index.md b/docs/src/examples/quantum1d/3.ising-dqpt/index.md index 328e3f53f..6c9555fd9 100644 --- a/docs/src/examples/quantum1d/3.ising-dqpt/index.md +++ b/docs/src/examples/quantum1d/3.ising-dqpt/index.md @@ -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 ```` @@ -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))); @@ -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₁) @@ -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 ```` @@ -138,7 +130,7 @@ dot(ψ₀, ψ₀) ```` ```` -1.0000000000000018 - 7.06078012856404e-16im +1.0000000000000004 + 1.6174779448250835e-16im ```` so the loschmidth echo takes on the pleasant form @@ -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))); ```` @@ -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 diff --git a/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb b/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb index 2f706e573..8dc4f3e39 100644 --- a/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb +++ b/docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb @@ -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": {}, @@ -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)));" @@ -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", @@ -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": {}, @@ -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": {}, @@ -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", @@ -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" } }, diff --git a/examples/Cache.toml b/examples/Cache.toml index 6593e4c55..eaaebbe4e 100644 --- a/examples/Cache.toml +++ b/examples/Cache.toml @@ -3,4 +3,5 @@ [quantum1d] "2.haldane" = "4f3e177a30df907cf7b9a47958ddf97741e4d0398ae1876e0f4977ccb93ae651" +"3.ising-dqpt" = "f437ac4560db51f67e3997867c02bb8844b1077731b1dd1a06c61ab7c4846e97" "1.ising-cft" = "bd1253451973aa73c4fee6b64d81ee52cc2feba5b9632f87ce332eea3a05f460" diff --git a/examples/quantum1d/3.ising-dqpt/main.jl b/examples/quantum1d/3.ising-dqpt/main.jl index 94a5bb4c4..dca1e34f5 100644 --- a/examples/quantum1d/3.ising-dqpt/main.jl +++ b/examples/quantum1d/3.ising-dqpt/main.jl @@ -25,10 +25,10 @@ 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: """ -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()); md""" @@ -44,7 +44,7 @@ md""" 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 """ -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))); @@ -56,9 +56,11 @@ Putting it all together, we get """ 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₁) @@ -83,6 +85,7 @@ Similarly we could start with an initial infinite state and find the pre-quench """ ψ₀ = InfiniteMPS([ℂ^2], [ℂ^10]) +H₀ = transverse_field_ising(; g=-0.5) ψ₀, _ = find_groundstate(ψ₀, H₀, VUMPS()); md""" @@ -107,6 +110,7 @@ Growing the bond dimension by ``5`` can be done by calling: """ ψₜ = deepcopy(ψ₀) +H₁ = transverse_field_ising(; g=-2.0) ψₜ, envs = changebonds(ψₜ, H₁, OptimalExpand(; trscheme=truncdim(5))); # a single timestep is easy @@ -133,7 +137,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