From 8c1a3c2d6f03e673d9cb0bb7c54ed6fd255a0547 Mon Sep 17 00:00:00 2001 From: Chong Wang Date: Tue, 15 Nov 2022 15:39:03 -0800 Subject: [PATCH 1/5] add cpge --- src/optics.jl | 89 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/src/optics.jl b/src/optics.jl index 9ff6640..baf72b1 100644 --- a/src/optics.jl +++ b/src/optics.jl @@ -286,7 +286,6 @@ The returned matrix berryconnection is `berryconnection[n, m, ikpt] = |A[n, m]|^2` at `ikpt`. """ function cltberryconnection(atm::AbstractTBModel, α::Int64, kpts::AbstractMatrix{Float64}) - nkpts = size(kpts, 2) jobs = Vector{Future}() berryconnection = zeros((atm.norbits, atm.norbits, 0)) kptslist = HopTB.Utilities.splitkpts(kpts, nworkers()) @@ -340,7 +339,6 @@ R^{α,β}_{nm} = ∂_αϕ_{mn}^β-A_{mm}^α+A_{nn}^α. ``` """ function cltshiftvector(atm::AbstractTBModel, α::Int64, β::Int64, kpts::AbstractMatrix{Float64}) - nkpts = size(kpts, 2) jobs = Vector{Future}() shiftvector = zeros((atm.norbits, atm.norbits, 0)) kptslist = HopTB.Utilities.splitkpts(kpts, nworkers()) @@ -598,4 +596,91 @@ function get_Drude_weight( return result * bzvol / nks end + +@doc raw""" +```julia +get_injection_conductivity_k!( + σs::AbstractVector{Complex64}, + tm::AbstractTBModel, + α::Int64, + β::Int64, + γ::Int64, + ωs::Vector{Float64}, + μ::Float64, + k::Vector{Float64}; + ϵ::Float64=0.1 +) +``` + +Calculate injection conductivity at `k` point and add the result to `σs`. +""" +function get_injection_conductivity_k!( + σs::AbstractVector{Complex64}, + tm::AbstractTBModel, + α::Int64, + β::Int64, + γ::Int64, + ωs::Vector{Float64}, + μ::Float64, + k::Vector{Float64}; + ϵ::Float64=0.1 +) + nωs = length(ωs) + vα = getvelocity(tm, α, k) + rβ = getA(tm, β, k) + rγ = getA(tm, γ, k) + Es = geteig(tm, k).values + for n in 1:tm.norbits, m in 1:tm.norbits + En = Es[n] + Em = Es[m] + if abs(En - Em) > only(Hop.DEGEN_THRESH) + fn = (En < μ) ? 1 : 0 + fm = (Em < μ) ? 1 : 0 + for iω in 1:nωs + ω = ωs[iω] + delta = exp(-(Em - En - ω)^2 / ϵ^2) / ϵ / √π + σs[iω] += (vα[n, n] - vα[m, m]) * rβ[n, m] * rγ[m, n] * (fn - fm) * delta * 3.082867745843085 # π * e^2 / (ħ * (2π)^3) + end + end + end + return nothing +end + +@doc raw""" +```julia +get_injection_conductivity( + tm::AbstractTBModel, + α::Int64, + β::Int64, + γ::Int64, + ωs::Vector{Float64}, + μ::Float64, + meshsize::Vector{Int64}; + ϵ::Float64=0.1, + batchsize::Int64=1 +) +``` + +This function returns injection conductivity in μA * eV / V^2. +""" +function get_injection_conductivity( + tm::AbstractTBModel, + α::Int64, + β::Int64, + γ::Int64, + ωs::Vector{Float64}, + μ::Float64, + meshsize::Vector{Int64}; + ϵ::Float64=0.1, + batchsize::Int64=1 +) + nks = prod(meshsize) + nωs = length(ωs) + σs = [SharedArray{ComplexF64}(nωs) for _ in 1:nprocs()] + parallel_do(k -> get_injection_conductivity_k!(σs[myid()], tm, α, β, γ, ωs, μ, k; ϵ=ϵ), + UniformMesh(meshsize), batchsize=batchsize) + bzvol = abs(det(tm.rlat)) + return sum(σs) * bzvol / nks +end + end From 2004afcca80824b931266de66f442e74cc749fcc Mon Sep 17 00:00:00 2001 From: Chong Wang Date: Tue, 15 Nov 2022 15:44:25 -0800 Subject: [PATCH 2/5] progress --- src/optics.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/optics.jl b/src/optics.jl index baf72b1..dbae88c 100644 --- a/src/optics.jl +++ b/src/optics.jl @@ -646,6 +646,21 @@ function get_injection_conductivity_k!( return nothing end +function get_injection_conductivity_k( + tm::AbstractTBModel, + α::Int64, + β::Int64, + γ::Int64, + ωs::Vector{Float64}, + μ::Float64, + k::Vector{Float64}; + ϵ::Float64=0.1 +) + σs = zeros(ComplexF64, length(ωs)) + get_injection_conductivity_k!(σs, tm, α, β, γ, ωs, μ, k; ϵ=ϵ) + return σs +end + @doc raw""" ```julia get_injection_conductivity( From f8996b1666a905ef664060a581a5f80c31389da1 Mon Sep 17 00:00:00 2001 From: Chong Wang Date: Tue, 15 Nov 2022 16:11:07 -0800 Subject: [PATCH 3/5] fix a typo --- src/optics.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/optics.jl b/src/optics.jl index dbae88c..c32d686 100644 --- a/src/optics.jl +++ b/src/optics.jl @@ -600,7 +600,7 @@ end @doc raw""" ```julia get_injection_conductivity_k!( - σs::AbstractVector{Complex64}, + σs::AbstractVector{ComplexF64}, tm::AbstractTBModel, α::Int64, β::Int64, @@ -615,7 +615,7 @@ get_injection_conductivity_k!( Calculate injection conductivity at `k` point and add the result to `σs`. """ function get_injection_conductivity_k!( - σs::AbstractVector{Complex64}, + σs::AbstractVector{ComplexF64}, tm::AbstractTBModel, α::Int64, β::Int64, @@ -633,7 +633,7 @@ function get_injection_conductivity_k!( for n in 1:tm.norbits, m in 1:tm.norbits En = Es[n] Em = Es[m] - if abs(En - Em) > only(Hop.DEGEN_THRESH) + if abs(En - Em) > only(HopTB.DEGEN_THRESH) fn = (En < μ) ? 1 : 0 fm = (Em < μ) ? 1 : 0 for iω in 1:nωs From a65d6af0c0931c2b16c404098525da380ac53928 Mon Sep 17 00:00:00 2001 From: Chong Wang Date: Mon, 21 Nov 2022 15:23:46 -0800 Subject: [PATCH 4/5] add notes --- note/note.tm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/note/note.tm b/note/note.tm index 7bbc3b0..554f3ab 100644 --- a/note/note.tm +++ b/note/note.tm @@ -1,4 +1,4 @@ - + > @@ -310,6 +310,24 @@ <\eqnarray*> \\>>|||\>>\||)>>>\|)>>\>\|)>\|\|>>.>>>> + + + + The injection current conductivity is + + <\eqnarray*> + \\>|)>>||e|\>\||)>>>-v>|)>A>m>A>n>fm>\\-\n>|)>.>>>> + + + HopTB.jl calculates + + <\eqnarray*> + \\>|)>>||e\||)>>>-v>|)>A>m>A>n>fm>\\-\n>|)>.>>>> + + + For nonmagnetic materials, |)>> is + purely imaginary. In addition, for nonmagnetic materials, + \\>|)>=-\\\>|)>>. <\initial> From 731a0e03b70f53ebcb01d7c065cbe6594746abd9 Mon Sep 17 00:00:00 2001 From: Chong Wang Date: Mon, 21 Nov 2022 15:29:05 -0800 Subject: [PATCH 5/5] relax some function signatures --- src/optics.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/optics.jl b/src/optics.jl index c32d686..5658fd6 100644 --- a/src/optics.jl +++ b/src/optics.jl @@ -605,7 +605,7 @@ get_injection_conductivity_k!( α::Int64, β::Int64, γ::Int64, - ωs::Vector{Float64}, + ωs::AbstractVector{Float64}, μ::Float64, k::Vector{Float64}; ϵ::Float64=0.1 @@ -620,7 +620,7 @@ function get_injection_conductivity_k!( α::Int64, β::Int64, γ::Int64, - ωs::Vector{Float64}, + ωs::AbstractVector{Float64}, μ::Float64, k::Vector{Float64}; ϵ::Float64=0.1 @@ -651,7 +651,7 @@ function get_injection_conductivity_k( α::Int64, β::Int64, γ::Int64, - ωs::Vector{Float64}, + ωs::AbstractVector{Float64}, μ::Float64, k::Vector{Float64}; ϵ::Float64=0.1 @@ -668,7 +668,7 @@ get_injection_conductivity( α::Int64, β::Int64, γ::Int64, - ωs::Vector{Float64}, + ωs::AbstractVector{Float64}, μ::Float64, meshsize::Vector{Int64}; ϵ::Float64=0.1, @@ -683,7 +683,7 @@ function get_injection_conductivity( α::Int64, β::Int64, γ::Int64, - ωs::Vector{Float64}, + ωs::AbstractVector{Float64}, μ::Float64, meshsize::Vector{Int64}; ϵ::Float64=0.1,