@@ -56,8 +56,9 @@ XsData::XsData(bool fissionable, AngleDistributionType scatter_format,
5656 // allocate delayed_nu_fission; [temperature][angle][delay group][in group]
5757 delayed_nu_fission = xt::zeros<double >(shape);
5858
59- // chi_prompt; [temperature][angle][in group][out group]
59+ // chi and chi_prompt; [temperature][angle][in group][out group]
6060 shape = {n_ang, n_g_, n_g_};
61+ chi = xt::zeros<double >(shape);
6162 chi_prompt = xt::zeros<double >(shape);
6263
6364 // chi_delayed; [temperature][angle][delay group][in group][out group]
@@ -133,8 +134,13 @@ void XsData::fission_vector_beta_from_hdf5(
133134 // Normalize chi by summing over the outgoing groups for each incoming angle
134135 temp_chi /= xt::view (xt::sum (temp_chi, {1 }), xt::all (), xt::newaxis ());
135136
137+ // Store chi in chi
138+ chi = xt::view (temp_chi, xt::all (), xt::newaxis (), xt::all ());
139+
136140 // Now every incoming group in prompt_chi and delayed_chi is the normalized
137141 // chi we just made
142+ // TODO: This is incorrect. This makes chi_prompt and chi_delayed identical
143+ // to chi.
138144 chi_prompt = xt::view (temp_chi, xt::all (), xt::newaxis (), xt::all ());
139145 chi_delayed =
140146 xt::view (temp_chi, xt::all (), xt::newaxis (), xt::newaxis (), xt::all ());
@@ -176,20 +182,31 @@ void XsData::fission_vector_beta_from_hdf5(
176182
177183void XsData::fission_vector_no_beta_from_hdf5 (hid_t xsdata_grp, size_t n_ang)
178184{
179- // Data is provided separately as prompt + delayed nu-fission and chi
185+ // If chi is included in the dataset, we should store it!
186+ if (object_exists (xsdata_grp, " chi" )) {
187+ xt::xtensor<double , 2 > temp_chi ({n_ang, n_g_}, 0 .);
188+ read_nd_vector (xsdata_grp, " chi" , temp_chi, true );
189+ // Normalize chi by summing over the outgoing groups for each incoming angle
190+ temp_chi /= xt::view (xt::sum (temp_chi, {1 }), xt::all (), xt::newaxis ());
191+ // Now every incoming group in self.chi is the normalized chi we just made
192+ chi = xt::view (temp_chi, xt::all (), xt::newaxis (), xt::all ());
193+ }
180194
195+ // Data is provided separately as prompt + delayed nu-fission and chi
181196 // Get chi-prompt
182197 xt::xtensor<double , 2 > temp_chi_p ({n_ang, n_g_}, 0 .);
183198 read_nd_vector (xsdata_grp, " chi-prompt" , temp_chi_p, true );
184199
185- // Normalize chi by summing over the outgoing groups for each incoming angle
200+ // Normalize chi-prompt by summing over the outgoing groups for each incoming
201+ // angle
186202 temp_chi_p /= xt::view (xt::sum (temp_chi_p, {1 }), xt::all (), xt::newaxis ());
187203
188204 // Get chi-delayed
189205 xt::xtensor<double , 3 > temp_chi_d ({n_ang, n_dg_, n_g_}, 0 .);
190206 read_nd_vector (xsdata_grp, " chi-delayed" , temp_chi_d, true );
191207
192- // Normalize chi by summing over the outgoing groups for each incoming angle
208+ // Normalize chi-delayed by summing over the outgoing groups for each incoming
209+ // angle
193210 temp_chi_d /=
194211 xt::view (xt::sum (temp_chi_d, {2 }), xt::all (), xt::all (), xt::newaxis ());
195212
@@ -217,6 +234,7 @@ void XsData::fission_vector_no_delayed_from_hdf5(hid_t xsdata_grp, size_t n_ang)
217234 temp_chi /= xt::view (xt::sum (temp_chi, {1 }), xt::all (), xt::newaxis ());
218235
219236 // Now every incoming group in self.chi is the normalized chi we just made
237+ chi = xt::view (temp_chi, xt::all (), xt::newaxis (), xt::all ());
220238 chi_prompt = xt::view (temp_chi, xt::all (), xt::newaxis (), xt::all ());
221239
222240 // Get nu-fission directly
@@ -268,6 +286,10 @@ void XsData::fission_matrix_beta_from_hdf5(
268286 xt::view (temp_beta, xt::all (), xt::all (), xt::newaxis (), xt::newaxis ()) *
269287 xt::view (temp_matrix, xt::all (), xt::newaxis (), xt::all (), xt::all ());
270288
289+ // Store chi
290+ chi =
291+ chi_prompt * (1 . - temp_beta_sum) + xt::sum (temp_beta * chi_delayed, {1 });
292+
271293 } else if (beta_ndims == ndim_target + 1 ) {
272294 xt::xtensor<double , 3 > temp_beta ({n_ang, n_dg_, n_g_}, 0 .);
273295 read_nd_vector (xsdata_grp, " beta" , temp_beta, true );
@@ -293,14 +315,20 @@ void XsData::fission_matrix_beta_from_hdf5(
293315 chi_delayed =
294316 xt::view (temp_beta, xt::all (), xt::all (), xt::all (), xt::newaxis ()) *
295317 xt::view (temp_matrix, xt::all (), xt::newaxis (), xt::all (), xt::all ());
318+
319+ // Store chi
320+ chi =
321+ chi_prompt * (1 . - temp_beta_sum) + xt::sum (temp_beta * chi_delayed, {1 });
296322 }
297323
298- // Normalize both chis
324+ // Normalize chis
299325 chi_prompt /=
300326 xt::view (xt::sum (chi_prompt, {2 }), xt::all (), xt::all (), xt::newaxis ());
301327
302328 chi_delayed /= xt::view (
303329 xt::sum (chi_delayed, {3 }), xt::all (), xt::all (), xt::all (), xt::newaxis ());
330+
331+ chi /= xt::view (xt::sum (chi, {2 }), xt::all (), xt::all (), xt::newaxis ());
304332}
305333
306334void XsData::fission_matrix_no_beta_from_hdf5 (hid_t xsdata_grp, size_t n_ang)
@@ -326,8 +354,8 @@ void XsData::fission_matrix_no_beta_from_hdf5(hid_t xsdata_grp, size_t n_ang)
326354 // delayed_nu_fission is the sum over outgoing groups
327355 delayed_nu_fission = xt::sum (temp_matrix_d, {3 });
328356
329- // chi_prompt is this matrix but normalized over outgoing groups, which we
330- // have already stored in prompt_nu_fission
357+ // chi_delayee is this matrix but normalized over outgoing groups, which we
358+ // have already stored in delayed_nu_fission
331359 chi_delayed = temp_matrix_d / xt::view (delayed_nu_fission, xt::all (),
332360 xt::all (), xt::all (), xt::newaxis ());
333361}
@@ -346,6 +374,8 @@ void XsData::fission_matrix_no_delayed_from_hdf5(hid_t xsdata_grp, size_t n_ang)
346374
347375 // chi_prompt is this matrix but normalized over outgoing groups, which we
348376 // have already stored in prompt_nu_fission
377+ chi = temp_matrix /
378+ xt::view (prompt_nu_fission, xt::all (), xt::all (), xt::newaxis ());
349379 chi_prompt = temp_matrix /
350380 xt::view (prompt_nu_fission, xt::all (), xt::all (), xt::newaxis ());
351381}
@@ -525,6 +555,7 @@ void XsData::combine(
525555 kappa_fission += scalar * that->kappa_fission ;
526556 fission += scalar * that->fission ;
527557 delayed_nu_fission += scalar * that->delayed_nu_fission ;
558+ chi += scalar * that->chi ;
528559 chi_prompt += scalar *
529560 xt::view (xt::sum (that->prompt_nu_fission , {1 }), xt::all (),
530561 xt::newaxis (), xt::newaxis ()) *
@@ -537,8 +568,9 @@ void XsData::combine(
537568 decay_rate += scalar * that->decay_rate ;
538569 }
539570
540- // Ensure the chi_prompt and chi_delayed are normalized to 1 for each
571+ // Ensure chi, chi_prompt and chi_delayed are normalized to 1 for each
541572 // azimuthal angle and delayed group (for chi_delayed)
573+ chi /= xt::view (xt::sum (chi, {2 }), xt::all (), xt::all (), xt::newaxis ());
542574 chi_prompt /=
543575 xt::view (xt::sum (chi_prompt, {2 }), xt::all (), xt::all (), xt::newaxis ());
544576 chi_delayed /= xt::view (
0 commit comments