Skip to main content

cross_sections_at_energy

Function cross_sections_at_energy 

Source
pub fn cross_sections_at_energy(
    data: &ResonanceData,
    energy_ev: f64,
) -> CrossSections
Expand description

Compute cross-sections at a single energy.

Dispatches each resonance range to the appropriate formalism-specific calculator (SLBW, MLBW, Reich-Moore, R-Matrix Limited, URR) based on the formalism stored in that range. See the module-level table for the full dispatch map.

Adjacent ranges that share a boundary energy use half-open intervals [e_low, e_high) so the boundary point is counted exactly once (ENDF-6 §2 convention).

Shares the same precompute+evaluate pipeline as cross_sections_on_grid — both entry points call the same (private) precompute_range_data and evaluate_precomputed_range helpers, so there is exactly one dispatch table per formalism in the codebase. The difference is that this entry point does not store precomputed plans in an outer Vec (unnecessary when only one energy is evaluated), and it skips the precompute entirely for ranges whose energy interval excludes energy_ev. Per-call overhead is therefore close to — though not exactly — the pre-consolidation per-point path; a small residual cost remains because each matching range is wrapped in a PrecomputedRangeData before evaluation. Measured A.1 LM+grouped walltime on real VENUS Hf 120 min data: 1.37 s (pre-consolidation) → 1.42 s (this path), ≈ 3.6 % overhead.

§Arguments

  • data — Parsed resonance parameters from ENDF.
  • energy_ev — Neutron energy in eV (lab frame).

§Returns

Cross-sections in barns.

§Panics

Panics if energy_ev is non-finite or non-positive. The leaf SLBW / RML / URR routines already enforce this precondition in release builds; hoisting the same assert to the top-level pub fn keeps the public contract symmetric so direct Rust callers cannot bypass validation by hitting a range that gates entry on a finite-only check (e.g. a pure-RM range with no SLBW/URR/RML leaf would otherwise silently return zeros when handed NaN).