|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
using Combinatorics
|
|
|
|
|
|
|
|
|
|
import Base.copy
|
|
|
|
|
import Base.hash
|
|
|
|
@ -265,11 +266,12 @@ function add_vertex!(fd::FeynmanDiagram, vertex::FeynmanVertex)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if !can_apply_vertex(get_particles(fd), vertex)
|
|
|
|
|
#@assert false "Can't add vertex $vertex to diagram"
|
|
|
|
|
@assert false "Can't add vertex $vertex to diagram $(get_particles(fd))"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
push!(fd.vertices, Set{FeynmanVertex}())
|
|
|
|
|
push!(fd.vertices[end], vertex)
|
|
|
|
|
|
|
|
|
|
fd.type_ids[vertex.out.particle] += 1
|
|
|
|
|
|
|
|
|
|
return nothing
|
|
|
|
@ -437,12 +439,95 @@ function remove_duplicates(compare_set::Set{FeynmanDiagram})
|
|
|
|
|
return result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
is_compton(fd::FeynmanDiagram)
|
|
|
|
|
|
|
|
|
|
Returns true iff the given feynman diagram is an (empty) diagram of a compton process like ke->k^ne
|
|
|
|
|
"""
|
|
|
|
|
function is_compton(fd::FeynmanDiagram)
|
|
|
|
|
return fd.type_ids[FermionStateful{Incoming, SpinUp}] == 1 &&
|
|
|
|
|
fd.type_ids[FermionStateful{Outgoing, SpinUp}] == 1 &&
|
|
|
|
|
fd.type_ids[PhotonStateful{Incoming, PolX}] == 1 &&
|
|
|
|
|
fd.type_ids[PhotonStateful{Outgoing, PolX}] >= 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
n_photon_compton_diagrams(n::Int)
|
|
|
|
|
|
|
|
|
|
Special case diagram generation for n-Photon Compton processes, i.e., processes of the form ke->k^ne
|
|
|
|
|
"""
|
|
|
|
|
function n_photon_compton_diagram(n::Int)
|
|
|
|
|
inEl = FeynmanParticle(FermionStateful{Incoming, SpinUp}, 1)
|
|
|
|
|
outEl = FeynmanParticle(FermionStateful{Outgoing, SpinUp}, 1)
|
|
|
|
|
|
|
|
|
|
photons = [FeynmanParticle(PhotonStateful{Outgoing, PolX}, i) for i in 1:n]
|
|
|
|
|
push!(photons, FeynmanParticle(PhotonStateful{Incoming, PolX}, 1))
|
|
|
|
|
|
|
|
|
|
perms = permutations([i for i in 1:length(photons)])
|
|
|
|
|
|
|
|
|
|
diagrams = Vector{FeynmanDiagram}()
|
|
|
|
|
for order in perms
|
|
|
|
|
new_diagram = FeynmanDiagram(
|
|
|
|
|
[],
|
|
|
|
|
missing,
|
|
|
|
|
[inEl, outEl, photons...],
|
|
|
|
|
Dict{Type, Int64}(
|
|
|
|
|
FermionStateful{Incoming, SpinUp} => 1,
|
|
|
|
|
FermionStateful{Outgoing, SpinUp} => 1,
|
|
|
|
|
PhotonStateful{Incoming, PolX} => 1,
|
|
|
|
|
PhotonStateful{Outgoing, PolX} => n,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
left_index = 1
|
|
|
|
|
right_index = length(order)
|
|
|
|
|
|
|
|
|
|
iterations = 1
|
|
|
|
|
|
|
|
|
|
while left_index <= right_index
|
|
|
|
|
# left side
|
|
|
|
|
v_left = FeynmanVertex(
|
|
|
|
|
FeynmanParticle(FermionStateful{Incoming, SpinUp}, iterations),
|
|
|
|
|
photons[order[left_index]],
|
|
|
|
|
FeynmanParticle(FermionStateful{Incoming, SpinUp}, iterations + 1),
|
|
|
|
|
)
|
|
|
|
|
left_index += 1
|
|
|
|
|
add_vertex!(new_diagram, v_left)
|
|
|
|
|
|
|
|
|
|
if (left_index > right_index)
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# right side
|
|
|
|
|
v_right = FeynmanVertex(
|
|
|
|
|
FeynmanParticle(FermionStateful{Outgoing, SpinUp}, iterations),
|
|
|
|
|
photons[order[right_index]],
|
|
|
|
|
FeynmanParticle(FermionStateful{Outgoing, SpinUp}, iterations + 1),
|
|
|
|
|
)
|
|
|
|
|
right_index -= 1
|
|
|
|
|
add_vertex!(new_diagram, v_right)
|
|
|
|
|
|
|
|
|
|
iterations += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@assert possible_tie(new_diagram) !== missing
|
|
|
|
|
add_tie!(new_diagram, possible_tie(new_diagram))
|
|
|
|
|
push!(diagrams, new_diagram)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return diagrams
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
gen_diagrams(fd::FeynmanDiagram)
|
|
|
|
|
|
|
|
|
|
From a given feynman diagram in its initial state, e.g. when created through the [`FeynmanDiagram(pd::ProcessDescription)`](@ref) constructor, generate and return all possible [`FeynmanDiagram`](@ref)s that describe that process.
|
|
|
|
|
"""
|
|
|
|
|
function gen_diagrams(fd::FeynmanDiagram)
|
|
|
|
|
if is_compton(fd)
|
|
|
|
|
return n_photon_compton_diagram(fd.type_ids[PhotonStateful{Outgoing, PolX}])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
working = Set{FeynmanDiagram}()
|
|
|
|
|
results = Set{FeynmanDiagram}()
|
|
|
|
|
|
|
|
|
|