-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 0.2.2
- Loading branch information
Showing
27 changed files
with
1,266 additions
and
198 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
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,32 @@ | ||
######################## | ||
# differential and total cross sections. | ||
# | ||
# This file contains default implementations for differential | ||
# cross sections based on the scattering process interface | ||
######################## | ||
|
||
""" | ||
unsafe_differential_cross_section(phase_space_point::AbstractPhaseSpacePoint) | ||
Return the differential cross section evaluated on a phase space point without checking if the given phase space is physical. | ||
""" | ||
function unsafe_differential_cross_section(phase_space_point::AbstractPhaseSpacePoint) | ||
I = 1 / (4 * _incident_flux(phase_space_point)) | ||
|
||
return I * unsafe_differential_probability(phase_space_point) | ||
end | ||
|
||
""" | ||
differential_cross_section(phase_space_point::PhaseSpacePoint) | ||
If the given phase spaces are physical, return differential cross section evaluated on a phase space point. Zero otherwise. | ||
""" | ||
function differential_cross_section(phase_space_point::AbstractPhaseSpacePoint) | ||
if !_is_in_phasespace(phase_space_point) | ||
# TODO: use the correct type here, i.e. implement a function `eltype` for psp or | ||
# make `momentum_type` an interface function. | ||
return zero(Float64) | ||
end | ||
|
||
return unsafe_differential_cross_section(phase_space_point) | ||
end |
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,42 @@ | ||
############ | ||
# scattering probabilities | ||
# | ||
# This file contains implementations of the scattering probability based on the | ||
# process interface with and without input validation and/or phase space | ||
# constraint. | ||
############ | ||
|
||
# convenience function | ||
# can be overloaded if an analytical version is known | ||
function _matrix_element_square(psp::AbstractPhaseSpacePoint) | ||
mat_el = _matrix_element(psp) | ||
return abs2.(mat_el) | ||
end | ||
|
||
""" | ||
unsafe_differential_probability(phase_space_point::AbstractPhaseSpacePoint) | ||
Return differential probability evaluated on a phase space point without checking if the given phase space(s) are physical. | ||
""" | ||
function unsafe_differential_probability(psp::AbstractPhaseSpacePoint) | ||
matrix_elements_sq = _matrix_element_square(psp) | ||
|
||
normalization = _averaging_norm(psp.proc) | ||
|
||
ps_fac = _phase_space_factor(psp) | ||
|
||
return normalization * sum(matrix_elements_sq) * ps_fac | ||
end | ||
|
||
""" | ||
differential_probability(phase_space_point::AbstractPhaseSpacePoint) | ||
If the given phase spaces are physical, return differential probability evaluated on a phase space point. Zero otherwise. | ||
""" | ||
function differential_probability(phase_space_point::AbstractPhaseSpacePoint) | ||
if !_is_in_phasespace(phase_space_point) | ||
return zero(eltype(momentum(phase_space_point, Incoming(), 1))) | ||
end | ||
|
||
return unsafe_differential_probability(phase_space_point) | ||
end |
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,14 @@ | ||
|
||
############ | ||
# Total cross sections | ||
############ | ||
|
||
""" | ||
total_cross_section(in_psp::AbstractInPhaseSpacePoint) | ||
Return the total cross section for a given [`AbstractInPhaseSpacePoint`](@ref). | ||
""" | ||
function total_cross_section(in_psp::AbstractInPhaseSpacePoint) | ||
I = 1 / (4 * _incident_flux(in_psp)) | ||
return I * _total_probability(in_psp) | ||
end |
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,12 @@ | ||
########### | ||
# Total probability | ||
########### | ||
|
||
""" | ||
total_probability(in_psp::AbstractInPhaseSpacePoint) | ||
Return the total probability of a given [`AbstractInPhaseSpacePoint`](@ref). | ||
""" | ||
function total_probability(in_psp::AbstractInPhaseSpacePoint) | ||
return _total_probability(in_psp) | ||
end |
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
Oops, something went wrong.