WIP
This commit is contained in:
parent
f1fb2293ef
commit
17e180dd26
@ -5,6 +5,8 @@ using Reexport
|
|||||||
@reexport using QEDcore
|
@reexport using QEDcore
|
||||||
@reexport using QEDprocesses
|
@reexport using QEDprocesses
|
||||||
|
|
||||||
|
using MetagraphOptimization
|
||||||
|
|
||||||
include("QEDprocesses_patch.jl")
|
include("QEDprocesses_patch.jl")
|
||||||
|
|
||||||
import Base.==
|
import Base.==
|
||||||
@ -45,4 +47,7 @@ include("diagrams/diagrams.jl")
|
|||||||
include("diagrams/iterator.jl")
|
include("diagrams/iterator.jl")
|
||||||
include("diagrams/QED.jl")
|
include("diagrams/QED.jl")
|
||||||
|
|
||||||
|
include("metagraph_impl/compute.jl")
|
||||||
|
include("metagraph_impl/generation.jl")
|
||||||
|
|
||||||
end # module FeynmanDiagramGenerator
|
end # module FeynmanDiagramGenerator
|
||||||
|
@ -1,38 +1,2 @@
|
|||||||
# patch QEDprocesses
|
# patch QEDprocesses
|
||||||
# see issue https://github.com/QEDjl-project/QEDprocesses.jl/issues/77
|
# see issue https://github.com/QEDjl-project/QEDprocesses.jl/issues/77
|
||||||
|
|
||||||
|
|
||||||
function _number_particles_helper(
|
|
||||||
particles::Tuple{}, species::SPECIES, n::Val{N}
|
|
||||||
) where {SPECIES,N}
|
|
||||||
return N
|
|
||||||
end
|
|
||||||
|
|
||||||
function _number_particles_helper(
|
|
||||||
particles::Tuple{SPECIES,Vararg}, species::SPECIES2, n::Val{N}
|
|
||||||
) where {SPECIES,SPECIES2,N}
|
|
||||||
return _number_particles_helper(particles[2:end], species, Val(N))
|
|
||||||
end
|
|
||||||
|
|
||||||
function _number_particles_helper(
|
|
||||||
particles::Tuple{SPECIES,Vararg}, species::SPECIES, n::Val{N}
|
|
||||||
) where {SPECIES,N}
|
|
||||||
return _number_particles_helper(particles[2:end], species, Val(N + 1))
|
|
||||||
end
|
|
||||||
|
|
||||||
@inline function QEDprocesses.number_particles(
|
|
||||||
proc_def::AbstractProcessDefinition, dir::DIR, species::PT
|
|
||||||
) where {DIR<:ParticleDirection,PT<:AbstractParticleType}
|
|
||||||
return _number_particles_helper(particles(proc_def, dir), species, Val(0))
|
|
||||||
end
|
|
||||||
|
|
||||||
"""
|
|
||||||
number_particles(proc_def::AbstractProcessDefinition, particle::AbstractParticleStateful)
|
|
||||||
|
|
||||||
Return the number of particles of the given particle's direction and species in the given process definition.
|
|
||||||
"""
|
|
||||||
@inline function QEDbase.number_particles(
|
|
||||||
proc_def::AbstractProcessDefinition, ps::AbstractParticleStateful
|
|
||||||
)
|
|
||||||
return number_particles(proc_def, particle_direction(ps), particle_species(ps))
|
|
||||||
end
|
|
||||||
|
@ -469,7 +469,6 @@ function virtual_particles(proc::AbstractProcessDefinition, diagram::FeynmanDiag
|
|||||||
return normalize.(result)[1:end-1]
|
return normalize.(result)[1:end-1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate Feynman Diagrams
|
# Generate Feynman Diagrams
|
||||||
#
|
#
|
||||||
|
38
src/metagraph_impl/compute.jl
Normal file
38
src/metagraph_impl/compute.jl
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
struct ComputeTask_BaseState <: AbstractComputeTask end # calculate the base state of an external particle
|
||||||
|
struct ComputeTask_Propagator <: AbstractComputeTask end # calculate the propagator term of a virtual particle
|
||||||
|
struct ComputeTask_Pair <: AbstractComputeTask end # from a pair of virtual particle currents, calculate the product
|
||||||
|
struct ComputeTask_CollectPairs <: AbstractComputeTask end # for a list of virtual particle current pair products and a propagator, sum and propagate
|
||||||
|
struct ComputeTask_Triple <: AbstractComputeTask end # from a triple of virtual particle currents, calculate the diagram result
|
||||||
|
struct ComputeTask_CollectTriples <: AbstractComputeTask end # sum over triples results and
|
||||||
|
|
||||||
|
struct BaseStateInput{PS_T<:AbstractParticleStateful,SPIN_POL_T<:AbstractSpinOrPolarization}
|
||||||
|
particle::PS_T
|
||||||
|
spin_pol::SPIN_POL_T
|
||||||
|
end
|
||||||
|
|
||||||
|
function MetagraphOptimization.compute(::ComputeTask_BaseState, input::BaseStateInput{PS,SPIN_POL}) where {PS,SPIN_POL}
|
||||||
|
return QEDbase.base_state(particle_species(input.particle), particle_direction(input.particle), momentum(input.particle), input.spin_pol)
|
||||||
|
end
|
||||||
|
|
||||||
|
struct PropagatorInput{VP_T<:VirtualParticle,PSP_T<:AbstractPhaseSpacePoint}
|
||||||
|
vp::VP_T
|
||||||
|
psp::PSP_T
|
||||||
|
end
|
||||||
|
|
||||||
|
function MetagraphOptimization.compute(::ComputeTask_Propagator, input::PropagatorInput{VP_T,PSP_T}) where {VP_T,PSP_T}
|
||||||
|
vp_mom = zero(typeof(momentum(input.psp, Incoming(), 1)))
|
||||||
|
for i in eachindex(in_contributions(input.vp))
|
||||||
|
if in_contributions(input.vp)[i]
|
||||||
|
vp_mom += momentum(input.psp, Incoming(), i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for o in eachindex(out_contributions(input.vp))
|
||||||
|
if (out_contributions(input.vp))[o]
|
||||||
|
vp_mom -= momentum(input.psp, Outgoing(), o)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vp_species = particle_species(input.vp)
|
||||||
|
vp_mass = mass(vp_species)
|
||||||
|
return QEDbase.propagator(vp_species, vp_mom)
|
||||||
|
end
|
19
src/metagraph_impl/generation.jl
Normal file
19
src/metagraph_impl/generation.jl
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
function generate_DAG(proc::GenericQEDProcess)
|
||||||
|
# use a set for deduplication
|
||||||
|
particles = Set()
|
||||||
|
for fd in feynman_diagrams(proc)
|
||||||
|
push!(all_particles, virtual_particles(proc, fd)...)
|
||||||
|
end
|
||||||
|
|
||||||
|
# convert to vector
|
||||||
|
particles = [particles...]
|
||||||
|
|
||||||
|
external_particles = _pseudo_virtual_particles(proc)
|
||||||
|
pairs = particle_pairs(particles)
|
||||||
|
triples = total_particle_triples(particles)
|
||||||
|
|
||||||
|
graph = DAG()
|
||||||
|
|
||||||
|
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user