Correct qed implementation and test compton
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using SafeTestsets
|
||||
#=
|
||||
|
||||
@safetestset "Utility Unit Tests" begin
|
||||
include("unit_tests_utility.jl")
|
||||
end
|
||||
@@ -17,10 +17,10 @@ end
|
||||
end
|
||||
@safetestset "ABC-Model Unit Tests" begin
|
||||
include("unit_tests_abcmodel.jl")
|
||||
end=#
|
||||
end
|
||||
@safetestset "QED-Model Unit Tests" begin
|
||||
include("unit_tests_qedmodel.jl")
|
||||
end#=
|
||||
end
|
||||
@safetestset "Node Reduction Unit Tests" begin
|
||||
include("node_reduction.jl")
|
||||
end
|
||||
@@ -36,4 +36,3 @@ end
|
||||
@safetestset "Known Graph Tests" begin
|
||||
include("known_graphs.jl")
|
||||
end
|
||||
=#
|
@@ -47,23 +47,22 @@ function compton_groundtruth(input::QEDProcessInput)
|
||||
u_p1 = base_state(Electron(), Incoming(), p1.momentum, spin_or_pol(p1))
|
||||
u_p2 = base_state(Electron(), Outgoing(), p2.momentum, spin_or_pol(p2))
|
||||
|
||||
eps_slashed_1 = base_state(Photon(), Incoming(), k1.momentum, spin_or_pol(k1))
|
||||
eps_slashed_2 = base_state(Photon(), Outgoing(), k2.momentum, spin_or_pol(k2))
|
||||
eps_1 = base_state(Photon(), Incoming(), k1.momentum, spin_or_pol(k1))
|
||||
eps_2 = base_state(Photon(), Outgoing(), k2.momentum, spin_or_pol(k2))
|
||||
|
||||
virt1_mom = p2.momentum - k1.momentum
|
||||
@test isapprox(p1.momentum - k2.momentum, virt1_mom)
|
||||
|
||||
virt2_mom = p1.momentum + k1.momentum
|
||||
|
||||
println("Groundtruth virtual particle (p2 - k1): $(virt1_mom)")
|
||||
println("Groundtruth virtual particle (p1 + k1): $(virt2_mom)")
|
||||
|
||||
@test isapprox(p2.momentum + k2.momentum, virt2_mom)
|
||||
|
||||
s_p2_k1 = propagator(Electron(), virt1_mom)
|
||||
s_p1_k1 = propagator(Electron(), virt2_mom)
|
||||
|
||||
diagram1 = u_p2 * eps_slashed_1 * QED_vertex() * s_p2_k1 * QED_vertex() * eps_slashed_2 * u_p1
|
||||
diagram2 = u_p2 * eps_slashed_2 * QED_vertex() * s_p1_k1 * QED_vertex() * eps_slashed_1 * u_p1
|
||||
diagram1 = u_p2 * (eps_1 * QED_vertex()) * s_p2_k1 * (eps_2 * QED_vertex()) * u_p1
|
||||
diagram2 = u_p2 * (eps_2 * QED_vertex()) * s_p1_k1 * (eps_1 * QED_vertex()) * u_p1
|
||||
|
||||
return (diagram1 + diagram2)
|
||||
return diagram1 + diagram2
|
||||
end
|
||||
|
||||
|
||||
@@ -165,8 +164,8 @@ end
|
||||
@test countmap(typeof.(input.outParticles)) == process.outParticles
|
||||
|
||||
@test isapprox(
|
||||
sum(getfield.(input.inParticles, :momentum)) + sum(getfield.(input.outParticles, :momentum)),
|
||||
SFourMomentum(0.0, 0.0, 0.0, 0.0);
|
||||
sum(getfield.(input.inParticles, :momentum)),
|
||||
sum(getfield.(input.outParticles, :momentum));
|
||||
atol = sqrt(eps()),
|
||||
)
|
||||
end
|
||||
@@ -282,9 +281,7 @@ end
|
||||
|
||||
compton_function = get_compute_function(graph, process, machine)
|
||||
|
||||
input = gen_process_input(process)
|
||||
input = [gen_process_input(process) for _ in 1:1000]
|
||||
|
||||
println("Function result: $(compton_function(input))")
|
||||
|
||||
println("Groundtruth: $(compton_groundtruth(input))")
|
||||
@test isapprox(compton_function.(input), compton_groundtruth.(input))
|
||||
end
|
||||
|
Reference in New Issue
Block a user