Finish DAG generation and function

This commit is contained in:
Rubydragon 2024-07-17 18:22:54 +02:00
parent 4f0da3dffb
commit 00a1252c9a
6 changed files with 121 additions and 104 deletions

View File

@ -9,9 +9,9 @@
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/mvCVq/src/QEDprocesses_patch.jl:15.\n",
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/0iydf/src/QEDprocesses_patch.jl:15.\n",
"ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.\n",
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/mvCVq/src/QEDprocesses_patch.jl:15.\n",
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/0iydf/src/QEDprocesses_patch.jl:15.\n",
"ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.\n"
]
}
@ -29,21 +29,13 @@
{
"data": {
"text/plain": [
"14-element Vector{VirtualParticle{GenericQEDProcess{Tuple{Photon, Photon, Photon, Electron}, Tuple{Photon, Electron}, Tuple{AllPolarization, AllPolarization, AllPolarization, AllSpin}, Tuple{AllPolarization, AllSpin}}, PT, 4, 2} where PT<:AbstractParticleType}:\n",
" positron: \t0000 | 11\n",
" electron: \t0001 | 10\n",
" positron: \t0010 | 01\n",
" electron: \t0011 | 00\n",
" positron: \t0100 | 01\n",
" electron: \t0101 | 00\n",
" positron: \t1000 | 01\n",
" electron: \t1001 | 00\n",
" positron: \t1000 | 11\n",
" electron: \t1001 | 10\n",
" positron: \t1010 | 01\n",
" electron: \t1011 | 00\n",
" positron: \t1100 | 01\n",
" electron: \t1101 | 00"
"6-element Vector{VirtualParticle{QEDProcess{Tuple{Photon, Photon, Electron}, Tuple{Photon, Electron}, Tuple{AllPolarization, AllPolarization, AllSpin}, Tuple{AllPolarization, AllSpin}}, PT, 3, 2} where PT<:AbstractParticleType}:\n",
" positron: \t000 | 11\n",
" electron: \t001 | 10\n",
" positron: \t010 | 01\n",
" electron: \t011 | 00\n",
" positron: \t100 | 01\n",
" electron: \t101 | 00"
]
},
"metadata": {},
@ -58,7 +50,7 @@
}
],
"source": [
"proc = GenericQEDProcess(3, 1, 1, 1, 0, 0)\n",
"proc = QEDProcess(2, 1, 1, 1, 0, 0)\n",
"all_particles = Set()\n",
"for fd in feynman_diagrams(proc)\n",
" push!(all_particles, virtual_particles(proc, fd)...)\n",
@ -75,21 +67,13 @@
{
"data": {
"text/plain": [
"OrderedCollections.OrderedDict{VirtualParticle, Vector{Tuple{VirtualParticle, VirtualParticle}}} with 14 entries:\n",
" positron: \t0000 | 11 => [(positron: \t0000 | 01, photon: \t0000 | 10)]\n",
" electron: \t0001 | 10 => [(photon: \t0000 | 10, electron: \t0001 | 00)]\n",
" positron: \t0010 | 01 => [(positron: \t0000 | 01, photon: \t0010 | 00)]\n",
" electron: \t0011 | 00 => [(electron: \t0001 | 00, photon: \t0010 | 00)]\n",
" positron: \t0100 | 01 => [(positron: \t0000 | 01, photon: \t0100 | 00)]\n",
" electron: \t0101 | 00 => [(electron: \t0001 | 00, photon: \t0100 | 00)]\n",
" positron: \t1000 | 01 => [(positron: \t0000 | 01, photon: \t1000 | 00)]\n",
" electron: \t1001 | 00 => [(electron: \t0001 | 00, photon: \t1000 | 00)]\n",
" positron: \t1000 | 11 => [(photon: \t0000 | 10, positron: \t1000 | 01), (photon: \t10…\n",
" electron: \t1001 | 10 => [(photon: \t0000 | 10, electron: \t1001 | 00), (photon: \t10…\n",
" positron: \t1010 | 01 => [(photon: \t0010 | 00, positron: \t1000 | 01), (photon: \t10…\n",
" electron: \t1011 | 00 => [(photon: \t0010 | 00, electron: \t1001 | 00), (photon: \t10…\n",
" positron: \t1100 | 01 => [(photon: \t0100 | 00, positron: \t1000 | 01), (photon: \t10…\n",
" electron: \t1101 | 00 => [(photon: \t0100 | 00, electron: \t1001 | 00), (photon: \t10…"
"OrderedCollections.OrderedDict{VirtualParticle, Vector{Tuple{VirtualParticle, VirtualParticle}}} with 6 entries:\n",
" positron: \t000 | 11 => [(positron: \t000 | 01, photon: \t000 | 10)]\n",
" electron: \t001 | 10 => [(photon: \t000 | 10, electron: \t001 | 00)]\n",
" positron: \t010 | 01 => [(positron: \t000 | 01, photon: \t010 | 00)]\n",
" electron: \t011 | 00 => [(electron: \t001 | 00, photon: \t010 | 00)]\n",
" positron: \t100 | 01 => [(positron: \t000 | 01, photon: \t100 | 00)]\n",
" electron: \t101 | 00 => [(electron: \t001 | 00, photon: \t100 | 00)]"
]
},
"metadata": {},
@ -108,19 +92,13 @@
{
"data": {
"text/plain": [
"12-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t0000 | 10, electron: \t0011 | 00, positron: \t1100 | 01)\n",
" (photon: \t0000 | 10, electron: \t0101 | 00, positron: \t1010 | 01)\n",
" (photon: \t0000 | 10, electron: \t1101 | 00, positron: \t0010 | 01)\n",
" (photon: \t0000 | 10, electron: \t1011 | 00, positron: \t0100 | 01)\n",
" (photon: \t0010 | 00, electron: \t0001 | 10, positron: \t1100 | 01)\n",
" (photon: \t0010 | 00, electron: \t0101 | 00, positron: \t1000 | 11)\n",
" (photon: \t0010 | 00, electron: \t1101 | 00, positron: \t0000 | 11)\n",
" (photon: \t0010 | 00, electron: \t1001 | 10, positron: \t0100 | 01)\n",
" (photon: \t0100 | 00, electron: \t0001 | 10, positron: \t1010 | 01)\n",
" (photon: \t0100 | 00, electron: \t0011 | 00, positron: \t1000 | 11)\n",
" (photon: \t0100 | 00, electron: \t1011 | 00, positron: \t0000 | 11)\n",
" (photon: \t0100 | 00, electron: \t1001 | 10, positron: \t0010 | 01)"
"6-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t000 | 10, electron: \t011 | 00, positron: \t100 | 01)\n",
" (photon: \t000 | 10, electron: \t101 | 00, positron: \t010 | 01)\n",
" (photon: \t010 | 00, electron: \t101 | 00, positron: \t000 | 11)\n",
" (photon: \t010 | 00, electron: \t001 | 10, positron: \t100 | 01)\n",
" (photon: \t100 | 00, electron: \t011 | 00, positron: \t000 | 11)\n",
" (photon: \t100 | 00, electron: \t001 | 10, positron: \t010 | 01)"
]
},
"metadata": {},
@ -140,26 +118,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"s: 24, should be: 24\n",
"number of triples: 12\n"
"s: 6, should be: 6\n",
"number of triples: 6\n"
]
},
{
"data": {
"text/plain": [
"12-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t0000 | 10, electron: \t0011 | 00, positron: \t1100 | 01)\n",
" (photon: \t0000 | 10, electron: \t0101 | 00, positron: \t1010 | 01)\n",
" (photon: \t0000 | 10, electron: \t1011 | 00, positron: \t0100 | 01)\n",
" (photon: \t0000 | 10, electron: \t1101 | 00, positron: \t0010 | 01)\n",
" (photon: \t0010 | 00, electron: \t0001 | 10, positron: \t1100 | 01)\n",
" (photon: \t0010 | 00, electron: \t0101 | 00, positron: \t1000 | 11)\n",
" (photon: \t0010 | 00, electron: \t1001 | 10, positron: \t0100 | 01)\n",
" (photon: \t0010 | 00, electron: \t1101 | 00, positron: \t0000 | 11)\n",
" (photon: \t0100 | 00, electron: \t0001 | 10, positron: \t1010 | 01)\n",
" (photon: \t0100 | 00, electron: \t0011 | 00, positron: \t1000 | 11)\n",
" (photon: \t0100 | 00, electron: \t1001 | 10, positron: \t0010 | 01)\n",
" (photon: \t0100 | 00, electron: \t1011 | 00, positron: \t0000 | 11)"
"6-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t000 | 10, electron: \t011 | 00, positron: \t100 | 01)\n",
" (photon: \t000 | 10, electron: \t101 | 00, positron: \t010 | 01)\n",
" (photon: \t010 | 00, electron: \t001 | 10, positron: \t100 | 01)\n",
" (photon: \t010 | 00, electron: \t101 | 00, positron: \t000 | 11)\n",
" (photon: \t100 | 00, electron: \t001 | 10, positron: \t010 | 01)\n",
" (photon: \t100 | 00, electron: \t011 | 00, positron: \t000 | 11)"
]
},
"metadata": {},
@ -198,11 +170,11 @@
"data": {
"text/plain": [
"Graph:\n",
" Nodes: Total: 2320, FeynmanDiagramGenerator.ComputeTask_CollectTriples: 64, MetagraphOptimization.DataTask: 1173, \n",
" FeynmanDiagramGenerator.ComputeTask_CollectPairs: 80, FeynmanDiagramGenerator.ComputeTask_SpinPolCumulation: 1, FeynmanDiagramGenerator.ComputeTask_Propagator: 14, \n",
" FeynmanDiagramGenerator.ComputeTask_Triple: 768, FeynmanDiagramGenerator.ComputeTask_BaseState: 12, FeynmanDiagramGenerator.ComputeTask_PropagatePairs: 80, \n",
" FeynmanDiagramGenerator.ComputeTask_Pair: 128\n",
" Edges: 4853\n",
" Nodes: Total: 642, FeynmanDiagramGenerator.ComputeTask_PropagatePairs: 24, FeynmanDiagramGenerator.ComputeTask_CollectPairs: 24, \n",
" FeynmanDiagramGenerator.ComputeTask_Triple: 192, FeynmanDiagramGenerator.ComputeTask_SpinPolCumulation: 1, MetagraphOptimization.DataTask: 329, \n",
" FeynmanDiagramGenerator.ComputeTask_BaseState: 10, FeynmanDiagramGenerator.ComputeTask_Pair: 24, FeynmanDiagramGenerator.ComputeTask_Propagator: 6, \n",
" FeynmanDiagramGenerator.ComputeTask_CollectTriples: 32\n",
" Edges: 1249\n",
" Total Compute Effort: 0.0\n",
" Total Data Transfer: 0.0\n",
" Total Compute Intensity: 0.0\n"
@ -218,13 +190,13 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"compute__2e0e67fe_4441_11ef_36f2_5fda31178519 (generic function with 1 method)"
"mock_machine (generic function with 1 method)"
]
},
"metadata": {},
@ -248,18 +220,53 @@
" ],\n",
" [-1.0;;],\n",
" )\n",
"end\n",
"\n",
"func = get_compute_function(graph, proc, mock_machine())"
"end"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"PhaseSpacePoint{QEDProcess{Tuple{Photon, Photon, Electron}, Tuple{Photon, Electron}, Tuple{AllPolarization, AllPolarization, AllSpin}, Tuple{AllPolarization, AllSpin}}, PerturbativeQED, PhasespaceDefinition{SphericalCoordinateSystem, ElectronRestFrame}, Tuple{ParticleStateful{Incoming, Photon, SFourMomentum}, ParticleStateful{Incoming, Photon, SFourMomentum}, ParticleStateful{Incoming, Electron, SFourMomentum}}, Tuple{ParticleStateful{Outgoing, Photon, SFourMomentum}, ParticleStateful{Outgoing, Electron, SFourMomentum}}, SFourMomentum}"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"psp = PhaseSpacePoint(proc, PerturbativeQED(), PhasespaceDefinition(SphericalCoordinateSystem(), ElectronRestFrame()), [rand(SFourMomentum) for _ in 1:number_incoming_particles(proc)], [rand(SFourMomentum) for _ in 1:number_outgoing_particles(proc)])"
"psp = PhaseSpacePoint(\n",
" proc, \n",
" PerturbativeQED(), \n",
" PhasespaceDefinition(SphericalCoordinateSystem(), ElectronRestFrame()), \n",
" tuple((rand(SFourMomentum) for _ in 1:number_incoming_particles(proc))...),\n",
" tuple((rand(SFourMomentum) for _ in 1:number_outgoing_particles(proc))...)\n",
")\n",
"typeof(psp)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"ename": "Base.Meta.ParseError",
"evalue": "Error trying to display an error.",
"output_type": "error",
"traceback": [
"Error trying to display an error."
]
}
],
"source": [
"func = eval(get_compute_function(graph, proc, mock_machine()))\n",
"\n",
"func(psp)"
]
}
],

View File

@ -14,7 +14,7 @@ import QEDbase.process
export FlatMatrix
export GenericQEDProcess, isphysical
export QEDProcess, isphysical
export AbstractTreeLevelFeynmanDiagram, FeynmanVertex, FeynmanDiagram
export external_particles, virtual_particles, process, generate_DAG

View File

@ -682,7 +682,7 @@ function Base.iterate(iter::FeynmanDiagramIterator{E,U,T,M}, ::Nothing) where {E
return (f, nothing)
end
function feynman_diagrams(proc::PROC) where {PROC<:GenericQEDProcess}
function feynman_diagrams(proc::PROC) where {PROC<:QEDProcess}
return feynman_diagrams(incoming_particles(proc), outgoing_particles(proc))
end
@ -727,7 +727,7 @@ function feynman_diagrams(in_particles::Tuple, out_particles::Tuple)
)
end
function virtual_particles(proc::GenericQEDProcess)
function virtual_particles(proc::QEDProcess)
if !isempty(proc.virtual_particles_cache)
return proc.virtual_particles_cache
end

View File

@ -5,12 +5,12 @@ end
function _assert_particle_type_tuple(t::Any)
throw(
InvalidInputError(
"invalid input, provide a tuple of AbstractParticleTypes to construct a GenericQEDProcess",
"invalid input, provide a tuple of AbstractParticleTypes to construct a QEDProcess",
),
)
end
mutable struct GenericQEDProcess{INT,OUTT,INSP,OUTSP} <: AbstractProcessDefinition where {
mutable struct QEDProcess{INT,OUTT,INSP,OUTSP} <: AbstractProcessDefinition where {
INT<:Tuple,OUTT<:Tuple,INSP<:Tuple,OUTSP<:Tuple
}
incoming_particles::INT
@ -21,7 +21,7 @@ mutable struct GenericQEDProcess{INT,OUTT,INSP,OUTSP} <: AbstractProcessDefiniti
virtual_particles_cache::Vector
function GenericQEDProcess(
function QEDProcess(
in_particles::INT, out_particles::OUTT, in_sp::INSP, out_sp::OUTSP
) where {INT<:Tuple,OUTT<:Tuple,INSP<:Tuple,OUTSP<:Tuple}
_assert_particle_type_tuple(in_particles)
@ -31,12 +31,12 @@ mutable struct GenericQEDProcess{INT,OUTT,INSP,OUTSP} <: AbstractProcessDefiniti
end
"""
GenericQEDProcess(in_ph::Int, out_ph::Int, in_el::Int, out_el::Int, in_po::Int, out_po::Int)
QEDProcess(in_ph::Int, out_ph::Int, in_el::Int, out_el::Int, in_po::Int, out_po::Int)
Convenience constructor from numbers of input/output photons, electrons and positrons.
Uses `AllSpin()` and `AllPol()` for every particle's spin/pol by default.
"""
function GenericQEDProcess(
function QEDProcess(
in_ph::Int, out_ph::Int, in_el::Int, out_el::Int, in_po::Int, out_po::Int
)
in_p = ntuple(i -> if i <= in_ph
@ -55,15 +55,12 @@ mutable struct GenericQEDProcess{INT,OUTT,INSP,OUTSP} <: AbstractProcessDefiniti
end, out_ph + out_el + out_po)
in_sp = tuple([i <= in_ph ? AllPol() : AllSpin() for i in 1:length(in_p)]...)
out_sp = tuple([i <= out_ph ? AllPol() : AllSpin() for i in 1:length(out_p)]...)
return GenericQEDProcess(in_p, out_p, in_sp, out_sp)
return QEDProcess(in_p, out_p, in_sp, out_sp)
end
end
function spin_or_pol(
process::GenericQEDProcess,
dir::ParticleDirection,
species::AbstractParticleType,
n::Int,
process::QEDProcess, dir::ParticleDirection, species::AbstractParticleType, n::Int
)
i = 0
c = n
@ -94,14 +91,14 @@ function spin_or_pol(
end
end
function QEDprocesses.incoming_particles(proc::GenericQEDProcess{INT,OUTT}) where {INT,OUTT}
function QEDprocesses.incoming_particles(proc::QEDProcess{INT,OUTT}) where {INT,OUTT}
return proc.incoming_particles
end
function QEDprocesses.outgoing_particles(proc::GenericQEDProcess{INT,OUTT}) where {INT,OUTT}
function QEDprocesses.outgoing_particles(proc::QEDProcess{INT,OUTT}) where {INT,OUTT}
return proc.outgoing_particles
end
function isphysical(proc::GenericQEDProcess)
function isphysical(proc::QEDProcess)
return (
number_particles(proc, Incoming(), Electron()) +
number_particles(proc, Outgoing(), Positron()) ==
@ -110,6 +107,6 @@ function isphysical(proc::GenericQEDProcess)
) && number_particles(proc, Incoming()) + number_particles(proc, Outgoing()) >= 2
end
function matrix_element(proc::GenericQEDProcess, psp::PhaseSpacePoint)
function matrix_element(proc::QEDProcess, psp::PhaseSpacePoint)
return nothing
end

View File

@ -16,6 +16,9 @@ end
# import compute so we don't have to repeat it all the time
import MetagraphOptimization: compute, compute_effort, children
const e = sqrt(4π / 137)
_vertex() = -1im * e * gamma()
compute_effort(::ComputeTask_BaseState) = 0
compute_effort(::ComputeTask_Propagator) = 0
compute_effort(::ComputeTask_Pair) = 0
@ -42,8 +45,12 @@ end
@inline function compute(
::ComputeTask_BaseState, input::BaseStateInput{PS,SPIN_POL}
) where {PS,SPIN_POL}
species = particle_species(input.particle)
if is_outgoing(input.particle)
species = invert(species)
end
return Propagated( # "propagated" because it goes directly into the next pair
input.particle,
species,
QEDbase.base_state(
particle_species(input.particle),
particle_direction(input.particle),
@ -84,6 +91,11 @@ struct Unpropagated{PARTICLE_T<:AbstractParticleType,VALUE_T}
value::VALUE_T
end
import Base.+
function +(a::Unpropagated{P,V}, b::Unpropagated{P,V}) where {P,V}
return Unpropagated(a.particle, a.value + b.value)
end
struct Propagated{PARTICLE_T<:AbstractParticleType,VALUE_T}
particle::PARTICLE_T
value::VALUE_T
@ -93,33 +105,33 @@ end
@inline function compute(
::ComputeTask_Pair, electron::Propagated{Electron,V1}, positron::Propagated{Positron,V2}
) where {V1,V2}
return Unpropagated(Photon(), positron.value * electron.value) # fermion - antifermion -> photon
return Unpropagated(Photon(), positron.value * _vertex() * electron.value) # fermion - antifermion -> photon
end
@inline function compute(
::ComputeTask_Pair, positron::Propagated{Positron,V1}, electron::Propagated{Electron,V2}
) where {V1,V2}
return Unpropagated(Photon(), positron.value * electron.value) # antifermion - fermion -> photon
return Unpropagated(Photon(), positron.value * _vertex() * electron.value) # antifermion - fermion -> photon
end
@inline function compute(
::ComputeTask_Pair, photon::Propagated{Photon,V1}, fermion::Propagated{F,V2}
) where {F<:FermionLike,V1,V2}
return Unpropagated(invert(fermion.particle), fermion.value * photon.value) # (anti-)fermion - photon -> (anti-)fermion
return Unpropagated(fermion.particle, photon.value * _vertex() * fermion.value) # (anti-)fermion - photon -> (anti-)fermion
end
@inline function compute(
::ComputeTask_Pair, fermion::Propagated{F,V2}, photon::Propagated{Photon,V1}
) where {F<:FermionLike,V1,V2}
return Unpropagated(invert(fermion.particle), fermion.value * photon.value) # photon - (anti-)fermion -> (anti-)fermion
return Unpropagated(fermion.particle, photon.value * _vertex() * fermion.value) # photon - (anti-)fermion -> (anti-)fermion
end
@inline function compute(
::ComputeTask_PropagatePairs, left::PROP_V, right::Unpropagated{P,VAL}
) where {PROP_V,P<:AbstractParticleType,VAL}
return Propagated(right.particle, right.value * left.value)
return Propagated(right.particle, left * right.value)
end
@inline function compute(
::ComputeTask_PropagatePairs, left::Unpropagated{P,VAL}, right::PROP_V
) where {PROP_V,P<:AbstractParticleType,VAL}
return Propagated(left.particle, left.value * right.value)
return Propagated(left.particle, right * left.value)
end
@inline function compute(
@ -128,7 +140,7 @@ end
electron::Propagated{Electron,V2},
positron::Propagated{Positron,V3},
) where {V1,V2,V3}
return positron.value * photon.value * electron.input
return positron.value * _vertex() * photon.value * electron.value
end
@inline function compute(
c::ComputeTask_Triple,

View File

@ -70,7 +70,7 @@ function MetagraphOptimization.input_expr(
sp_str = _construction_string(spin_pol)
return Meta.parse(
"BaseStateInput(
"FeynmanDiagramGenerator.BaseStateInput(
ParticleStateful($dir_str, $species_str, momentum($psp_symbol, $dir_str, $species_str, $index)),
$sp_str,
)",
@ -80,10 +80,10 @@ function MetagraphOptimization.input_expr(
index = parse(Int, name[4:end]) # get index of the virtual particle in the process
vp = virtual_particles(proc)[index]
return Meta.parse("PropagatorInput(
VirtualParticle(
return Meta.parse("FeynmanDiagramGenerator.PropagatorInput(
FeynmanDiagramGenerator.VirtualParticle(
process($psp_symbol),
$(_species_str(particle_species(vp))),
$(_construction_string(particle_species(vp))),
$(vp.in_particle_contributions),
$(vp.out_particle_contributions)
),
@ -95,6 +95,7 @@ function MetagraphOptimization.input_expr(
end
function MetagraphOptimization.input_type(p::AbstractProcessDefinition)
return Any
in_t = QEDcore._assemble_tuple_type(incoming_particles(p), Incoming(), SFourMomentum)
out_t = QEDcore._assemble_tuple_type(outgoing_particles(p), Outgoing(), SFourMomentum)
return PhaseSpacePoint{
@ -274,7 +275,7 @@ function _make_node_name(
return node_name
end
function generate_DAG(proc::GenericQEDProcess)
function generate_DAG(proc::QEDProcess)
external_particles = _pseudo_virtual_particles(proc) # external particles that will be input to base_state tasks
particles = virtual_particles(proc) # virtual particles that will be input to propagator tasks
pairs = sort(particle_pairs(particles)) # pairs to generate the pair tasks