From 59f812779d6639aa2c4275f5fca0f7b3886fed05 Mon Sep 17 00:00:00 2001 From: Bradley Martin Date: Mon, 11 Dec 2023 16:02:52 +0000 Subject: [PATCH] Magic number not small enough. Made smaller. Just needs to counter -1e-16s --- src/TrialPolaron.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TrialPolaron.jl b/src/TrialPolaron.jl index 0ad5ba3..49db46d 100644 --- a/src/TrialPolaron.jl +++ b/src/TrialPolaron.jl @@ -27,7 +27,7 @@ println(result) This example calculates the polaron propagator for given values of τ, v, w, and β. The result is then printed. """ function polaron_propagator(τ, v, w, ω, β) - (v^2 - w^2) / v^3 * (1 - exp(-v * τ)) * (1 - exp(-v * (β * ω - τ))) / (1 - exp(-v * β * ω)) + w^2 / v^2 * τ * (1 - τ / β / ω) + sqrt(eps(Float64)) + (v^2 - w^2) / v^3 * (1 - exp(-v * τ)) * (1 - exp(-v * (β * ω - τ))) / (1 - exp(-v * β * ω)) + w^2 / v^2 * τ * (1 - τ / β / ω) + 1e-15 end """ @@ -54,7 +54,7 @@ println(result) This example calculates the polaron propagator for the given values of τ, v, and w. The result is then printed. """ function polaron_propagator(τ, v, w, ω) - w^2 * τ / v^2 + (v^2 - w^2) / v^3 * (1 - exp(-v * τ)) + sqrt(eps(Float64)) + w^2 * τ / v^2 + (v^2 - w^2) / v^3 * (1 - exp(-v * τ)) + 1e-15 end """ @@ -71,7 +71,7 @@ Calculates the recoil function (a generalisation of D(u) in Eqn. (35c) in FHIP 1 See FHIP 1962: https://doi.org/10.1103/PhysRev.127.1004. """ function polaron_propagator(τ, v::Vector, w::Vector, ω, β) - return τ * (1 - τ / ω / β) + sum((h_i(i, v, w) / v[i]^2) * ((1 + exp(-v[i] * ω * β) - exp(-v[i] * τ) - exp(v[i] * (τ - ω * β))) / (v[i] * (1 - exp(-v[i] * ω * β))) - τ * (1 - τ / ω / β)) for i in eachindex(v)) + sqrt(eps(Float64)) + return τ * (1 - τ / ω / β) + sum((h_i(i, v, w) / v[i]^2) * ((1 + exp(-v[i] * ω * β) - exp(-v[i] * τ) - exp(v[i] * (τ - ω * β))) / (v[i] * (1 - exp(-v[i] * ω * β))) - τ * (1 - τ / ω / β)) for i in eachindex(v)) + 1e-15 end """ @@ -85,7 +85,7 @@ Calculates the recoil function at zero-temperature. - `w::Vector{Float64}`: is a vector of the w variational parameters. """ function polaron_propagator(τ, v::Vector, w::Vector, ω) - return τ + sum((h_i(i, v, w) / v[i]^2) * ((1 - exp(-v[i] * τ)) / v[i] - τ) for i in eachindex(v)) + sqrt(eps(Float64)) + return τ + sum((h_i(i, v, w) / v[i]^2) * ((1 - exp(-v[i] * τ)) / v[i] - τ) for i in eachindex(v)) + 1e-15 end # Hellwarth et al. 1999 PRB - Part IV; T-dep of the Feynman variation parameter