EOD
This commit is contained in:
@ -1,8 +1,15 @@
|
||||
module FeynmanDiagramGenerator
|
||||
|
||||
using QEDbase
|
||||
using QEDprocesses
|
||||
|
||||
import Base.==
|
||||
|
||||
export AbstractTreeLevelFeynmanDiagram, FeynmanVertex
|
||||
export external_particles, virtual_particles, process, vertices
|
||||
|
||||
export Forest
|
||||
|
||||
export Electron, Positron, Muon, AntiMuon, Tauon, AntiTauon, Photon, ZBoson, WNBoson, WPBoson, Higgs
|
||||
export can_interact
|
||||
export QED
|
||||
|
||||
@ -10,9 +17,10 @@ include("trees/trees.jl")
|
||||
include("trees/iterator.jl")
|
||||
include("trees/print.jl")
|
||||
|
||||
include("qft/particles.jl")
|
||||
include("qft/qft.jl")
|
||||
|
||||
include("diagrams/interface.jl")
|
||||
include("diagrams/vertex.jl")
|
||||
include("diagrams/diagrams.jl")
|
||||
include("diagrams/iterator.jl")
|
||||
|
||||
|
30
src/diagrams/QED.jl
Normal file
30
src/diagrams/QED.jl
Normal file
@ -0,0 +1,30 @@
|
||||
using Combinatorics
|
||||
|
||||
import Base.iterate
|
||||
|
||||
struct LabelledPlaneTreeIterator
|
||||
n::Int64
|
||||
end
|
||||
|
||||
struct LabelledPlaneTreeIteratorState
|
||||
partition_state::Vector{Int64}
|
||||
distribution_state::Vector{Int64}
|
||||
end
|
||||
|
||||
function plane_trees(n::Int64)
|
||||
return LabelledPlaneTreeIterator(n)
|
||||
end
|
||||
|
||||
function iterate(lpt::LabelledPlaneTreeIterator)
|
||||
return ()
|
||||
end
|
||||
|
||||
function iterate(lpt::LabelledPlaneTreeIterator, state)
|
||||
for p in ps
|
||||
for mp in multiset_permutations(p, n)
|
||||
println(mp)
|
||||
i += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
64
src/diagrams/interface.jl
Normal file
64
src/diagrams/interface.jl
Normal file
@ -0,0 +1,64 @@
|
||||
"""
|
||||
AbstractTreeLevelFeynmanDiagram
|
||||
|
||||
Abstract base type for FeynmanDiagrams. Must implement the functions
|
||||
|
||||
```julia
|
||||
process(::AbstractTreeLevelFeynmanDiagram)::QEDprocesses.AbstractProcessDefinition
|
||||
virtual_particles(::AbstractTreeLevelFeynmanDiagram)::NTuple{N, Tuple{QEDbase.AbstractParticleType, BitArray}}
|
||||
vertices(::AbstractTreeLevelFeynmanDiagram)::NTuple{N, Tuple{VertexType, N1, N2}}
|
||||
```
|
||||
|
||||
By using the `AbstractProcessDefinition` interface, the function [`external_particles`](@ref) is automatically provided.
|
||||
|
||||
For more information on what the interface functions should do, see their documentation: [`process`](@ref), [`virtual_particles`](@ref), [`vertices`](@ref)
|
||||
"""
|
||||
abstract type AbstractTreeLevelFeynmanDiagram end
|
||||
|
||||
"""
|
||||
process(::AbstractTreeLevelFeynmanDiagram)::QEDprocesses.AbstractProcessDefinition
|
||||
|
||||
Interface function that must be implemented for an instance of [`AbstractTreeLevelFeynmanDiagram`](@ref).
|
||||
|
||||
Return the specific `QEDprocesses.AbstractProcessDefinition` which the given diagram is for.
|
||||
"""
|
||||
function process end
|
||||
|
||||
"""
|
||||
virtual_particles(::AbstractTreeLevelFeynmanDiagram)::NTuple{N, Tuple{QEDbase.AbstractParticleType, BitArray}}
|
||||
|
||||
Interface function that must be implemented for an instance of [`AbstractTreeLevelFeynmanDiagram`](@ref).
|
||||
|
||||
Return an `NTuple` with N elements, where N is the number of virtual particles in this diagram. For tree-level Feynman diagrams, \$N = k - 3\$, where \$k\$ is the number of external particles.
|
||||
The elements of the `NTuple` are themselves `Tuple`s, containing for each virtual particle its `QEDbase.AbstractParticleType` and a `BitArray` (`Vector{Boolean}`) of length \$k\$, indicating
|
||||
with a `1` that an external particle's momentum contributes to the virtual particle's momentum, and a `0` otherwise. Outgoing particles will contribute their momentum negatively.
|
||||
From this definition follows that a particles' `BitArray` is equivalent to the inverse `BitArray`, i.e., a `BitArray` where every bit is negated.
|
||||
|
||||
Example: Consider the Compton scattering process \$e^- + \\gamma \\to e^- + \\gamma\$ with the diagram where the incoming electron interacts with the incoming photon first.
|
||||
For this diagram there is exactly one virtual particle, which is an electron. This electron's momentum can be represented as the sum of the two incoming particles' momenta, or
|
||||
that of the two outgoing particles. In the second possible diagram, where the incoming electron interacts with the outgoing photon first, the virtual particle is still an electron
|
||||
but its momentum is the sum of the momenta of the incoming electron and the outgoing photon, or, equivalently, the outgoing electron and the incoming photon.
|
||||
|
||||
!!! note
|
||||
The return value of this function must be stable between calls on the same diagram since [`vertices`](@ref) relies on the order of values in this return value.
|
||||
"""
|
||||
function virtual_particles end
|
||||
|
||||
"""
|
||||
external_particles(diagram::AbstractTreeLevelFeynmanDiagram)
|
||||
|
||||
Return a tuple of the incoming and outgoing particles (`QEDbase.AbstractParticleType`) of the diagram.
|
||||
"""
|
||||
function external_particles(diagram::AbstractTreeLevelFeynmanDiagram)
|
||||
return (incoming_particles(process(diagram)), outgoing_particles(process(diagram)))
|
||||
end
|
||||
|
||||
"""
|
||||
vertices(::AbstractTreeLevelFeynmanDiagram)::NTuple{N, VertexType}
|
||||
|
||||
Interface function that must be implemented for an instance of [`AbstractTreeLevelFeynmanDiagram`](@ref).
|
||||
|
||||
Return an `NTuple` with N elements, where N is the number of vertices in this diagram. For tree-level Feynman diagrams, \$N = k - 2\$, where \$k\$ is the number of external particles.
|
||||
The elements of the `NTuple` are instances of [`AbstractFeynmanVertex`](@ref). If necessary, each of these can indicate its position in the diagram.
|
||||
"""
|
||||
function vertices end
|
25
src/diagrams/vertex.jl
Normal file
25
src/diagrams/vertex.jl
Normal file
@ -0,0 +1,25 @@
|
||||
abstract type AbstractFeynmanVertex end
|
||||
|
||||
struct QEDFeynmanVertex <: AbstractFeynmanVertex end
|
||||
|
||||
#=
|
||||
"""
|
||||
FeynmanVertex
|
||||
|
||||
Vertex of a specific [`AbstractTreeLevelFeynmanDiagram`](@ref).
|
||||
"""
|
||||
struct FeynmanVertex{P1,P2,P3,N} where {N,P1<:AbstractParticleType,P2<:AbstractParticleType,P3<:AbstractParticleType}
|
||||
p1::BitArray{N}
|
||||
p2::BitArray{N}
|
||||
p3::BitArray{N}
|
||||
end
|
||||
|
||||
# convenience functions for equivalence of FeynmanVertex types
|
||||
_vtype_isequal(v1::Type{FeynmanVertex}, v2::Type{FeynmanVertex}) = false
|
||||
_vtype_isequal(v1::Type{FeynmanVertex{P1,P2,P3,N}}, v2::Type{FeynmanVertex{P1,P2,P3,N}}) where {N,P1,P2,P3} = true
|
||||
_vtype_isequal(v1::Type{FeynmanVertex{P1,P2,P3,N}}, v2::Type{FeynmanVertex{P1,P3,P2,N}}) where {N,P1,P2,P3} = true
|
||||
_vtype_isequal(v1::Type{FeynmanVertex{P1,P2,P3,N}}, v2::Type{FeynmanVertex{P2,P1,P3,N}}) where {N,P1,P2,P3} = true
|
||||
_vtype_isequal(v1::Type{FeynmanVertex{P1,P2,P3,N}}, v2::Type{FeynmanVertex{P2,P3,P1,N}}) where {N,P1,P2,P3} = true
|
||||
_vtype_isequal(v1::Type{FeynmanVertex{P1,P2,P3,N}}, v2::Type{FeynmanVertex{P3,P1,P2,N}}) where {N,P1,P2,P3} = true
|
||||
_vtype_isequal(v1::Type{FeynmanVertex{P1,P2,P3,N}}, v2::Type{FeynmanVertex{P3,P2,P1,N}}) where {N,P1,P2,P3} = true
|
||||
=#
|
@ -1,21 +0,0 @@
|
||||
|
||||
abstract type AbstractParticle end
|
||||
|
||||
abstract type Fermion <: AbstractParticle end
|
||||
abstract type AntiFermion <: AbstractParticle end
|
||||
abstract type Boson <: AbstractParticle end
|
||||
|
||||
struct Electron <: Fermion end
|
||||
struct Positron <: AntiFermion end
|
||||
struct Muon <: Fermion end
|
||||
struct AntiMuon <: AntiFermion end
|
||||
struct Tauon <: Fermion end
|
||||
struct AntiTauon <: AntiFermion end
|
||||
|
||||
struct Photon <: Boson end
|
||||
struct ZBoson <: Boson end
|
||||
struct WNBoson <: Boson end
|
||||
struct WPBoson <: Boson end
|
||||
struct Higgs <: Boson end
|
||||
|
||||
|
Reference in New Issue
Block a user