QEDevents
Documentation for QEDevents.
QEDevents.MaxwellBoltzmann
QEDevents.MaxwellBoltzmannParticle
QEDevents.MultiParticleDistribution
QEDevents.MultiParticleVariate
QEDevents.ParticleLikeVariate
QEDevents.ParticleSampleable
QEDevents.ProcessLikeVariate
QEDevents.ScatteringProcessDistribution
QEDevents.SingleParticleDistribution
QEDevents.SingleParticleVariate
QEDevents._assert_valid_input
QEDevents._assert_valid_input_type
QEDevents._assert_valid_input_type
QEDevents._assert_valid_input_type
QEDevents._assert_valid_input_type
QEDevents._momentum_type
QEDevents._particle
QEDevents._particle_direction
QEDevents._particle_directions
QEDevents._particles
QEDevents._post_processing
QEDevents._randmom
QEDevents._weight
QEDevents._weight
QEDevents.is_exact
QEDevents.max_weight
QEDevents.weight
QEDevents.MaxwellBoltzmann
— TypeMaxwellBoltzmann(scale::Real)
The Maxwell-Boltzmann distribution with scale parameter a
has the probability density function
\[f(x,a) = \sqrt{\frac{2}{\pi}}\frac{x^2}{a^3}\exp\left(\frac{-x^2}{2a^2}\right)\]
The Maxwell-Boltzmann distribution is related to the Chi
distribution via the property $X\sim \operatorname{MaxwellBoltzmann}(a=1)$, then $X\sim\chi(\mathrm{dof}=3)$.
External links
QEDevents.MaxwellBoltzmannParticle
— TypeMaxwellBoltzmannParticle( dir::ParticleDirection, part::AbstractParticleType, temperature::Real )
The Maxwell-Boltzmann particle distribution is a single-particle distribution, where the spatial components of the four-momentum are normally distributed with localion $\mu = 0$ and variance $\sigma = m k_B T$ ($m$ is the particle's mass, $k_B$ is the Boltzmann constant, and $T$ is the temperature). The three-magnitude $\varrho = \sqrt{p_x^2 + p_y^2 + p_z^2}$ of the generated particle-statefuls is MaxwellBoltzmann
distributed.
External links
QEDevents.MultiParticleDistribution
— TypeMultiParticleDistribution
Base type for sample drawing from multiple particle distributions. The following interface functions should be implemented:
QEDevents.MultiParticleVariate
— TypeMultiParticleVariate
Auxiliary type to represent multiple particles in the context of distributions and sampler. A sample from this variate form has the type Vector{ParticleStateful}
.
QEDevents.ParticleLikeVariate
— TypeParticleLikeVariate{N<:Int}
Auxiliary type to represent the number of axes in the space of all particles:
N == 0
single particle variateN == 1
multiple particle variate
QEDevents.ParticleSampleable
— TypeParticleSampleable{V<:QEDlikeVariate}
Abstract base type for sampleable particle distributions and sampler in the context of QEDevents.jl
. Here a particle-sampleable is generally a type which has some sort of rand
function to produce random samples for properties of given particles, like four-momentum, spin, polarization, etc..
To implement the particle-sampleable interface, the following functions need to be given:
Base.eltype(s::ParticleSampleable)
: return the innermost type of the samples_weight(s::ParticleSampleable,x)
: return the weight of a given samplex
is_exact(s::ParticleSampleable)
: return wether or not a particle-sampleable is exact
Optionally, one can enhance the calculation of weights by providing
_assert_valid_input_type(s::ParticleSampleable,x)
: assert input has the correct type_assert_valid_input(s::ParticleSampleable,x)
: assert input has correct properties_post_processing(s::ParticleSampleable,x,res)
: apply some postprocesing to the result of_weight
.
See weight
for details. Furthermore, one can provide custom four-momentum types used for the generation of samples by implementing
_momentum_type(s::ParticleSampleable)
: return the momentum type used
For the actual sampling, one must implement
_randmom(d::ParticleSampleable)
: return momenta according tod
Using these interface functions, the following versions rand
function are implemented. However, if in the particular case, there are more sophisticated implementations for the respective version of the rand
function (see below), they can be implemented instead of _randmom
. Nevertheless, in this case, it is recommended for convenience to implement a _randmom
function as well, maybe using the result of rand
.
For SingleParticleVariate
samplers, the single sample version rand
is given:
Distributions.rand(
rng::Random.AbstractRNG,
s::ParticleSampleable{SingleParticleVariate})
which returns a random sample from s
as a ParticleStateful
.
For MultiParticleVariate
samplers, the mutating version of rand
implemented:
Distributions._rand!(
rng::Random.AbstractRNG,
s::ParticleSampleable{MultiParticleVariate},
out::AbstractArray{ParticleStateful})
which also provides implementations of rand
for one or more samples.
For ProcessLikeVariate
distributions, the single sample version of rand
is given:
Distributions.rand(
rng::Random.AbstractRNG,
s::ParticleSampleable{ProcessLikeVariate})
which returns a PhaseSpacePoint
including the respective scattering process, computation model and phase-space definition.
QEDevents.ProcessLikeVariate
— TypeProcessLikeVariate
Auxiliary type to represent distributions and samplers for scattering processes.
A sample from this variate form has the type PhaseSpacePoint
.
QEDevents.ScatteringProcessDistribution
— TypeScatteringProcessDistribution
Base type for sample drawing from scattering process distributions. The following interface functions should be implemented:
QEDbase.process(d::ScatteringProcessDistribution)
QEDbase.model(d::ScatteringProcessDistribution)
QEDbase.phase_space_definition(d::ScatteringProcessDistribution)
QEDevents._randmom(rng::AbstractRNG,d::ScatteringProcessDistribution)
QEDevents.SingleParticleDistribution
— TypeSingleParticleDistribution
Base type for sample drawing from single particle distributions. The following interface functions should be implemented:
QEDevents._particle(d::SingleParticleDistribution)
: return associated particleQEDevents._particle_direction(d::SingleParticleDistribution)
: return associated particle directionQEDevents._randmom(d::SingleParticleDistribution)
: return momentum according tod
QEDevents.SingleParticleVariate
— TypeSingleParticleVariate
Auxiliary type to represent single particles in the context of distributions and sampler. A sample from this variate form has the type ParticleStateful
.
QEDevents._assert_valid_input
— Method_assert_valid_input(s::ParticleSampleable,x)
Throw InvalidInputError
if the input x
is not valid, do nothing otherwise. This function is usually used for checking, if the input has the assumed properties. Type checks are done using multiple dispatch, or _assert_valid_input_type
. The default is doing nothing.
This interface function is optional for subtypes of ParticleSampleable
.
QEDevents._assert_valid_input_type
— Method_assert_valid_input_type(s::ParticleSampleable,x)
Throw InvalidInputError
if the input x
has the wrong type, do nothing otherwise. This function is usually used for complicated types, where the implementation via multiple dispatch is cumbersome. The default is doing nothing.
This interface function is optional for subtypes of ParticleSampleable
.
QEDevents._assert_valid_input_type
— MethodInterface function, which asserts that the given input
is valid.
QEDevents._assert_valid_input_type
— MethodInterface function, which asserts that the given input
is valid.
QEDevents._assert_valid_input_type
— MethodInterface function, which asserts that the given input
is valid.
QEDevents._momentum_type
— Method_momentum_type(s::ParticleSampleable,x)
Return the momentum type used for the generation of samples. The default is SFourMomentum
.
This interface function is optional for subtypes of ParticleSampleable
.
QEDevents._particle
— Function_particle(dist::SingleParticleDistribution)::AbstractParticle
Return the particle associated with the dist
.
Interface function to be implemented for single-particle distributions.
QEDevents._particle_direction
— Function_particle_direction(dist::SingleParticleDistribution)::ParticleDirection
Return the particle-direction of the particle associated with dist
.
Interface function to be implemented for single-particle distributions.
QEDevents._particle_directions
— Function_particle_direction(dist::MultiParticleDistribution)
Return tuple of particle-directions for all particles associated with dist
.
Interface function to be implemented for multi-particle distributions.
QEDevents._particles
— Function_particle(dist::MultiParticleDistribution)
Return tuple of particles associated with the dist
.
Interface function to be implemented for multi-particle distributions.
QEDevents._post_processing
— Method_post_processing(s::ParticleSampleable, x, result)
Return post-processed version of result
. The default does nothing and returns result
.
This interface function is optional for subtypes of ParticleSampleable
.
QEDevents._randmom
— Function_randmom(rng::AbstractRNG,d::ParticleSampleable)
Return random momentum/momenta according to the distribution d
. The momentum type used in the return must be equal to the one returned by _momentum_type
.
The actual return type for _randmom
depends on the variate form.
The _randmom
function must return a single momentum, which type is the same as retured by _momentum_type
For a set of particles, the _randmom
function must return an iterable container of momenta (e.g. a tuple or vector), which length is the same as the number of particles according to the distribution. The element type of this container must be the same as returned by _momentum_type
.
For scattering processes, the _randmom
function must return two iterable containers of momenta, one for the incoming and one for the outgoing particles. The momentum type in both of the containers must be the same as returned by _momentum_type
.
QEDevents._weight
— Function_weight(s::ParticleSampleable, x)
Return the weight associated with the given sample x
according to the particle-sampleable s
. This function must not do input validation. This is done by weight
, which calls _weight
after input validation.
This interface function must be implemented for subtypes of ParticleSampleable
.
QEDevents._weight
— Method_weight(
d::MaxwellBoltzmannParticle{D,P,T}, ps::ParticleStateful{D,P}
) where {D,P,T}
Unsafe weight-function for MaxwellBoltzmannParticle
, which is given by
\[ w(p) = \begin{cases} \frac{1}{4\pi}\sqrt{\frac{2}{\pi}}\frac{\varrho^2}{a^3}\exp\left(\frac{-\varrho^2}{2a^2}\right)\quad &\text{,for } p^2=m^2\\ 0 &\mathrm{elsewhere}. \end{cases} \]
with $\varrho^2 = p_x^2 + p_y^2 + p_z^2$ and $a = \sqrt{m k_B T}$ ($m$ is the particle's mass, $k_B$ is the Boltzmann constant, and $T$ is the temperature).
QEDevents.is_exact
— Functionis_exact(s::ParticleSampleable)
Return whether or not the particle-sampleable s
is exactly representing the distribution given by weight
.
This interface function must be implemented for subtypes of ParticleSampleable
.
QEDevents.max_weight
— Functionmax_weight(::ParticleSampleable)
Interface function, which returns the maximum possible weight for the particle-sampleable.
QEDevents.weight
— Methodweight(d::ParticleSampleable, sample)
Return the weight of the given sample according to the given distribution.
This function automatically performs input validation and post-processing using the respective interface functions. The order of calls is