pub fn doppler_broaden(
energies: &[f64],
cross_sections: &[f64],
params: &DopplerParams,
) -> Result<Vec<f64>, DopplerError>Expand description
Apply FGM Doppler broadening to cross-section data.
The cross-sections are broadened in velocity space using the exact Free Gas Model integral from SAMMY manual Eq. III B1.7 (w²-weighted integrand; see the module docs).
§Edge behavior
Within ~6u (in velocity, u = √(k_B·T/AWR)) of either end of the grid,
the convolution depends on σ beyond the supplied grid, which is
extrapolated by the 1/v law — exact for physical 1/v-like tails; a
constant σ deviates by the extrapolation mismatch (≲ u/v relative) at
the outermost points. Edge points whose window is both truncated by
the grid AND under-resolved (fewer than 3 nodes inside the 6u window)
are returned unbroadened, matching SAMMY (fgm/mfgm1.f90: “IF too few
points, do not broaden”); interior under-resolved points broaden
normally (the kernel degenerates smoothly toward a delta).
§Arguments
energies— Energy grid in eV. Every entry must satisfyis_finite() && > 0.0, and the grid must be strictly ascending (duplicates are rejected). The contract is enforced at the public boundary byvalidate_doppler_grid.cross_sections— Unbroadened cross-sections in barns at each energy point.params— Doppler broadening parameters (temperature and AWR).
§Returns
Doppler-broadened cross-sections in barns on the same energy grid.
§Errors
DopplerError::LengthMismatchifenergies.len() != cross_sections.len().DopplerError::InvalidEnergyif any energy is non-finite or ≤ 0.DopplerError::UnsortedEnergiesif the grid is not strictly ascending.
§Algorithm
- Convert energy grid to velocity space (v = √E).
- Build extended grid including negative velocities for the FGM integral.
- Compute the integrand Y(w) = w² · s(w) on the extended grid.
- For each output velocity, evaluate the Gaussian convolution integral.
- Transform back: σ_D(E) = result / E.