gibuu is hosted by Hepforge, IPPP Durham
GiBUU

## /randomMaxwell [ Modules ]

[ Top ] [ Modules ]

NAME

module randomMaxwell

PURPOSE

generate momentum for massive particles according a relativistic Maxwell distribution.

Algorithm taken from M. Swisdak, Phys.Plasmas 20 (2013) 062110, http://inspirehep.net/record/1235671

## randomMaxwell/funk [ Functions ]

[ Top ] [ randomMaxwell ] [ Functions ]

NAME

real function funk(p)

PURPOSE

distribution function to sample from

it is indeed p^2*exp(-sqrt(m^2+p^2)/T), but the momentum is scaled to the mass. In addition, the function is transformed to sample the kinetic energy, exp(-E/T) = exp(-m/T)*exp(-(E-m)/T), and then avoiding numerical problems by rewriting (E-m)=(E-m)(E+m)/(E+m)=(E^2-m^2)/(E+m)=p^2/(E+m)

we have to set it to zero for p<0!

## randomMaxwell/funkZero [ Functions ]

[ Top ] [ randomMaxwell ] [ Functions ]

NAME

real function funkZero(p)

PURPOSE

internal function for finding zeros

due to our root findin algorithm, we can rely on p>0

## randomMaxwell/findLo [ Functions ]

[ Top ] [ randomMaxwell ] [ Functions ]

NAME

real function findLo(p)

PURPOSE

find the left solution funk(pLo)*exp(1) = funk(pM)

## randomMaxwell/findHi [ Functions ]

[ Top ] [ randomMaxwell ] [ Functions ]

NAME

real function findHi(p)

PURPOSE

find the right solution funk(pHi)*exp(1) = funk(pM)

## randomMaxwell/initMaxwell [ Subroutines ]

[ Top ] [ randomMaxwell ] [ Subroutines ]

NAME

subroutine initMaxwell(mass,temp)

PURPOSE

initialize the random number generator with given mass and temperature

## randomMaxwell/rnMaxwell [ Subroutines ]

[ Top ] [ randomMaxwell ] [ Subroutines ]

NAME

real function rnMaxwell()

PURPOSE

return a random number according the relativistic Maxwell distribution, which has been initialized with a mass and a temperature