-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started implementing spectral transport coefficients.
- Loading branch information
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
const qe = 1.602176634e-19 #C | ||
const hbar = 1.05457172647e-22 #J.ps | ||
const hbar_eVps = hbar/qe #ev.ps | ||
const kB = 1.380649e-23/qe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
include("statistics.jl") | ||
|
||
using ArgParse | ||
|
||
function calculate_spectral_coeffs(species, rundir, outdir, T, chempot) | ||
# TODO... | ||
|
||
#TODO Set temperature-dependent directory | ||
#Tdir = rundir*... | ||
|
||
#Read full-Brillouin zone energies and velocities. Reshape the latter appropriately. | ||
println("ϟ Reading full-Brillouin zone energies and velocities...") | ||
εs = readdlm(rundir*species*".ens_fbz") #eV | ||
vs = readdlm(rundir*species*".vels_fbz") #Km/s | ||
vs_shape = size(vs) | ||
vs = reshape(vs, (vs_shape[1], vs_shape[2]÷3, 3)) | ||
|
||
#Read reciprocal lattice vectors and their discretization grid | ||
println("ϟ Reading reciprocal lattice vector data...") | ||
reclattvecs_data = readdlm(rundir*species*".reclattvecs") #nm^-1 | ||
Bs = reclattvecs_data[1:3, :] | ||
wvmesh = convert.(Int32, reclattvecs_data[4, :]) | ||
|
||
#TODO Read response function | ||
# RTA | ||
println("ϟ Reading reciprocal lattice vector data...") | ||
response_fn = readdlm(Tdir*"RTA_F0_tot") #nm.eV/K | ||
# TODO Full | ||
#... | ||
|
||
#TODO (Can postpone this for later) | ||
# Talk to spglib to generate symmetry operations | ||
# to symmetrize the transport coefficients. | ||
# This might be an overkill since elphbolt already | ||
# symmetrizes the response functions and the velocities. | ||
end | ||
|
||
function parse_commandline() | ||
args = ArgParseSettings() | ||
@add_arg_table args begin | ||
"--rundir" | ||
help = "elphbolt run directory" | ||
arg_type = String | ||
default = "./" | ||
|
||
"--particle" | ||
help = "(ph)onon or (el)ectron spectral coefficients" | ||
arg_type = String | ||
default = "ph" | ||
|
||
"--chempot" | ||
help = "Chemical potential" | ||
arg_type = Float64 | ||
default = 0.0 | ||
|
||
"--T" | ||
help = "Temperature" | ||
arg_type = Float64 | ||
default = 0.0 | ||
end | ||
return parse_args(args) | ||
end | ||
|
||
function main() | ||
println("ϟ Welcome to the elphbolt post-processor tool spectral_trans_coeffs.jl") | ||
|
||
println("ϟ I'll be using $(Threads.nthreads()) threads.") | ||
|
||
#Parse command line arguments | ||
parsed_args = parse_commandline() | ||
|
||
#Set elphbolt run directory | ||
rundir = parsed_args["rundir"] | ||
|
||
#Set postproc output directory | ||
outdir = rundir*"postproc_results/" | ||
mkpath(outdir) | ||
|
||
#Set chemical potential | ||
chempot = parsed_args["chempot"] | ||
|
||
#Set chemical potential | ||
chempot = parsed_args["T"] | ||
|
||
#TODO... | ||
|
||
println("ϟ All done!") | ||
end | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include("parameters.jl") | ||
|
||
function Bose(ħω, T) | ||
#Returns the Bose-Einstein distribution for energy ħω | ||
#in eV and temperature T in K. | ||
|
||
return 1.0/expm1(ħω/kB/T) | ||
end | ||
|
||
function Fermi(ε, μ, T) | ||
#Returns the Fermi-Dirac distribution for energy ε | ||
#in eV, chemical potential μ in eV, and temperature | ||
#T in K. | ||
|
||
return 1.0_r64/(exp((ε - μ)/kB/T) + 1.0) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
! Copyright 2020 elphbolt contributors. | ||
! This file is part of elphbolt <https://github.com/nakib/elphbolt>. | ||
! | ||
|