Skip to content

Commit

Permalink
Update examples (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos authored Jul 5, 2024
1 parent e8397ad commit 350d476
Show file tree
Hide file tree
Showing 16 changed files with 28,489 additions and 1,940 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Accessors = "0.1"
FLoops = "0.1, 0.2"
FastClosures = "0.3"
FoldsThreads = "0.1"
KrylovKit = "0.4 - 0.8"
KrylovKit = "0.8.1"
LinearAlgebra = "1.6"
LoggingExtras = "1"
OptimKit = "0.3.1"
Expand Down
25,641 changes: 25,597 additions & 44 deletions docs/src/examples/classic2d/1.hard-hexagon/index.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/src/examples/classic2d/1.hard-hexagon/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"V = virtual_space(D)\n",
"ψ₀ = InfiniteMPS([P], [V])\n",
"ψ, envs, = leading_boundary(ψ₀, mpo, VUMPS(; verbosity=0))\n",
"F = real(first(expectation_value(ψ, mpo)))\n",
"F = real(expectation_value(ψ, mpo))\n",
"S = real(first(entropy(ψ)))\n",
"ξ = correlation_length(ψ)\n",
"println(\"F = $F\\tS = $S\\tξ = $ξ\")"
Expand Down Expand Up @@ -141,11 +141,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.1"
"version": "1.10.4"
},
"kernelspec": {
"name": "julia-1.10",
"display_name": "Julia 1.10.1",
"display_name": "Julia 1.10.4",
"language": "julia"
}
},
Expand Down
440 changes: 185 additions & 255 deletions docs/src/examples/quantum1d/1.ising-cft/index.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/src/examples/quantum1d/1.ising-cft/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"source": [
"E_ex, qps = excitations(H, QuasiparticleAnsatz(), ψ, envs; num=16)\n",
"states_mps = vcat(ψ, map(qp -> convert(FiniteMPS, qp), qps))\n",
"E_mps = map(x -> sum(expectation_value(x, H_mps)), states_mps)\n",
"E_mps = map(x -> expectation_value(x, H_mps), states_mps)\n",
"\n",
"T_mps = periodic_boundary_conditions(DenseMPO(O), L_mps)\n",
"momenta_mps = Float64[]\n",
Expand Down Expand Up @@ -231,11 +231,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.1"
"version": "1.10.4"
},
"kernelspec": {
"name": "julia-1.10",
"display_name": "Julia 1.10.1",
"display_name": "Julia 1.10.4",
"language": "julia"
}
},
Expand Down
453 changes: 133 additions & 320 deletions docs/src/examples/quantum1d/2.haldane/index.md

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions docs/src/examples/quantum1d/2.haldane/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
"outputs": [],
"cell_type": "code",
"source": [
"L = 10\n",
"L = 11\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",
"ψ, envs, delta = find_groundstate(ψ₀, H, DMRG(; verbosity=0))\n",
"E₀ = real.(expectation_value(ψ, H))\n",
"E₀ = real(expectation_value(ψ, H))\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",
"ΔE_finite = real(En_2[1] - En_1[1])"
Expand All @@ -89,8 +89,13 @@
"p_density = plot(; xaxis=\"position\", yaxis=\"energy density\")\n",
"excited_1 = convert(FiniteMPS, st_1[1])\n",
"excited_2 = convert(FiniteMPS, st_2[1])\n",
"plot!(p_density, real.(expectation_value(excited_1, H) .- E₀) ./ L; label=\"S = 1\")\n",
"plot!(p_density, real.(expectation_value(excited_2, H) .- E₀) ./ L; label=\"S = 2\")"
"SS = -S_exchange(ComplexF64, SU2Irrep; spin=1)\n",
"e₀ = [real(expectation_value(ψ, (i, i + 1) => SS)) for i in 1:(L - 1)]\n",
"e₁ = [real(expectation_value(excited_1, (i, i + 1) => SS)) for i in 1:(L - 1)]\n",
"e₂ = [real(expectation_value(excited_2, (i, i + 1) => SS)) for i in 1:(L - 1)]\n",
"plot!(p_density, e₀; label=\"S = 0\")\n",
"plot!(p_density, e₁; label=\"S = 1\")\n",
"plot!(p_density, e₂; label=\"S = 2\")"
],
"metadata": {},
"execution_count": null
Expand Down Expand Up @@ -146,7 +151,7 @@
"source": [
"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)\n",
"ψ_inf, envs_inf, delta_inf = find_groundstate(ψ₀_inf, H; verbosity=0)\n",
"\n",
"kspace = range(0, π, 16)\n",
"Es, _ = excitations(H, QuasiparticleAnsatz(), kspace, ψ_inf, envs_inf; sector=SU2Irrep(1))\n",
Expand Down Expand Up @@ -174,11 +179,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.1"
"version": "1.10.4"
},
"kernelspec": {
"name": "julia-1.10",
"display_name": "Julia 1.10.1",
"display_name": "Julia 1.10.4",
"language": "julia"
}
},
Expand Down
30 changes: 15 additions & 15 deletions docs/src/examples/quantum1d/3.ising-dqpt/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ L = 20
````

````
[ Info: DMRG init: obj = +9.914551645185e+00 err = 1.3697e-01
[ Info: DMRG 1: obj = -2.040021698083e+01 err = 9.7284195077e-04 time = 0.44 sec
[ Info: DMRG 2: obj = -2.040021786696e+01 err = 7.5203822885e-06 time = 0.35 sec
[ Info: DMRG 3: obj = -2.040021786703e+01 err = 9.3598556558e-07 time = 0.09 sec
[ Info: DMRG 4: obj = -2.040021786703e+01 err = 8.3709447459e-10 time = 0.02 sec
[ Info: DMRG conv 5: obj = -2.040021786703e+01 err = 6.6974743335e-13 time = 0.91 sec
[ Info: DMRG init: obj = +9.833992820341e+00 err = 1.5162e-01
[ Info: DMRG 1: obj = -2.040021714792e+01 err = 1.0482607701e-02 time = 0.07 sec
[ Info: DMRG 2: obj = -2.040021715176e+01 err = 2.9301055999e-07 time = 0.02 sec
[ Info: DMRG 3: obj = -2.040021783353e+01 err = 2.1923563339e-05 time = 0.14 sec
[ Info: DMRG 4: obj = -2.040021786702e+01 err = 1.8539117704e-06 time = 0.21 sec
[ Info: DMRG 5: obj = -2.040021786703e+01 err = 7.8191209682e-08 time = 0.04 sec
[ Info: DMRG conv 6: obj = -2.040021786703e+01 err = 6.4920277294e-11 time = 0.49 sec
````

Expand Down Expand Up @@ -108,14 +109,13 @@ Similarly we could start with an initial infinite state and find the pre-quench
````

````
[ Info: VUMPS init: obj = +4.927142607127e-01 err = 3.7065e-01
[ Info: VUMPS 1: obj = -1.062269158559e+00 err = 3.2878729027e-02 time = 1.11 sec
[ Info: VUMPS 2: obj = -1.063544409816e+00 err = 1.0900961086e-05 time = 0.01 sec
[ Info: VUMPS 3: obj = -1.063544409973e+00 err = 6.2659245120e-08 time = 0.01 sec
[ Info: VUMPS 4: obj = -1.063544409973e+00 err = 9.8860768603e-10 time = 0.01 sec
[ Info: VUMPS 5: obj = -1.063544409973e+00 err = 6.5293129644e-11 time = 0.00 sec
[ Info: VUMPS 6: obj = -1.063544409973e+00 err = 6.4544340049e-12 time = 0.00 sec
[ Info: VUMPS conv 7: obj = -1.063544409973e+00 err = 6.4503123241e-13 time = 1.14 sec
[ Info: VUMPS init: obj = +5.083504996507e-01 err = 3.8682e-01
[ Info: VUMPS 1: obj = -1.060586960116e+00 err = 4.7773289906e-02 time = 1.51 sec
[ Info: VUMPS 2: obj = -1.063544400328e+00 err = 8.6203478863e-05 time = 0.01 sec
[ Info: VUMPS 3: obj = -1.063544409973e+00 err = 2.6470717828e-07 time = 0.01 sec
[ Info: VUMPS 4: obj = -1.063544409973e+00 err = 8.9760940163e-09 time = 0.00 sec
[ Info: VUMPS 5: obj = -1.063544409973e+00 err = 4.1698951454e-10 time = 0.00 sec
[ Info: VUMPS conv 6: obj = -1.063544409973e+00 err = 3.7060383050e-11 time = 1.53 sec
````

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

````
0.9999999999999993 - 8.56544100434766e-17im
0.9999999999999964 - 7.217459182439675e-17im
````

so the loschmidth echo takes on the pleasant form
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/quantum1d/3.ising-dqpt/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.1"
"version": "1.10.4"
},
"kernelspec": {
"name": "julia-1.10",
"display_name": "Julia 1.10.1",
"display_name": "Julia 1.10.4",
"language": "julia"
}
},
Expand Down
Loading

3 comments on commit 350d476

@lkdvos
Copy link
Member Author

@lkdvos lkdvos commented on 350d476 Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lkdvos
Copy link
Member Author

@lkdvos lkdvos commented on 350d476 Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/110512

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.0 -m "<description of version>" 350d476de52640eb742d84c788275734ebe1219a
git push origin v0.11.0

Please sign in to comment.