diff --git a/src/FeynmanTheory.jl b/src/FeynmanTheory.jl index b68a87a..aebbcd7 100644 --- a/src/FeynmanTheory.jl +++ b/src/FeynmanTheory.jl @@ -174,7 +174,7 @@ function feynmanvw(α, β; v=3.0, w=3.0) # v, w defaults Δv = v - w # defines a constraint, so that v>w initial = [Δv + 0.01, w] - # Tthermal action + # Thermal action f(x) = F(x[1] + x[2], x[2], β, α) # Use Optim to optimise v and w to minimise enthalpy. diff --git a/src/MobilityTheories.jl b/src/MobilityTheories.jl index d7f8b6f..f870d58 100644 --- a/src/MobilityTheories.jl +++ b/src/MobilityTheories.jl @@ -337,7 +337,7 @@ function make_polaron(ϵ_optic, ϵ_static, phonon_freq, m_eff, T::Float64, Ω::F betas = [T == 0.0 ? Inf64 : ħ * ω[j] / (kB * T) * 1e12 for j in eachindex(ω)] # Calculate variational parameters for each temperature from multiple phonon frequencies. - params = T == 0.0 ? var_params(α; v=v_guess, w=v_guess, ω=ω, N=N_params) : var_params(α, betas; v=v_guess, w=w_guess, ω=ω, N=N_params) + params = T == 0.0 ? extended_feynmanvw(α; v=v_guess, w=v_guess, ω=ω, N=N_params) : extended_feynmanvw(α, betas; v=v_guess, w=w_guess, ω=ω, N=N_params) # Separate tuples of variational parameters into a list of 'v' and 'w' parameters for each temperature. v_params = params[1] @@ -426,7 +426,7 @@ end v_guess, w_guess, E_guess = params[i-1] end - params[i] = Trange[i] == 0.0 ? var_params(α; v=v_guess, w=w_guess, ω=ω, N=N_params) : var_params(α, @view(betas[i, :]); v=v_guess, w=w_guess, ω=ω, N=N_params) + params[i] = Trange[i] == 0.0 ? extended_feynmanvw(α; v=v_guess, w=w_guess, ω=ω, N=N_params) : extended_feynmanvw(α, @view(betas[i, :]); v=v_guess, w=w_guess, ω=ω, N=N_params) @fastmath @inbounds @simd for j in 1:N_params v_params[i, j] = params[i][1][j] @@ -470,7 +470,7 @@ function make_polaron(α::Float64, T::Float64, Ω::Float64; ω=1.0, v_guess = 5. beta = T == 0.0 ? Inf64 : ω / T # Calculate variational parameters for each alpha parameter and temperature. Returns a Matrix of tuples. - params = T == 0.0 ? var_params(α; v=v_guess, w=w_guess, ω=ω, N=N_params) : var_params(α, beta; v=v_guess, w=w_guess, ω=ω, N=N_params) + params = T == 0.0 ? extended_feynmanvw(α; v=v_guess, w=w_guess, ω=ω, N=N_params) : extended_feynmanvw(α, beta; v=v_guess, w=w_guess, ω=ω, N=N_params) # Separate tuples of variational parameters into a Matrices of 'v' and 'w' parameters for each alpha parameter and temperature. v_param = params[1] @@ -538,7 +538,7 @@ end @fastmath @inbounds @simd for i in eachindex(αrange) - params[i, j] = Trange[j] == 0.0 ? var_params(αrange[i]; v=v_guess, w=w_guess, ω=ω, N=N_params) : var_params(αrange[i], betas[j]; v=v_guess, w=w_guess, ω=ω, N=N_params) + params[i, j] = Trange[j] == 0.0 ? extended_feynmanvw(αrange[i]; v=v_guess, w=w_guess, ω=ω, N=N_params) : extended_feynmanvw(αrange[i], betas[j]; v=v_guess, w=w_guess, ω=ω, N=N_params) for k in 1:N_params v_params[i, j, k] = params[i, j][1][k] diff --git a/src/MultipleBranches.jl b/src/MultipleBranches.jl index f11ae22..240692d 100644 --- a/src/MultipleBranches.jl +++ b/src/MultipleBranches.jl @@ -546,7 +546,7 @@ Minimises the multiple phonon mode free energy function for a set of vₚ and w See also [`multi_F`](@ref), [`feynmanvw`](@ref). """ -function var_params(α...; v = 0.0, w = 0.0, ω = 1.0, N = 1, show_trace = false) # N number of v and w params +function extended_feynmanvw(α...; v = 0.0, w = 0.0, ω = 1.0, N = 1, show_trace = false) # N number of v and w params if N != length(v) != length(w) return error("The number of variational parameters v & w must be equal to N.") diff --git a/src/PolaronMobility.jl b/src/PolaronMobility.jl index ceb2324..a28de4a 100644 --- a/src/PolaronMobility.jl +++ b/src/PolaronMobility.jl @@ -12,7 +12,7 @@ export frohlichalpha, feynmanvw, F, polaronmobility, savepolaron export HellwarthBScheme, HellwarthAScheme export polaron_memory_function # Polaron memory functions export optical_absorption # Polaron optical absorption -export ϵ_ionic_mode, multi_frohlichalpha, var_params, multi_F, polaron_mobility, polaron_complex_impedence, polaron_complex_conductivity +export ϵ_ionic_mode, multi_frohlichalpha, extended_feynmanvw, multi_F, polaron_mobility, polaron_complex_impedence, polaron_complex_conductivity export frohlichPartial, IRtoDielectric, IRtoalpha, DielectricFromIRmode export Hellwarth1999mobilityRHS export make_polaron, save_polaron, load_polaron, combine_polarons diff --git a/test/MultiplePhonons.jl b/test/MultiplePhonons.jl index bdca11a..cd5f366 100644 --- a/test/MultiplePhonons.jl +++ b/test/MultiplePhonons.jl @@ -81,10 +81,10 @@ # Variations - v_0, w_0 = var_params(α; v=0.0, w=0.0, ω=ω) # Athermal + v_0, w_0 = extended_feynmanvw(α; v=0.0, w=0.0, ω=ω) # Athermal β = [i .* ħ / (kB * 300) * 1e12 for i in ω] - v, w = var_params(α, β; v=0.0, w=0.0, ω=ω) # Thermal + v, w = extended_feynmanvw(α, β; v=0.0, w=0.0, ω=ω) # Thermal @testset "Multiple mode variations" begin