Skip to content

Commit 487bc7a

Browse files
authored
Fix finite temperature example (#266)
* Fix and clean up * Update example * small fixes
1 parent c95a9f0 commit 487bc7a

File tree

5 files changed

+700
-675
lines changed

5 files changed

+700
-675
lines changed

docs/src/examples/quantum1d/7.xy-finiteT/index.md

Lines changed: 490 additions & 510 deletions
Large diffs are not rendered by default.

docs/src/examples/quantum1d/7.xy-finiteT/main.ipynb

Lines changed: 106 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"using QuadGK: quadgk\n",
1313
"using SpecialFunctions: ellipe\n",
1414
"using Plots\n",
15-
"using LinearAlgebra"
15+
"using LinearAlgebra\n",
16+
"using BenchmarkFreeFermions"
1617
],
1718
"metadata": {},
1819
"execution_count": null
@@ -25,6 +26,7 @@
2526
"This example shows how to simulate the finite temperature behavior of the XY model in 1D.\n",
2627
"Importantly, the Hamiltonian can be diagonalized in terms of fermionic creation and annihilation operators.\n",
2728
"As a result, many properties have analytical expressions that can be used to verify our results.\n",
29+
"Here, we use [BenchmarkFreeFermions.jl](https://github.com/Qiaoyi-Li/BenchmarkFreeFermions.jl/) to compare our results.\n",
2830
"\n",
2931
"$$\n",
3032
" H = J \\sum_{i=1}^{N} \\left( \\sigma^x_i \\sigma^x_{i+1} + \\sigma^y_i \\sigma^y_{i+1} \\right)\n",
@@ -46,7 +48,8 @@
4648
"cell_type": "code",
4749
"source": [
4850
"J = 1 / 2\n",
49-
"N = 30\n",
51+
"T = ComplexF64\n",
52+
"symmetry = U1Irrep\n",
5053
"\n",
5154
"function XY_hamiltonian(::Type{T}=ComplexF64, ::Type{S}=Trivial; J=1 / 2,\n",
5255
" N) where {T<:Number,S<:Sector}\n",
@@ -85,10 +88,11 @@
8588
"outputs": [],
8689
"cell_type": "code",
8790
"source": [
88-
"single_particle_energy(k, J, N) = J * cos(k * 2π / (N + 0))\n",
8991
"function groundstate_energy(J, N)\n",
90-
" return isfinite(N) ?\n",
91-
" -sum(n -> abs(single_particle_energy(n, J, N)), 1:N) / 2N : -J / π\n",
92+
" isfinite(N) || return -J / π\n",
93+
" T = diagm(1 => J / 2 * ones(N - 1), -1 => J / 2 * ones(N - 1))\n",
94+
" ϵ = SingleParticleSpectrum(T)\n",
95+
" return Energy(ϵ, Inf, 0) / N\n",
9296
"end"
9397
],
9498
"metadata": {},
@@ -107,14 +111,15 @@
107111
"outputs": [],
108112
"cell_type": "code",
109113
"source": [
110-
"H = periodic_boundary_conditions(XY_hamiltonian(; J, N=Inf), 6)\n",
114+
"N_exact = 6\n",
115+
"H = open_boundary_conditions(XY_hamiltonian(T, symmetry; J, N=Inf), N_exact)\n",
111116
"H_dense = convert(TensorMap, H);\n",
112-
"vals = eigvals(H_dense)[Trivial()] ./ 6\n",
113-
"groundstate_energy(J, 6)\n",
117+
"vals = eigvals(H_dense)[one(symmetry)] ./ N_exact\n",
118+
"groundstate_energy(J, N_exact)\n",
114119
"\n",
115-
"println(\"Exact (N=6):\\t\", groundstate_energy(J, 6))\n",
116-
"println(\"Exact (N=Inf):\\t\", groundstate_energy(J, Inf))\n",
117-
"println(\"Numerical:\\t\", minimum(real(vals)))"
120+
"println(\"Numerical:\\t\", minimum(real(vals)))\n",
121+
"println(\"Exact (N=$(N_exact)):\\t\", groundstate_energy(J, N_exact))\n",
122+
"println(\"Exact (N=Inf):\\t\", groundstate_energy(J, Inf))"
118123
],
119124
"metadata": {},
120125
"execution_count": null
@@ -132,15 +137,18 @@
132137
"outputs": [],
133138
"cell_type": "code",
134139
"source": [
135-
"H = XY_hamiltonian(; J, N)\n",
140+
"N = 32\n",
141+
"H = XY_hamiltonian(T, symmetry; J, N)\n",
136142
"D = 64\n",
137-
"psi_init = FiniteMPS(N, physicalspace(H, 1), ℂ^D)\n",
138-
"psi, envs, = find_groundstate(psi_init, H, DMRG(; maxiter=10));\n",
143+
"V_init = symmetry === Trivial ? ℂ^32 : U1Space(i => 10 for i in -1:(1 // 2):1)\n",
144+
"psi_init = FiniteMPS(N, physicalspace(H, 1), V_init)\n",
145+
"trscheme = truncdim(D)\n",
146+
"psi, envs, = find_groundstate(psi_init, H, DMRG2(; trscheme, maxiter=5));\n",
139147
"E_0 = expectation_value(psi, H, envs) / N\n",
140148
"\n",
149+
"println(\"Numerical:\\t\", real(E_0))\n",
141150
"println(\"Exact (N=$N):\\t\", groundstate_energy(J, N))\n",
142-
"println(\"Exact (N=Inf):\\t\", groundstate_energy(J, Inf))\n",
143-
"println(\"Numerical:\\t\", real(E_0))"
151+
"println(\"Exact (N=Inf):\\t\", groundstate_energy(J, Inf))"
144152
],
145153
"metadata": {},
146154
"execution_count": null
@@ -197,11 +205,20 @@
197205
"cell_type": "code",
198206
"source": [
199207
"function partition_function(β::Number, J::Number, N::Number)\n",
200-
" return prod(k -> (1 + exp(-β * single_particle_energy(k, J, N))), 1:N)^(1 / N)\n",
208+
" T = diagm(1 => J / 2 * ones(N - 1), -1 => J / 2 * ones(N - 1))\n",
209+
" ϵ = SingleParticleSpectrum(T)\n",
210+
" return LogPartition(ϵ, β, 0) / N\n",
201211
"end\n",
202212
"function free_energy(β, J, N)\n",
203-
" return -1 / β * log(partition_function(β, J, N))\n",
204-
"end"
213+
" T = diagm(1 => J / 2 * ones(N - 1), -1 => J / 2 * ones(N - 1))\n",
214+
" ϵ = SingleParticleSpectrum(T)\n",
215+
" return FreeEnergy(ϵ, β, 0) / N\n",
216+
"end\n",
217+
"\n",
218+
"βs = 0.0:0.2:8.0\n",
219+
"\n",
220+
"Z_analytic = partition_function.(βs, J, N);\n",
221+
"F_analytic = free_energy.(βs, J, N);"
205222
],
206223
"metadata": {},
207224
"execution_count": null
@@ -224,33 +241,32 @@
224241
"outputs": [],
225242
"cell_type": "code",
226243
"source": [
227-
"βs = 0.0:0.2:8.0\n",
228244
"expansion_orders = 1:3\n",
229245
"\n",
230-
"function partition_function_taylor(β, H; expansion_order)\n",
246+
"function logpartition_taylor(β, H; expansion_order)\n",
231247
" dτ = im * β\n",
232248
" expH = make_time_mpo(H, dτ,\n",
233249
" TaylorCluster(; N=expansion_order))\n",
234-
" return real(tr(expH))^(1 / N)\n",
250+
" return log(real(tr(expH))) / length(H)\n",
235251
"end\n",
236252
"\n",
237253
"Z_taylor = map(Iterators.product(βs, expansion_orders)) do (β, expansion_order)\n",
238254
" @info \"Computing β = $β at order $expansion_order\"\n",
239-
" return partition_function_taylor(β, H; expansion_order)\n",
255+
" return logpartition_taylor(β, H; expansion_order)\n",
240256
"end\n",
241-
"F_taylor = -(1 ./ βs) .* log.(Z_taylor)\n",
257+
"F_taylor = -(1 ./ βs) .* Z_taylor\n",
242258
"\n",
243259
"p_taylor = let\n",
244260
" labels = reshape(map(expansion_orders) do N\n",
245261
" return \"Taylor N=$N\"\n",
246262
" end, 1, :)\n",
247-
" p1 = plot(βs, partition_function.(βs, J, N); label=\"analytic\",\n",
263+
" p1 = plot(βs, Z_analytic; label=\"analytic\",\n",
248264
" title=\"Partition function\",\n",
249265
" xlabel=\"β\", ylabel=\"Z(β)\")\n",
250-
" plot!(p1, βs, real.(Z_taylor); label=labels)\n",
251-
" p2 = plot(βs, free_energy.(βs, J, N); label=\"analytic\", title=\"Free energy\",\n",
266+
" plot!(p1, βs, Z_taylor; label=labels)\n",
267+
" p2 = plot(βs, F_analytic; label=\"analytic\", title=\"Free energy\",\n",
252268
" xlabel=\"β\", ylabel=\"F(β)\")\n",
253-
" plot!(p2, βs, real.(F_taylor); label=labels)\n",
269+
" plot!(p2, βs, F_taylor; label=labels)\n",
254270
" plot(p1, p2)\n",
255271
"end"
256272
],
@@ -298,14 +314,18 @@
298314
"outputs": [],
299315
"cell_type": "code",
300316
"source": [
317+
"expansion_orders = 2:3\n",
318+
"Z_taylor = Z_taylor[:, 2:end]\n",
319+
"F_taylor = F_taylor[:, 2:end]\n",
320+
"\n",
301321
"p_taylor_diff = let\n",
302-
" labels = reshape(map(expansion_orders[2:end]) do N\n",
322+
" labels = reshape(map(expansion_orders) do N\n",
303323
" return \"Taylor N=$N\"\n",
304324
" end, 1, :)\n",
305-
" p1 = plot(βs, abs.(real.(Z_taylor[:, 2:end]) .- partition_function.(βs, J, N));\n",
325+
" p1 = plot(βs, abs.(Z_taylor .- Z_analytic);\n",
306326
" label=labels, title=\"Partition function error\",\n",
307327
" xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n",
308-
" p2 = plot(βs, abs.(real.(F_taylor[:, 2:end]) .- free_energy.(βs, J, N)); label=labels,\n",
328+
" p2 = plot(βs, abs.(F_taylor .- F_analytic); label=labels,\n",
309329
" xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n",
310330
" plot(p1, p2)\n",
311331
"end"
@@ -341,26 +361,28 @@
341361
"outputs": [],
342362
"cell_type": "code",
343363
"source": [
344-
"function partition_function_taylor2(β, H; expansion_order)\n",
364+
"double_logpartition(ρ₁, ρ₂=ρ₁) = log(real(dot(ρ₁, ρ₂))) / length(ρ₁)\n",
365+
"\n",
366+
"function logpartition_taylor2(β, H; expansion_order)\n",
345367
" dτ = im * β / 2\n",
346368
" expH = make_time_mpo(H, dτ, TaylorCluster(; N=expansion_order))\n",
347-
" return real(dot(expH, expH))^(1 / N)\n",
369+
" return double_logpartition(expH)\n",
348370
"end\n",
349371
"\n",
350-
"Z_taylor2 = map(Iterators.product(βs, expansion_orders[2:end])) do (β, expansion_order)\n",
372+
"Z_taylor2 = map(Iterators.product(βs, expansion_orders)) do (β, expansion_order)\n",
351373
" @info \"Computing β = $β at order $expansion_order\"\n",
352-
" return partition_function_taylor2(β, H; expansion_order)\n",
374+
" return logpartition_taylor2(β, H; expansion_order)\n",
353375
"end\n",
354-
"F_taylor2 = -(1 ./ βs) .* log.(Z_taylor2)\n",
376+
"F_taylor2 = -(1 ./ βs) .* Z_taylor2\n",
355377
"\n",
356378
"p_taylor2_diff = let\n",
357379
" labels = reshape(map(expansion_orders[2:end]) do N\n",
358380
" return \"Taylor N=$N\"\n",
359381
" end, 1, :)\n",
360-
" p1 = plot(βs, abs.(real.(Z_taylor2) .- partition_function.(βs, J, N));\n",
382+
" p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic);\n",
361383
" label=labels, title=\"Partition function error\",\n",
362384
" xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n",
363-
" p2 = plot(βs, abs.(real.(F_taylor2) .- free_energy.(βs, J, N)); label=labels,\n",
385+
" p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels,\n",
364386
" xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n",
365387
" plot(p1, p2)\n",
366388
"end"
@@ -389,6 +411,8 @@
389411
"To achieve this, we can reinterpret the density matrix as an MPS with two physical indices.\n",
390412
"Then, we have some control over the approximations we make by tuning the maximal bond dimension.\n",
391413
"\n",
414+
"Here, we swich to a logarithmic scale for the errors to better illustrate the results.\n",
415+
"\n",
392416
"> **Warning**\n",
393417
">\n",
394418
"> Using MPS techniques to approximate the multiplication of density matrices does not necessarily inherit all of the nice properties of approximating MPS.\n",
@@ -408,7 +432,7 @@
408432
"# first iteration: start from high order Taylor expansion\n",
409433
"ρ₀ = make_time_mpo(H, im * βs[2] / 2, TaylorCluster(; N=3))\n",
410434
"Z_mpo_mul[1] = Z_taylor[1]\n",
411-
"Z_mpo_mul[2] = real(dot(ρ₀, ρ₀))^(1 / N)\n",
435+
"Z_mpo_mul[2] = double_logpartition(ρ₀)\n",
412436
"\n",
413437
"# subsequent iterations: multiply by ρ₀\n",
414438
"ρ_mps = convert(FiniteMPS, ρ₀)\n",
@@ -417,22 +441,23 @@
417441
" @info \"Computing β = $(βs[i])\"\n",
418442
" ρ_mps, = approximate(ρ_mps, (ρ₀, ρ_mps),\n",
419443
" DMRG2(; trscheme=truncdim(D_max), maxiter=10))\n",
420-
" Z_mpo_mul[i] = real(dot(ρ_mps, ρ_mps))^(1 / N)\n",
444+
" Z_mpo_mul[i] = double_logpartition(ρ_mps)\n",
421445
"end\n",
422-
"F_mpo_mul = -(1 ./ βs) .* log.(Z_mpo_mul)\n",
446+
"F_mpo_mul = -(1 ./ βs) .* Z_mpo_mul\n",
423447
"\n",
424448
"p_mpo_mul_diff = let\n",
425-
" labels = reshape(map(expansion_orders[2:end]) do N\n",
449+
" labels = reshape(map(expansion_orders) do N\n",
426450
" return \"Taylor N=$N\"\n",
427451
" end, 1, :)\n",
428-
" p1 = plot(βs, abs.(real.(Z_taylor2) .- partition_function.(βs, J, N));\n",
452+
" p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic);\n",
429453
" label=labels, title=\"Partition function error\",\n",
430-
" xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n",
431-
" plot!(p1, βs, abs.(real.(Z_mpo_mul) .- partition_function.(βs, J, N));\n",
454+
" xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:bottomright, yscale=:log10)\n",
455+
" plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic);\n",
432456
" label=\"MPO multiplication\")\n",
433-
" p2 = plot(βs, abs.(real.(F_taylor2) .- free_energy.(βs, J, N)); label=labels,\n",
434-
" xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n",
435-
" plot!(p2, βs, abs.(real.(F_mpo_mul) .- free_energy.(βs, J, N));\n",
457+
" p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels,\n",
458+
" xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=nothing,\n",
459+
" yscale=:log10)\n",
460+
" plot!(p2, βs, abs.(F_mpo_mul .- F_analytic);\n",
436461
" label=\"MPO multiplication\")\n",
437462
" plot(p1, p2)\n",
438463
"end"
@@ -484,11 +509,14 @@
484509
"cell_type": "code",
485510
"source": [
486511
"βs_exp = 2.0 .^ (-3:3)\n",
512+
"Z_analytic_exp = partition_function.(βs_exp, J, N)\n",
513+
"F_analytic_exp = free_energy.(βs_exp, J, N)\n",
514+
"\n",
487515
"Z_mpo_mul_exp = zeros(length(βs_exp))\n",
488516
"\n",
489517
"# first iteration: start from high order Taylor expansion\n",
490518
"ρ₀ = make_time_mpo(H, im * first(βs_exp) / 2, TaylorCluster(; N=3))\n",
491-
"Z_mpo_mul_exp[1] = real(dot(ρ₀, ρ₀))^(1 / N)\n",
519+
"Z_mpo_mul_exp[1] = double_logpartition(ρ₀)\n",
492520
"\n",
493521
"# subsequent iterations: square\n",
494522
"ρ = ρ₀\n",
@@ -498,29 +526,25 @@
498526
" @info \"Computing β = $(βs_exp[i])\"\n",
499527
" ρ_mps, = approximate(ρ_mps, (ρ, ρ_mps),\n",
500528
" DMRG2(; trscheme=truncdim(D_max), maxiter=10))\n",
501-
" Z_mpo_mul_exp[i] = real(dot(ρ_mps, ρ_mps))^(1 / N)\n",
529+
" Z_mpo_mul_exp[i] = double_logpartition(ρ_mps)\n",
502530
" ρ = convert(FiniteMPO, ρ_mps)\n",
503531
"end\n",
504-
"F_mpo_mul_exp = -(1 ./ βs_exp) .* log.(Z_mpo_mul_exp)\n",
532+
"F_mpo_mul_exp = -(1 ./ βs_exp) .* Z_mpo_mul_exp\n",
505533
"\n",
506534
"p_mpo_mul_exp_diff = let\n",
507535
" labels = reshape(map(expansion_orders[2:end]) do N\n",
508536
" return \"Taylor N=$N\"\n",
509537
" end, 1, :)\n",
510-
" p1 = plot(βs, abs.(real.(Z_taylor2) .- partition_function.(βs, J, N));\n",
511-
" label=labels, title=\"Partition function error\",\n",
512-
" xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n",
513-
" plot!(p1, βs, abs.(real.(Z_mpo_mul) .- partition_function.(βs, J, N));\n",
514-
" label=\"MPO multiplication\")\n",
515-
" plot!(p1, βs_exp, abs.(real.(Z_mpo_mul_exp) .- partition_function.(βs_exp, J, N));\n",
516-
" label=\"MPO multiplication exp\")\n",
517-
"\n",
518-
" p2 = plot(βs, abs.(real.(F_taylor2) .- free_energy.(βs, J, N)); label=labels,\n",
519-
" xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n",
520-
" plot!(p2, βs, abs.(real.(F_mpo_mul) .- free_energy.(βs, J, N));\n",
521-
" label=\"MPO multiplication\")\n",
522-
" plot!(p2, βs_exp, abs.(real.(F_mpo_mul_exp) .- free_energy.(βs_exp, J, N));\n",
523-
" label=\"MPO multiplication exp\")\n",
538+
" p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic);\n",
539+
" label=labels, title=\"Partition function error\", xlabel=\"β\", ylabel=\"ΔZ(β)\",\n",
540+
" legend=:bottomright, yscale=:log10)\n",
541+
" plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label=\"MPO multiplication\")\n",
542+
" plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label=\"MPO multiplication exp\")\n",
543+
"\n",
544+
" p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, xlabel=\"β\", ylabel=\"ΔF(β)\",\n",
545+
" title=\"Free energy error\", legend=nothing, yscale=:log10)\n",
546+
" plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label=\"MPO multiplication\")\n",
547+
" plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label=\"MPO multiplication exp\")\n",
524548
" plot(p1, p2)\n",
525549
"end"
526550
],
@@ -567,37 +591,35 @@
567591
"\n",
568592
"# first iteration: start from infinite temperature state\n",
569593
"ρ₀ = infinite_temperature_density_matrix(H)\n",
570-
"Z_tdvp[1] = real(dot(ρ₀, ρ₀))^(1 / N)\n",
594+
"Z_tdvp[1] = double_logpartition(ρ₀)\n",
571595
"\n",
572596
"# subsequent iterations: evolve by H\n",
573597
"ρ_mps = convert(FiniteMPS, ρ₀)\n",
574598
"for i in 2:length(βs)\n",
575599
" global ρ_mps\n",
576600
" @info \"Computing β = $(βs[i])\"\n",
577601
" ρ_mps, = timestep(ρ_mps, H, βs[i - 1] / 2, -im * (βs[i] - βs[i - 1]) / 2,\n",
578-
" TDVP2(; trscheme=truncdim(D_max)))\n",
579-
" Z_tdvp[i] = real(dot(ρ_mps, ρ_mps))^(1 / N)\n",
602+
" TDVP2(; trscheme=truncdim(64)))\n",
603+
" Z_tdvp[i] = double_logpartition(ρ_mps)\n",
580604
"end\n",
581-
"F_tdvp = -(1 ./ βs) .* log.(Z_tdvp)\n",
605+
"F_tdvp = -(1 ./ βs) .* Z_tdvp\n",
582606
"\n",
583607
"p_mpo_mul_diff = let\n",
584-
" labels = reshape(map(expansion_orders[2:end]) do N\n",
608+
" labels = reshape(map(expansion_orders) do N\n",
585609
" return \"Taylor N=$N\"\n",
586610
" end, 1, :)\n",
587-
" p1 = plot(βs, abs.(real.(Z_taylor2) .- partition_function.(βs, J, N));\n",
588-
" label=labels, title=\"Partition function error\",\n",
589-
" xlabel=\"β\", ylabel=\"ΔZ(β)\", legend=:topleft)\n",
590-
" plot!(p1, βs, abs.(real.(Z_mpo_mul) .- partition_function.(βs, J, N));\n",
591-
" label=\"MPO multiplication\")\n",
592-
" plot!(p1, βs, abs.(real.(Z_tdvp) .- partition_function.(βs, J, N));\n",
593-
" label=\"TDVP\")\n",
594-
"\n",
595-
" p2 = plot(βs, abs.(real.(F_taylor2) .- free_energy.(βs, J, N)); label=labels,\n",
596-
" xlabel=\"β\", ylabel=\"ΔF(β)\", title=\"Free energy error\", legend=:topleft)\n",
597-
" plot!(p2, βs, abs.(real.(F_mpo_mul) .- free_energy.(βs, J, N));\n",
598-
" label=\"MPO multiplication\")\n",
599-
" plot!(p2, βs, abs.(real.(F_tdvp) .- free_energy.(βs, J, N));\n",
600-
" label=\"TDVP\")\n",
611+
" p1 = plot(βs, abs.(Z_taylor2 .- Z_analytic); label=labels,\n",
612+
" title=\"Partition function error\", xlabel=\"β\", ylabel=\"ΔZ(β)\",\n",
613+
" legend=:bottomright, yscale=:log10)\n",
614+
" plot!(p1, βs, abs.(Z_mpo_mul .- Z_analytic); label=\"MPO multiplication\")\n",
615+
" plot!(p1, βs_exp, abs.(Z_mpo_mul_exp .- Z_analytic_exp); label=\"MPO multiplication exp\")\n",
616+
" plot!(p1, βs, abs.(Z_tdvp .- Z_analytic); label=\"TDVP\")\n",
617+
"\n",
618+
" p2 = plot(βs, abs.(F_taylor2 .- F_analytic); label=labels, xlabel=\"β\", ylabel=\"ΔF(β)\",\n",
619+
" title=\"Free energy error\", legend=nothing, yscale=:log10)\n",
620+
" plot!(p2, βs, abs.(F_mpo_mul .- F_analytic); label=\"MPO multiplication\")\n",
621+
" plot!(p2, βs_exp, abs.(F_mpo_mul_exp .- F_analytic_exp); label=\"MPO multiplication exp\")\n",
622+
" plot!(p2, βs, abs.(F_tdvp .- F_analytic); label=\"TDVP\")\n",
601623
"\n",
602624
" plot(p1, p2)\n",
603625
"end"

examples/Cache.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[quantum1d]
55
"2.haldane" = "b1a0534b500ce6fc3f9471d0200ff9a61b6e4124d6fb397a9fa1d04e2b421286"
66
"6.hubbard" = "df13fc03d75e01f7e1c42cd12439ce28b84d7da226f4617a4eca2b4201b1931c"
7-
"7.xy-finiteT" = "475c0ff2a27bb52dad312173b2ce74ac023f73967c646b30a80b1d7dbd6f6402"
7+
"7.xy-finiteT" = "8b1aef2bdf28ca9061686ce0ad1edc8a5494c138d1ce327878733117d1ab3e56"
88
"3.ising-dqpt" = "e429be158328435143ae60c5eef41e12922f787550a7db2e3e6cfc58c4ec8cf8"
99
"5.haldane-spt" = "6a08d92a0f03287db3e6ee46702d8773ca532aa5920345b4a1624071ec9f6493"
1010
"1.ising-cft" = "8fbce5682149bfa69b694652439918eba2aa45b6f4da4cf7cee7a741d2d40f7e"

examples/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
BenchmarkFreeFermions = "5b68a00d-ca4d-4b58-ab0c-dc082ade624e"
23
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
34
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
45
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

0 commit comments

Comments
 (0)