Skip to content

Commit

Permalink
Started implementing spectral transport coefficients.
Browse files Browse the repository at this point in the history
  • Loading branch information
nakib committed Dec 3, 2023
1 parent 8f9ed5b commit 3b70b67
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions postproc/parameters.jl
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
90 changes: 90 additions & 0 deletions postproc/spectral_trans_coeffs.jl
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()
16 changes: 16 additions & 0 deletions postproc/statistics.jl
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
1 change: 1 addition & 0 deletions src/misc.f90
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>.
!
Expand Down

0 comments on commit 3b70b67

Please sign in to comment.