Skip to content

Commit

Permalink
Merge pull request #28 from numericalEFT/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kunyuan authored Oct 9, 2022
2 parents 3ba44c5 + f1d1ea2 commit 77bcc68
Show file tree
Hide file tree
Showing 8 changed files with 668 additions and 294 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Manifest.toml
*.DS_Store
*.pb.gz
*.pdf
.history
87 changes: 84 additions & 3 deletions src/Lehmann.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,97 @@ include("utility/chebyshev.jl")
include("spectral.jl")
export Spectral

include("sample/sample.jl")
export Sample

include("discrete/builder.jl")
include("functional/builder.jl")

include("dlr.jl")
export DLRGrid

include("sample/sample.jl")
export Sample

include("operation.jl")
export tau2dlr, dlr2tau, matfreq2dlr, dlr2matfreq, tau2matfreq, matfreq2tau, tau2tau, matfreq2matfreq

##################### precompile #######################
# precompile as the final step of the module definition:
if ccall(:jl_generating_output, Cint, ()) == 1 # if we're precompiling the package
let
#cover data type and symmetry
# Float32, :none
dlr = DLRGrid(1.0, 1.0, 1e-6, true, :none; dtype=Float32)
g = Sample.SemiCircle(dlr, , dlr.τ)
coeff = tau2dlr(dlr, g)
_g = dlr2tau(dlr, coeff)
_g = tau2tau(dlr, g, dlr.τ)

g = Sample.SemiCircle(dlr, :n, dlr.n)
coeff = matfreq2dlr(dlr, g)
_g = dlr2matfreq(dlr, coeff)
_g = matfreq2matfreq(dlr, g, dlr.n)


# Float32, :pha
dlr = DLRGrid(1.0, 1.0, 1e-6, true, :pha; dtype=Float32)
g = Sample.SemiCircle(dlr, , dlr.τ)
coeff = tau2dlr(dlr, g)
_g = dlr2tau(dlr, coeff)
_g = tau2tau(dlr, g, dlr.τ)

g = Sample.SemiCircle(dlr, :n, dlr.n)
coeff = matfreq2dlr(dlr, g)
_g = dlr2matfreq(dlr, coeff)
_g = matfreq2matfreq(dlr, g, dlr.n)

# Float32, :ph
dlr = DLRGrid(1.0, 1.0, 1e-6, true, :ph; dtype=Float32)
g = Sample.SemiCircle(dlr, , dlr.τ)
coeff = tau2dlr(dlr, g)
_g = dlr2tau(dlr, coeff)
_g = tau2tau(dlr, g, dlr.τ)

g = Sample.SemiCircle(dlr, :n, dlr.n)
coeff = matfreq2dlr(dlr, g)
_g = dlr2matfreq(dlr, coeff)
_g = matfreq2matfreq(dlr, g, dlr.n)

# Float64, :none
dlr = DLRGrid(1.0, 1.0, 1e-6, true, :none; dtype=Float64)
g = Sample.SemiCircle(dlr, , dlr.τ)
coeff = tau2dlr(dlr, g)
_g = dlr2tau(dlr, coeff)
_g = tau2tau(dlr, g, dlr.τ)

g = Sample.SemiCircle(dlr, :n, dlr.n)
coeff = matfreq2dlr(dlr, g)
_g = dlr2matfreq(dlr, coeff)
_g = matfreq2matfreq(dlr, g, dlr.n)

# Float64, :pha
dlr = DLRGrid(1.0, 1.0, 1e-6, true, :pha; dtype=Float64)
g = Sample.SemiCircle(dlr, , dlr.τ)
coeff = tau2dlr(dlr, g)
_g = dlr2tau(dlr, coeff)
_g = tau2tau(dlr, g, dlr.τ)

g = Sample.SemiCircle(dlr, :n, dlr.n)
coeff = matfreq2dlr(dlr, g)
_g = dlr2matfreq(dlr, coeff)
_g = matfreq2matfreq(dlr, g, dlr.n)

# Float64, :ph
dlr = DLRGrid(1.0, 1.0, 1e-6, true, :ph; dtype=Float64)
g = Sample.SemiCircle(dlr, , dlr.τ)
coeff = tau2dlr(dlr, g)
_g = dlr2tau(dlr, coeff)
_g = tau2tau(dlr, g, dlr.τ)

g = Sample.SemiCircle(dlr, :n, dlr.n)
coeff = matfreq2dlr(dlr, g)
_g = dlr2matfreq(dlr, coeff)
_g = matfreq2matfreq(dlr, g, dlr.n)

end
end

end
10 changes: 5 additions & 5 deletions src/discrete/kernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ function preciseKernelT(dlrGrid, τ, ω, print::Bool = true)
#symmetrize K(τ, ω)=K(β-τ, -ω) for τ>0
@assert isodd.np) #symmetrization is only possible for odd τ panels
halfτ = ((τ.np - 1) ÷ 2) * τ.degree
kernel[1:halfτ, :] = Spectral.kernelT(Val(true), Val(symmetry), τ.grid[1:halfτ], ω.grid, 1.0, true)
kernel[end:-1:(halfτ+1), :] = Spectral.kernelT(Val(true), Val(symmetry), τ.grid[1:halfτ], ω.grid[end:-1:1], 1.0, true)
kernel[1:halfτ, :] = Spectral.kernelT(Float64, Val(true), Val(symmetry), τ.grid[1:halfτ], ω.grid, 1.0, true)
kernel[end:-1:(halfτ+1), :] = Spectral.kernelT(Float64, Val(true), Val(symmetry), τ.grid[1:halfτ], ω.grid[end:-1:1], 1.0, true)
# use the fermionic kernel for both the fermionic and bosonic propagators
else
kernel = Spectral.kernelT(Val(dlrGrid.isFermi), Val(symmetry), τGrid, ωGrid, 1.0, true)
kernel = Spectral.kernelT(Float64, Val(dlrGrid.isFermi), Val(symmetry), τGrid, ωGrid, 1.0, true)
end

# print && println("===== Kernel Discretization =====")
Expand Down Expand Up @@ -191,8 +191,8 @@ function preciseKernelΩn(dlrGrid, ω, print::Bool = true)
symmetry = dlrGrid.symmetry
n = nGrid(dlrGrid.isFermi, symmetry, dlrGrid.Λ)

nkernelFermi = Spectral.kernelΩ(Val(true), Val(symmetry), n, Float64.(ωGrid), 1.0, true)
nkernelBose = Spectral.kernelΩ(Val(false), Val(symmetry), n, Float64.(ωGrid), 1.0, true)
nkernelFermi = Spectral.kernelΩ(Float64, Val(true), Val(symmetry), n, Float64.(ωGrid), 1.0, true)
nkernelBose = Spectral.kernelΩ(Float64, Val(false), Val(symmetry), n, Float64.(ωGrid), 1.0, true)

return n, nkernelFermi, nkernelBose
end
Loading

0 comments on commit 77bcc68

Please sign in to comment.