Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
YidaiZhang committed May 27, 2024
1 parent 2169fdf commit ab81d67
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

Huanhai and I try to reproduce the results of the paper [Liao, H., Liu, J., Wang, L., Xiang, T., 2019. Differentiable Programming Tensor Networks. Physical Review X 9, 31041] in Julia.

![](./examples/energy_density.png)
![](./examples/specific_heat.png)
![](./examples/energy_density_to.png)
![](./examples/specific_heat_to.png)

Binary file removed examples/energy_density.png
Binary file not shown.
Binary file added examples/energy_density_to.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 17 additions & 9 deletions examples/ising_trg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ using ad.Plots
Dcut = 30
n = 30

ts = 2.5:-0.01:2;
ts = 2.52:-0.01:1.98;
β = inv.(ts);
@show "=====TRG======"

lnZ = []
for K in β
t = 1.0/K
Expand All @@ -23,18 +23,26 @@ F = - ts.* lnZ
dF = - diff(lnZ)./diff(β)

# plotting
plot(β[1:end-1], dF, label="energy density", xlabel="β", ylabel="energy density", title="reproduce", seriestype=:line)
scatter!(β[1:end-1], dF, label="-∂lnZ/∂β")
# Find the indices where β is between 0.40 and 0.50
indices = findall(x -> 0.40 <= x <= 0.50, β[1:end-1])

# Plot only the selected range
plot(β[indices], dF[indices], label="energy density", xlabel="β", ylabel="energy density", title="reproduce", seriestype=:line)
scatter!(β[indices], dF[indices], label="-∂lnZ/∂β")


# save figure
savefig("energy_density.png")
savefig("energy_density_to.png")

# taking the second derivative
# taking the second derivative with β^2
dS = - β[1:end-2].^2 .* diff(dF)./diff(β[1:end-1])
# Find the indices where β is between 0.40 and 0.50
indices = findall(x -> 0.40 <= x <= 0.50, β[1:end-2])

# Plot only the selected range
plot(β[indices], dS[indices], label="specific heat", xlabel="β", ylabel="specific heat", title="reproduce", seriestype=:line)
scatter!(β[indices], dS[indices], label="β^2(∂^2lnZ/∂β^2)")

plot(β[1:end-2], dS, label="specific heat", xlabel="β", ylabel="specific heat", title="reproduce", seriestype=:line)
scatter!(β[1:end-2], dS, label="β^2(∂^2lnZ/∂β^2)")

# save figure
savefig("specific_heat.png")
savefig("specific_heat_to.png")
Binary file removed examples/specific_heat.png
Binary file not shown.
Binary file added examples/specific_heat_to.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ab81d67

Please sign in to comment.