Skip to content

Commit 3dc0f69

Browse files
authored
Merge pull request #19 from numericalEFT/dev
Dev
2 parents 8bc3703 + d0a2c8f commit 3dc0f69

File tree

7 files changed

+138
-305
lines changed

7 files changed

+138
-305
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.jl.*.cov
22
*.jl.cov
33
*.jl.mem
4+
Manifest.toml
45
/docs/build/

Manifest.toml

Lines changed: 0 additions & 217 deletions
This file was deleted.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Lehmann"
22
uuid = "95bf888a-8996-4655-9f35-1c0506bdfefe"
33
authors = ["Kun Chen", "Tao Wang", "Xiansheng Cai"]
4-
version = "0.2.1"
4+
version = "0.2.2"
55

66
[deps]
77
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"

build.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ using Lehmann
33
using Printf
44

55
# rtol = [-6, -8, -10, -12, -14]
6-
rtol = [-7, -9, -11, -13]
7-
Λ = [100, 1000, 10000, 100000, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14]
6+
# rtol = [-7, -9, -11, -13]
7+
# Λ = [100, 1000, 10000, 100000, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14]
88
# Λ = [1e11, 1e12, 1e13, 1e14]
9-
# rtol = [-12]
10-
# Λ = [1000000,]
9+
rtol = [-12]
10+
Λ = [1000000,]
1111
algorithm = :functional
12-
folder = "./basis/"
12+
# folder = "./basis/"
13+
folder = "./"
1314

1415
for lambda in Λ
1516
for err in rtol

example/SYK.jl

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A SYK model solver based on a forward fixed-point iteration method.
1717
1818
The SYK Green's function has particle-hole symmetry when μ=0.
1919
You may enforce such symmetry by setting `symmetry = :ph` when initialize the DLR grids.
20-
A symmetrized solver tends to be more robust than the unsymmetrized counterpart.
20+
A symmetrized solver tends to be more robust than a unsymmetrized one.
2121
"""
2222

2323
using Lehmann
@@ -50,7 +50,7 @@ function dyson(d, sigma_q, mu)
5050
end
5151
end
5252

53-
function solve_syk_with_fixpoint_iter(d, mu, tol = d.rtol * 10; mix = 0.1, maxiter = 1000, G_x = zeros(ComplexF64, length(d)))
53+
function solve_syk_with_fixpoint_iter(d, mu, tol = d.rtol * 10; mix = 0.1, maxiter = 5000, G_x = zeros(ComplexF64, length(d)), verbose = true)
5454

5555
for iter in 1:maxiter
5656

@@ -61,8 +61,10 @@ function solve_syk_with_fixpoint_iter(d, mu, tol = d.rtol * 10; mix = 0.1, maxit
6161
G_x_new = matfreq2tau(d, G_q_new)
6262

6363

64-
if iter % (maxiter / 10) == 0
65-
println("round $iter: change $(diff(G_x_new, G_x))")
64+
if verbose
65+
if iter % (maxiter / 10) == 0
66+
println("round $iter: change $(diff(G_x_new, G_x))")
67+
end
6668
end
6769
if maximum(abs.(G_x_new .- G_x)) < tol && iter > 10
6870
break
@@ -83,26 +85,51 @@ function printG(d, G_x)
8385
println()
8486
end
8587

86-
printstyled("===== Symmetrized DLR solver for SYK model =======\n", color = :yellow)
87-
mix = 0.1
88-
dsym = DLRGrid(Euv = 5.0, β = 1000.0, isFermi = true, rtol = 1e-8, symmetry = :ph) # Initialize DLR object
89-
G_x_ph = solve_syk_with_fixpoint_iter(dsym, 0.00, mix = mix)
90-
printG(dsym, G_x_ph)
91-
92-
printstyled("===== Unsymmetrized DLR solver for SYK model =======\n", color = :yellow)
93-
mix = 0.02
94-
dnone = DLRGrid(Euv = 5.0, β = 1000.0, isFermi = true, rtol = 1e-8, symmetry = :none) # Initialize DLR object
95-
G_x_none = solve_syk_with_fixpoint_iter(dnone, 0.00, mix = mix)
96-
printG(dnone, G_x_none)
97-
98-
printstyled("===== Unsymmetrized versus Symmetrized DLR solver =======\n", color = :yellow)
99-
@printf("%15s%40s%40s%40s\n", "τ", "sym DLR (interpolated)", "unsym DLR", "difference")
100-
G_x_interp = tau2tau(dsym, G_x_ph, dnone.τ)
101-
for i in 1:dnone.size
102-
if dnone.τ[i] <= dnone.β / 2
103-
@printf("%15.8f%40.15f%40.15f%40.15f\n", dnone.τ[i], real(G_x_interp[i]), real(G_x_none[i]), abs(real(G_x_interp[i] - G_x_none[i])))
104-
end
88+
verbose = false
89+
90+
printstyled("===== Prepare the expected Green's function of the SYK model =======\n", color = :yellow)
91+
dsym_correct = DLRGrid(Euv = 5.0, β = 10000.0, isFermi = true, rtol = 1e-14, symmetry = :ph) # Initialize DLR object
92+
G_x_correct = solve_syk_with_fixpoint_iter(dsym_correct, 0.00, mix = 0.1, verbose = false)
93+
printG(dsym_correct, G_x_correct)
94+
95+
printstyled("===== Test Symmetrized and Unsymmetrized DLR solver for SYK model =======\n", color = :yellow)
96+
97+
@printf("%30s%30s%30s%15s\n", "Euv", "symmetrized solver error", "unsymmetrized solver error", "good or bad")
98+
for Euv in LinRange(5.0, 10.0, 50)
99+
100+
rtol = 1e-10
101+
β = 10000.0
102+
# printstyled("===== Symmetrized DLR solver for SYK model =======\n", color = :yellow)
103+
mix = 0.01
104+
dsym = DLRGrid(Euv = Euv, β = β, isFermi = true, rtol = rtol, symmetry = :ph, rebuild = true, verbose = false) # Initialize DLR object
105+
G_x_ph = solve_syk_with_fixpoint_iter(dsym, 0.00, mix = mix, verbose = verbose)
106+
# printG(dsym, G_x_ph)
107+
108+
# printstyled("===== Unsymmetrized DLR solver for SYK model =======\n", color = :yellow)
109+
mix = 0.01
110+
dnone = DLRGrid(Euv = Euv, β = β, isFermi = true, rtol = rtol, symmetry = :none, rebuild = true, verbose = false) # Initialize DLR object
111+
G_x_none = solve_syk_with_fixpoint_iter(dnone, 0.00, mix = mix, verbose = verbose)
112+
# printG(dnone, G_x_none)
113+
114+
# printstyled("===== Unsymmetrized versus Symmetrized DLR solver =======\n", color = :yellow)
115+
# @printf("%15s%40s%40s%40s\n", "τ", "sym DLR (interpolated)", "unsym DLR", "difference")
116+
# G_x_interp = tau2tau(dsym_correct, G_x_correct, dnone.τ)
117+
# for i in 1:dnone.size
118+
# if dnone.τ[i] <= dnone.β / 2
119+
# @printf("%15.8f%40.15f%40.15f%40.15f\n", dnone.τ[i], real(G_x_interp[i]), real(G_x_none[i]), abs(real(G_x_interp[i] - G_x_none[i])))
120+
# end
121+
# end
122+
123+
G_x_interp_ph = tau2tau(dsym_correct, G_x_correct, dsym.τ)
124+
G_x_interp_none = tau2tau(dsym_correct, G_x_correct, dnone.τ)
125+
d_ph = diff(G_x_interp_ph, G_x_ph)
126+
d_none = diff(G_x_interp_none, G_x_none)
127+
flag = (d_ph < 100rtol) && (d_none < 100rtol) ? "good" : "bad"
128+
129+
@printf("%30.15f%30.15e%30.15e%20s\n", Euv, d_ph, d_none, flag)
130+
# println("symmetric Euv = $Euv maximumal difference: ", diff(G_x_interp, G_x_ph))
131+
# println("non symmetric Euv = $Euv maximumal difference: ", diff(G_x_interp, G_x_none))
132+
105133
end
106-
println("maximumal difference: ", diff(G_x_interp, G_x_none))
107134

108135

0 commit comments

Comments
 (0)