From 5f90fe3a9d884c1d6e92da8c09c6dd2d8ff9924e Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 28 Nov 2018 08:35:52 -0600 Subject: [PATCH] Evaluate neutron xs once per reaction in sample_photon_product --- src/physics.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/physics.cpp b/src/physics.cpp index 08d8ce8933..3b5e62ae99 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -551,12 +551,14 @@ void sample_photon_product(int i_nuclide, double E, int* i_rx, int* i_product) // if energy is below threshold for this reaction, skip it if (i_grid < threshold) continue; + // Evaluate neutron cross section + double xs = ((1.0 - f) * rx->xs_[i_temp-1].value[i_grid - threshold] + + f*(rx->xs_[i_temp-1].value[i_grid - threshold + 1])); + for (int j = 0; j < rx->products_.size(); ++j) { if (rx->products_[j].particle_ == ParticleType::photon) { // add to cumulative probability - double yield = (*rx->products_[j].yield_)(E); - prob += ((1.0 - f) * rx->xs_[i_temp-1].value[i_grid - threshold] - + f*(rx->xs_[i_temp-1].value[i_grid - threshold + 1])) * yield; + prob += (*rx->products_[j].yield_)(E) * xs; *i_rx = i; *i_product = j;