-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fermion exchange logic and tests for bhabha scattering (#37)
* Add fermion exchange logic and tests for Bhabha scattering * WIP * Working until n=3, generation still seems broken * WIP * Pass sanity checks * Some beautification * Delete previous generation and exports * Add more docs and refs * Add number of diagrams test * Improve manual and number_of_diagrams docs * Self-review
- Loading branch information
1 parent
dd3c037
commit 3420bde
Showing
20 changed files
with
883 additions
and
867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
# Manual | ||
|
||
TBW | ||
## Usage | ||
|
||
![Virtual Particle Currents](VPC_explanation.svg) | ||
!!! note | ||
This project uses [ComputableDAGs.jl](https://github.com/ComputableDAGs/ComputableDAGs.jl), which uses [RuntimeGeneratedFunctions.jl](https://github.com/SciML/RuntimeGeneratedFunctions.jl). The latter requires an initialization step, so when using this project, make sure to have | ||
```julia | ||
using RuntimeGeneratedFunctions | ||
RuntimeGeneratedFunctions.init(@__MODULE__) | ||
``` | ||
somewhere in the preamble of your code or at the beginning of your REPL session. Otherwise the function generation will not work. | ||
|
||
For a usage example, please refer to the notebooks in the `./notebooks` directory of the repository. | ||
This package currently exports two functions, [`graph`](@ref) and [`number_of_diagrams`](@ref). Both of these take a [`QEDbase.AbstractProcessDefinition`](@extref) as input. `graph` returns a [`ComputableDAGs.DAG`](@extref) representing the computation of the squared matrix element for [`QEDcore.PhaseSpacePoint`](@extref)s. `number_of_diagrams` is a utility function that returns the number of valid tree-level Feynman diagrams for the given process. | ||
|
||
For usage examples, please refer to the examples section of the docs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
relative_sign_pair(p1::VirtualParticle, p2::VirtualParticle) | ||
Returns true if the Pair task combining p1 and p2 into res needs a relative sign in the DAG. | ||
""" | ||
function relative_sign_pair(p1::VirtualParticle, p2::VirtualParticle) | ||
if (p1.species == Photon || p2.species == Photon) | ||
#@info "P [FALS] relative sign of $p1 + $p2 -> $res" | ||
return false | ||
end | ||
|
||
local vec::Vector{OPEN_FERMION_CYCLE_T} | ||
|
||
(l, el) = if p1.species == Electron | ||
_canonical_index(p1) | ||
elseif p2.species == Electron | ||
_canonical_index(p2) | ||
end | ||
(r, po) = if p1.species == Positron | ||
_canonical_index(p1) | ||
elseif p2.species == Positron | ||
_canonical_index(p2) | ||
end | ||
|
||
vec = [p1.open_cycles..., p2.open_cycles..., (el, po)] | ||
|
||
n = _count_closed_cycles(vec) | ||
|
||
return n % 2 == 1 | ||
end | ||
|
||
""" | ||
relative_sign_triple(p2::VirtualParticle, p3::VirtualParticle, p3::VirtualParticle) | ||
Returns true if the Triple task combining electron p1, and positron p2 into a full diagram family needs a relative sign in the DAG. | ||
""" | ||
function relative_sign_triple(p1::VirtualParticle, p2::VirtualParticle, p3::VirtualParticle) | ||
# p1 + p2 is the photon | ||
n1 = relative_sign_pair(p1, p2) | ||
|
||
new_cycle = (_canonical_index(p1)[2], _canonical_index(p2)[2]) | ||
|
||
res = VirtualParticle( | ||
p1.proc, | ||
Photon(), | ||
(_contributions(p1) + _contributions(p2))..., | ||
sort( | ||
reduce_cycles( | ||
OPEN_FERMION_CYCLE_T[p1.open_cycles..., p2.open_cycles..., new_cycle] | ||
), | ||
), | ||
) | ||
|
||
# cycles closed? | ||
closed_cycle_count = _count_closed_cycles( | ||
OPEN_FERMION_CYCLE_T[p3.open_cycles..., res.open_cycles...] | ||
) | ||
|
||
n2 = closed_cycle_count % 2 == 1 | ||
|
||
return n1 != n2 # xor | ||
end |
Oops, something went wrong.