Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor input.jl and plot scripts #5

Merged
merged 37 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
dcddf46
Merge 3D parafile data to `para_wn_1minus0.csv`
dcerkoney Sep 18, 2023
699ea04
Support jagged data in plotscript, add rs=1 data
dcerkoney Sep 20, 2023
0622cb8
Merge branch 'master' into daniel
dcerkoney Sep 24, 2023
409fe9d
Update plot script, plot rs=1-5 meff curves
dcerkoney Sep 25, 2023
5365420
Update plot scripts
dcerkoney Sep 29, 2023
53e2dc1
Update scripts, add spin-polarized para
dcerkoney Oct 8, 2023
e5683ab
Merge branch 'master' into daniel
dcerkoney Oct 8, 2023
190078e
Update input
dcerkoney Oct 8, 2023
772f64b
Add relative path support to `input.jl`
dcerkoney Oct 8, 2023
7ed3df6
Update input
dcerkoney Oct 9, 2023
9a06294
Update gitignore
dcerkoney Oct 9, 2023
06a2871
Update input
dcerkoney Oct 10, 2023
716c334
Add rs=0.5 scan
dcerkoney Oct 10, 2023
f78edb0
Update rs=0.5 scan
dcerkoney Oct 11, 2023
bca3d32
Update results
dcerkoney Oct 12, 2023
4e41da6
Update results
dcerkoney Oct 12, 2023
78ac427
Merge branch 'daniel' of github.com:houpc/UniElectronGas.jl into daniel
dcerkoney Oct 26, 2023
7383d78
Update input
dcerkoney Nov 1, 2023
ca08458
Refactor input.jl and plot scripts.
dcerkoney Nov 16, 2023
3aebb18
Switch from 1/N to N for convergence plots
dcerkoney Nov 16, 2023
bb89718
Refactor plot script
dcerkoney Nov 17, 2023
aa5736e
Update input
dcerkoney Nov 21, 2023
eda5e15
Prepare input for improved K mission runs
dcerkoney Nov 22, 2023
f340e65
Update input and meff plot script, add derive_everything.sh, and supp…
dcerkoney Dec 1, 2023
7b604dc
Merge branch 'daniel' of github.com:houpc/UniElectronGas.jl into daniel
dcerkoney Dec 1, 2023
6578a2f
Bugfix in input.jl
dcerkoney Dec 1, 2023
d0746eb
Update Fig.1 plot script
dcerkoney Dec 8, 2023
e978c7f
Update postprocessing and plotting scripts for finalized data
dcerkoney Feb 26, 2024
c4f06d0
Cleanup GW scripts
dcerkoney Feb 26, 2024
f6cb077
Cleanup GW scripts
dcerkoney Feb 26, 2024
027689d
Merge branch 'daniel' of github.com:houpc/UniElectronGas.jl into daniel
dcerkoney Feb 26, 2024
6c2fe42
Prep script for KO runs
dcerkoney Feb 27, 2024
b217b73
Prep script for KO runs
dcerkoney Feb 27, 2024
d6edaaa
Merge branch 'daniel' of github.com:houpc/UniElectronGas.jl into daniel
dcerkoney Feb 27, 2024
f0893c4
Bugfix for KO
dcerkoney Feb 27, 2024
9c007c3
Bugfix for KO
dcerkoney Feb 27, 2024
5d8986d
Merge branch 'daniel' of github.com:houpc/UniElectronGas.jl into daniel
dcerkoney Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ deps/src/
*.aux
*.DS_Store
*.xdv
*.xcf
*.dat
*.err
*.out
Expand Down
4 changes: 2 additions & 2 deletions example/freeE/plot_freeE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Fs = [-0.0,]
# beta = [25.0]
beta = [80.0]
order = [5,]
const fileName = "freeE_$(dim)d.dat"
const filename = "freeE_$(dim)d.dat"
const val_benchmark =
cdict = Dict(["blue" => "#0077BB", "cyan" => "#33BBEE", "teal" => "#009988", "orange" => "#EE7733", "red" => "#CC3311", "magenta" => "#EE3377", "grey" => "#BBBBBB"]);

Expand Down Expand Up @@ -53,7 +53,7 @@ end

if abspath(PROGRAM_FILE) == @__FILE__

freeE_data = readdlm(fileName)
freeE_data = readdlm(filename)
num_data = size(freeE_data)[1]

freeE_total, error_total, mass2_total = [], [], []
Expand Down
98 changes: 82 additions & 16 deletions example/input.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,90 @@
dim = 2. # dimension of the problem
rs = [2.0,]
# mass2 = [1.0, 2.0, 3.0]
mass2 = [0.1,] # screening parameter
Fs = [-0.0,] # Fermi liquid parameter with zero angular momentum
beta = [25.0] # inverse temperature beta = β*E_F
order = [3,] # order of diagrams
neval = 1e6 # number of Monte Carlo samples
# neval = 1e8
dim = 3 # dimension of the problem

### rs = 0.5 ###
# rs = [0.5]
# mass2 = [3.5] # screening parameter

### rs = 1 ###
rs = [1.0]
mass2 = [1.75] # screening parameter

### rs = 2 ###
# rs = [2.0]
# mass2 = [2.0] # screening parameter

### rs = 3 ###
# rs = [3.0]
# mass2 = [1.5] # screening parameter

### rs = 4 ###
# rs = [4.0]
# mass2 = [1.125] # screening parameter

### rs = 5 ###
# rs = [5.0]
# mass2 = [1.125] # screening parameter

### rs = 6 ###
# rs = [6.0]
# mass2 = [0.75] # screening parameter

Fs = [-0.0] # Fermi liquid parameter with zero angular momentum
beta = [40.0] # inverse temperature beta = β*E_F
order = [5] # order of diagrams
neval = 1e11 # number of Monte Carlo samples
isDynamic = false # whether to use effective field theory with dynamic screening or not
isFock = false # whether to use Fock renormalization or not

diagGenerate = :GV # :GV or :Parquet, algorithm to generate diagrams
# diagGenerate = :Parquet
isLayered2D = true # whether to use layered 2D system or not
isLayered2D = false # whether to use layered 2D system or not

spin = 2 # 2 for unpolarized, 1 for polarized
spinPolarPara = 2 / spin - 1 # spin-polarization parameter (n_up - n_down) / (n_up + n_down) ∈ [0,1]
ispolarized = spinPolarPara != 0.0

# Build file base names
basenames = [
"para_wn_1minus0",
"data$(dim)d_Z",
"data$(dim)d_K",
"meff_$(dim)d",
"zfactor_$(dim)d",
"inverse_zfactor_$(dim)d",
"dispersion_ratio_$(dim)d",
"inverse_dispersion_ratio_$(dim)d",
]
for i in eachindex(basenames)
if spin != 2
basenames[i] *= "_spin$(spin)"
end
if ispolarized
basenames[i] *= "_polarized"
end
if isLayered2D
@assert dim == 2 "Layered 2D mode is only available for dim = 2!"
basenames[i] *= "_layered2d"
end
end
para_basename,
sigma_z_basename,
sigma_k_basename,
meff_basename,
zfactor_basename,
inverse_zfactor_basename,
dispersion_ratio_basename,
inverse_dispersion_ratio_basename = basenames

# Directory paths
data_directory = joinpath(@__DIR__, "sigma/data$(dim)d")
res_directory = joinpath(@__DIR__, "sigma")
para_directory = "" # src directory

if isLayered2D
const parafilename = "para_wn_1minus0_layered2d.csv"
else
const parafilename = "para_wn_1minus0.csv"
end
# File paths
const parafilename = joinpath(para_directory, para_basename * ".csv")
const simga_z_filename = joinpath(data_directory, sigma_z_basename * ".jld2")
const sigma_k_filename = joinpath(data_directory, sigma_k_basename * ".jld2")
const meff_filename = joinpath(res_directory, meff_basename * ".dat")
const zfactor_filename = joinpath(res_directory, zfactor_basename * ".dat")
const zinv_filename = joinpath(res_directory, inverse_zfactor_basename * ".dat")
const dispersion_ratio_filename = joinpath(res_directory, dispersion_ratio_basename * ".dat")
const inverse_dispersion_ratio_filename = joinpath(res_directory, inverse_dispersion_ratio_basename * ".dat")
36 changes: 36 additions & 0 deletions example/sigma/derive_dispersion_ratio.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UniElectronGas, ElectronLiquid
using JLD2, DelimitedFiles

include("../input.jl")

if abspath(PROGRAM_FILE) == @__FILE__
isSave = false
if length(ARGS) >= 1 && (ARGS[1] == "s" || ARGS[1] == "-s" || ARGS[1] == "--save" || ARGS[1] == " save")
# the second parameter may be set to save the derived parameters
isSave = true
end

f = jldopen(sigma_k_filename, "r")
results = Any[]
for (_rs, _mass2, _F, _beta, _order) in Iterators.product(rs, mass2, Fs, beta, order)
para = ParaMC(rs=_rs, beta=_beta, Fs=_F, order=_order, mass2=_mass2, isDynamic=isDynamic, dim=dim, spin=spin)
kF = para.kF
for key in keys(f)
loadpara = ParaMC(key)
if UEG.paraid(loadpara) == UEG.paraid(para)
println(UEG.paraid(para))

ngrid, kgrid, rSw_k, iSw_k = UniElectronGas.getSigma(para, sigma_k_filename; parafile=parafilename)
dispersion_ratio, fit_p = UniElectronGas.getDispersionRatio(para, rSw_k, kgrid; parafile=parafilename)
println("ϵ_qp / ϵ_0 = ", dispersion_ratio)
push!(results, Any[_rs, _beta, _mass2, _order, dispersion_ratio...])
writedlm("fit_dispersion.dat", fit_p)
end
end
end
if isSave
open(dispersion_ratio_filename, "a+") do io
writedlm(io, results)
end
end
end
36 changes: 36 additions & 0 deletions example/sigma/derive_inverse_dispersion_ratio.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UniElectronGas, ElectronLiquid
using JLD2, DelimitedFiles

include("../input.jl")

if abspath(PROGRAM_FILE) == @__FILE__
isSave = false
if length(ARGS) >= 1 && (ARGS[1] == "s" || ARGS[1] == "-s" || ARGS[1] == "--save" || ARGS[1] == " save")
# the second parameter may be set to save the derived parameters
isSave = true
end

f = jldopen(sigma_k_filename, "r")
results = Any[]
for (_rs, _mass2, _F, _beta, _order) in Iterators.product(rs, mass2, Fs, beta, order)
para = ParaMC(rs=_rs, beta=_beta, Fs=_F, order=_order, mass2=_mass2, isDynamic=isDynamic, dim=dim, spin=spin)
kF = para.kF
for key in keys(f)
loadpara = ParaMC(key)
if UEG.paraid(loadpara) == UEG.paraid(para)
println(UEG.paraid(para))

ngrid, kgrid, rSw_k, iSw_k = UniElectronGas.getSigma(para, sigma_k_filename; parafile=parafilename)
dispersion_ratio, fit_p = UniElectronGas.getDispersionRatioInv(para, rSw_k, kgrid; parafile=parafilename)
println("ϵ_qp / ϵ_0 = ", dispersion_ratio)
push!(results, Any[_rs, _beta, _mass2, _order, dispersion_ratio...])
writedlm("fit_inverse_dispersion.dat", fit_p)
end
end
end
if isSave
open(inverse_dispersion_ratio_filename, "a+") do io
writedlm(io, results)
end
end
end
33 changes: 5 additions & 28 deletions example/sigma/derive_meff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,14 @@ using JLD2, DelimitedFiles

include("../input.jl")

# # dim = 3
# dim = 2
# spin = 1
# # spin = 2
# # rs = [0.5, 1.0, 2.0]
# rs = [1.0]
# # rs = [0.1, 0.3]
# # mass2 = [0.5, 1.0, 1.5, 2.0, 2.2, 2.4, 2.5, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0]
# # mass2 = [0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5]
# mass2 = [1.75]
# Fs = [-0.0,]
# # beta = [25.0,]
# beta = [40.0,]
# order = [4,]
# # order = [5,]
# isDynamic = false
### dSigma/dk = (Sigma[kF_label+idx_dk] - Sigma[kF_label-idx_dk]) / (kgrid[kF_label+idx_dk] - kgrid[kF_label-idx_dk])

# const parafilename = "para_wn_1minus0.csv"
const filename = "./data$(dim)d/data$(dim)d_K.jld2"
# const filename = "./data$(dim)d/data$(dim)d_K_o5.jld2"
const savefilename = spin == 2 ? "meff_$(dim)d.dat" : "meff_$(dim)d_spin$spin.dat"

if abspath(PROGRAM_FILE) == @__FILE__
isSave = false
if length(ARGS) >= 1 && (ARGS[1] == "s" || ARGS[1] == "-s" || ARGS[1] == "--save" || ARGS[1] == " save")
# the second parameter may be set to save the derived parameters
isSave = true
end

f = jldopen(filename, "r")
f = jldopen(sigma_k_filename, "r")
results = Any[]
for (_rs, _mass2, _F, _beta, _order) in Iterators.product(rs, mass2, Fs, beta, order)
para = ParaMC(rs=_rs, beta=_beta, Fs=_F, order=_order, mass2=_mass2, isDynamic=isDynamic, dim=dim, spin=spin)
Expand All @@ -43,8 +20,8 @@ if abspath(PROGRAM_FILE) == @__FILE__
if UEG.paraid(loadpara) == UEG.paraid(para)
println(UEG.paraid(para))

ngrid, kgrid, rSw_k, iSw_k = UniElectronGas.getSigma(para, filename)
meff, fit_p = UniElectronGas.getMeff(para, rSw_k, kgrid)
ngrid, kgrid, rSw_k, iSw_k = UniElectronGas.getSigma(para, sigma_k_filename; parafile=parafilename)
meff, fit_p = UniElectronGas.getMeff(para, rSw_k, kgrid; parafile=parafilename)
# meff = UniElectronGas.getMeff(para, rSw_k, kgrid)
println("m* / m = ", meff)
push!(results, Any[_rs, _beta, _mass2, _order, meff...])
Expand All @@ -53,8 +30,8 @@ if abspath(PROGRAM_FILE) == @__FILE__
end
end
if isSave
open(savefilename, "a+") do io
open(meff_filename, "a+") do io
writedlm(io, results)
end
end
end
end
35 changes: 35 additions & 0 deletions example/sigma/derive_zinv.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using UniElectronGas, ElectronLiquid
using JLD2, DelimitedFiles

include("../input.jl")

if abspath(PROGRAM_FILE) == @__FILE__
isSave = false
if length(ARGS) >= 1 && (ARGS[1] == "s" || ARGS[1] == "-s" || ARGS[1] == "--save" || ARGS[1] == " save")
# the second parameter may be set to save the derived parameters
isSave = true
end

f = jldopen(sigma_k_filename, "r")
results = Any[]
for (_rs, _mass2, _F, _beta, _order) in Iterators.product(rs, mass2, Fs, beta, order)
para = ParaMC(rs=_rs, beta=_beta, Fs=_F, order=_order, mass2=_mass2, isDynamic=isDynamic, dim=dim, spin=spin)
kF = para.kF
for key in keys(f)
loadpara = ParaMC(key)
if UEG.paraid(loadpara) == UEG.paraid(para)
println(UEG.paraid(para))

ngrid, kgrid, rSw_k, iSw_k = UniElectronGas.getSigma(para, sigma_k_filename; parafile=parafilename)
zinv = UniElectronGas.getZinv(para; parafile=parafilename)
println("1/z = ", zinv)
push!(results, Any[_rs, _beta, _mass2, _order, zinv...])
end
end
end
if isSave
open(zinv_filename, "a+") do io
writedlm(io, results)
end
end
end
18 changes: 4 additions & 14 deletions example/sigma/derive_zmu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ using JLD2, DelimitedFiles

include("../input.jl")

if isLayered2D
const filename = "./data$(dim)d/data_Z_layered2d.jld2"
else
const filename = "./data$(dim)d/data_Z.jld2"
end
# const filename = "./data2d_Z_v0.jld2"
# const filename = "./data$(dim)d/data$(dim)d_Z_beta80_rs$(rs[1]).jld2"
const savefilename = spin == 2 ? "zfactor_$(dim)d.dat" : "zfactor_$(dim)d_spin$spin.dat"


function zfactor_renorm(dz, dzinv; isRenorm=true)
if isRenorm
sumzinv = accumulate(+, dzinv)
Expand All @@ -38,8 +28,8 @@ if abspath(PROGRAM_FILE) == @__FILE__
isSave = true
end

f = jldopen(filename, "r")
println(filename)
f = jldopen(sigma_z_filename, "r")
println(sigma_z_filename)
results = Any[]
for (_rs, _mass2, _F, _beta, _order) in Iterators.product(rs, mass2, Fs, beta, order)
para = ParaMC(rs=_rs, beta=_beta, Fs=_F, order=_order, mass2=_mass2, isDynamic=isDynamic, dim=dim, spin=spin)
Expand All @@ -54,8 +44,8 @@ if abspath(PROGRAM_FILE) == @__FILE__
end
end
if isSave
open(savefilename, "a+") do io
open(zfactor_filename, "a+") do io
writedlm(io, results)
end
end
end
end
Loading
Loading