Add model, particles etc., add interaction_result and tests for it, add compute task types

This commit is contained in:
2023-11-24 01:26:10 +01:00
parent fcb7c992da
commit c2687cdc01
10 changed files with 389 additions and 18 deletions

View File

@@ -18,6 +18,9 @@ end
@safetestset "ABC-Model Unit Tests" begin
include("unit_tests_abcmodel.jl")
end
@safetestset "QED-Model Unit Tests" begin
include("unit_tests_qedmodel.jl")
end
@safetestset "Node Reduction Unit Tests" begin
include("node_reduction.jl")
end

View File

@@ -19,5 +19,5 @@ testparticles = [ParticleA(def_momentum), ParticleB(def_momentum), ParticleC(def
end
@testset "Vertex" begin
@test isapprox(MetagraphOptimization.vertex(), 1 / 137.0)
@test isapprox(MetagraphOptimization.ABC_vertex(), 1 / 137.0)
end

View File

@@ -38,8 +38,8 @@ function ground_truth_graph_result(input::ABCProcessInput)
@test isapprox(getMass2(diagram1_C.momentum), getMass2(diagram1_Cp.momentum))
@test isapprox(getMass2(diagram2_C.momentum), getMass2(diagram2_Cp.momentum))
inner1 = MetagraphOptimization.inner_edge(diagram1_C)
inner2 = MetagraphOptimization.inner_edge(diagram2_C)
inner1 = MetagraphOptimization.ABC_inner_edge(diagram1_C)
inner2 = MetagraphOptimization.ABC_inner_edge(diagram2_C)
diagram1_result = inner1 * constant
diagram2_result = inner2 * constant

View File

@@ -0,0 +1,51 @@
using MetagraphOptimization
using QEDbase
import MetagraphOptimization.interaction_result
def_momentum = SFourMomentum(1.0, 0.0, 0.0, 0.0)
testparticleTypes = [
PhotonStateful{Incoming},
PhotonStateful{Outgoing},
FermionStateful{Incoming},
FermionStateful{Outgoing},
AntiFermionStateful{Incoming},
AntiFermionStateful{Outgoing},
]
#testparticles = [ParticleA(def_momentum), ParticleB(def_momentum), ParticleC(def_momentum)]
function caninteract(t1::Type{<:QEDParticle}, t2::Type{<:QEDParticle})
if (t1 == t2)
return false
end
if (t1 <: PhotonStateful && t2 <: PhotonStateful)
return false
end
for (p1, p2) in [(t1, t2), (t2, t1)]
if (p1 == FermionStateful{Incoming} && p2 == AntiFermionStateful{Outgoing})
return false
end
if (p1 == FermionStateful{Outgoing} && p2 == AntiFermionStateful{Incoming})
return false
end
end
return true
end
function issame(t1::Type{<:QEDParticle}, t2::Type{<:QEDParticle})
return !caninteract(t1, t2)
end
@testset "Interaction Result" begin
for p1 in testparticleTypes, p2 in testparticleTypes
if !caninteract(p1, p2)
@test_throws AssertionError interaction_result(p1, p2)
else
@test interaction_result(p1, p2) in setdiff(testparticleTypes, [p1, p2])
@test issame(interaction_result(p1, p2), interaction_result(p2, p1))
end
end
end