289 lines
9.4 KiB
Plaintext
289 lines
9.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"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/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/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"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"using Revise\n",
|
|
"using FeynmanDiagramGenerator"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"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": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"WARNING: both QEDcore and QEDbase export \"mul\"; uses of it in module FeynmanDiagramGenerator must be qualified\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"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",
|
|
"end\n",
|
|
"all_particles = sort([all_particles...])\n",
|
|
"display(all_particles)\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"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": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"pairs = sort(FeynmanDiagramGenerator.particle_pairs(all_particles))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"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": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"triples = FeynmanDiagramGenerator.total_particle_triples(all_particles)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"s: 6, should be: 6\n",
|
|
"number of triples: 6\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"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": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"function n(vp::VirtualParticle)\n",
|
|
" if !haskey(pairs, vp)\n",
|
|
" return 1\n",
|
|
" end\n",
|
|
" s = 0\n",
|
|
" for (l, r) in pairs[vp]\n",
|
|
" s += n(l) * n(r)\n",
|
|
" end\n",
|
|
" return s\n",
|
|
"end\n",
|
|
"\n",
|
|
"s = 0\n",
|
|
"for (ph, e, p) in triples\n",
|
|
" s += n(ph) * n(e) * n(p)\n",
|
|
"end\n",
|
|
"\n",
|
|
"println(\"s: $s, should be: $(length(feynman_diagrams(proc)))\")\n",
|
|
"println(\"number of triples: $(length(triples))\")\n",
|
|
"\n",
|
|
"sort(triples)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"Graph:\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"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"graph = generate_DAG(proc)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"mock_machine (generic function with 1 method)"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"using MetagraphOptimization\n",
|
|
"using UUIDs\n",
|
|
"\n",
|
|
"function mock_machine()\n",
|
|
" return Machine(\n",
|
|
" [\n",
|
|
" MetagraphOptimization.NumaNode(\n",
|
|
" 0,\n",
|
|
" 1,\n",
|
|
" MetagraphOptimization.default_strategy(MetagraphOptimization.NumaNode),\n",
|
|
" -1.0,\n",
|
|
" UUIDs.uuid1(),\n",
|
|
" ),\n",
|
|
" ],\n",
|
|
" [-1.0;;],\n",
|
|
" )\n",
|
|
"end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"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(\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)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Julia 1.10.4",
|
|
"language": "julia",
|
|
"name": "julia-1.10"
|
|
},
|
|
"language_info": {
|
|
"file_extension": ".jl",
|
|
"mimetype": "application/julia",
|
|
"name": "julia",
|
|
"version": "1.10.4"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|