From 5a9ccf85bacbd6d4135de2fc3d1bee81b597229b Mon Sep 17 00:00:00 2001 From: Hogg Date: Thu, 22 Aug 2024 16:24:14 +0100 Subject: [PATCH 1/2] Fix behaviour of PSD at zero frequency --- src/Noise.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Noise.jl b/src/Noise.jl index 20ed975..272baa7 100644 --- a/src/Noise.jl +++ b/src/Noise.jl @@ -105,4 +105,8 @@ function psd(J::AbstractSD, noise::Noise) return psd end -psd(J::LorentzianSD, noise::ClassicalNoise) = ω -> 2*J.α*J.Γ*noise.T/((J.ω0^2 - ω^2)^2 + (J.Γ*ω)^2) +psd(J::LorentzianSD, noise::ClassicalNoise) = ω -> 2*noise.T*π*sdoverω(J, ω) + +psd(J::LorentzianSD, noise::QuantumNoise) = ω -> iszero(ω) ? 2*noise.T*π*sdoverω(J, 0) : π*sd(J, ω)*coth(ω/2/noise.T) + +psd(J::LorentzianSD, noise::NoZeroQuantumNoise) = ω -> iszero(ω) ? 2*noise.T*π*sdoverω(J, 0) : π*sd(J, ω)*(coth(ω/2/noise.T) - sign(ω)) \ No newline at end of file From ccccf821f46ad2a404e1137f5849305d29ab0bf6 Mon Sep 17 00:00:00 2001 From: Hogg Date: Thu, 22 Aug 2024 17:30:21 +0100 Subject: [PATCH 2/2] Stochastic test with fixed seed values updated to reflect new PSD --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 0d6583c..fd488aa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -106,7 +106,7 @@ using Test sol = diffeqsolver(s0, tspan, J, bfields, Cw; S0=1, saveat=saveat, alg=Vern7(), atol=1e-8, rtol=1e-8); sdynss = mean(Array(sol), dims=2) - @test isapprox(sdynss[:,end], [-0.535859, -0.109671, 0.814815], atol=1e-5) + @test isapprox(sdynss[:,end], [-0.535249, -0.133732, 0.811530], atol=1e-5) end @testset "Classical single spin steady state" begin