Skip to main content

sample_maxwell_boltzmann

Function sample_maxwell_boltzmann 

Source
pub fn sample_maxwell_boltzmann(
    rng: &mut Lcg,
    mass: f64,
    temp: f64,
    kb: f64,
) -> [f64; 3]
Expand description

Sample a 3-D velocity vector from the Maxwell–Boltzmann distribution.

Each velocity component is drawn from N(0, sqrt(k_B T / m)).

§Arguments

  • mass – particle mass
  • temp – temperature in Kelvin
  • kb – Boltzmann constant (use 1.380649e-23 for SI units)