5#include "fourdst/logging/logging.h"
6#include "quill/LogMacros.h"
16 0.01, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5,
17 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0
24 for (
size_t i = 0; i < numRecords; ++i) {
25 const auto&[z, a, ground_state_spin, normalized_g_values] = records[i];
30 LOG_TRACE_L3_LIMIT_EVERY_N(
33 "(EVERY 100) Adding Rauscher-Thielemann partition data for Z={} A={} (key={})",
48 LOG_TRACE_L2(
m_logger,
"Evaluating Rauscher-Thielemann partition function for Z={} A={} T9={}", z, a, T9);
50 const auto [bound, data, upperIndex, lowerIndex] =
find(z, a, T9);
54 LOG_TRACE_L2(
m_logger,
"Using FRONT bound for Z={} A={} T9={}", z, a, T9);
55 return data.normalized_g_values.front() * (2.0 * data.ground_state_spin + 1.0);
58 LOG_TRACE_L2(
m_logger,
"Using BACK bound for Z={} A={} T9={}", z, a, T9);
59 return data.normalized_g_values.back() * (2.0 * data.ground_state_spin + 1.0);
62 LOG_TRACE_L2(
m_logger,
"Using MIDDLE bound for Z={} A={} T9={}", z, a, T9);
69 data.normalized_g_values
72 const double frac = (T9 - T9_low) / (T9_high - T9_low);
73 const double interpolated_g_norm = G_norm_low + frac * (G_norm_high - G_norm_low);
75 return interpolated_g_norm * (2.0 * data.ground_state_spin + 1.0);
83 LOG_TRACE_L2(
m_logger,
"Evaluating derivative of Rauscher-Thielemann partition function for Z={} A={} T9={}", z, a, T9);
84 const auto [bound, data, upperIndex, lowerIndex] =
find(z, a, T9);
86 LOG_TRACE_L2(
m_logger,
"Derivative is zero for Z={} A={} T9={} (bound: {})", z, a, T9, bound ==
FRONT ?
"FRONT" :
"BACK");
92 data.normalized_g_values
94 const double slope_g_norm = (G_norm_high - G_norm_low) / (T9_high - T9_low);
95 return slope_g_norm * (2.0 * data.ground_state_spin + 1.0);
106 const size_t upper_index,
107 const size_t lower_index,
108 const std::array<double, 24>& normalized_g_values
111 const double G_norm_high = normalized_g_values[upper_index];
113 const double G_norm_low = normalized_g_values[lower_index];
114 return {T_high, G_norm_high, T_low, G_norm_low};
126 LOG_ERROR(
m_logger,
"Rauscher-Thielemann partition function data for Z={} A={} not found.", z, a);
127 throw std::out_of_range(
"Partition function data not found for Z=" + std::to_string(z) +
" A=" + std::to_string(a));
141 const size_t lower_index = upper_index - 1;
142 return {bound, data, upper_index, lower_index};
IdentifiedIsotope find(int z, int a, double T9) const
Identify isotope entry and grid indices for given T9.
static InterpolationPoints get_interpolation_points(const size_t upper_index, const size_t lower_index, const std::array< double, 24 > &normalized_g_values)
Get interpolation points from normalized G array.
std::unordered_map< int, IsotopeData > m_partitionData
Map of isotope key to data.
bool supports(int z, int a) const override
Check if partition data exists for given isotope.
Bounds
Indicator for temperature grid bound position.
@ FRONT
Below first grid point.
@ MIDDLE
Between grid points.
@ BACK
Above last grid point.
double evaluateDerivative(int z, int a, double T9) const override
Evaluate temperature derivative of partition function.
static constexpr int make_key(int z, int a)
Generate integer key for isotope (z,a).
RauscherThielemannPartitionFunction()
Construct and populate partition data.
double evaluate(int z, int a, double T9) const override
Evaluate partition function for isotope at temperature.
static constexpr std::array< double, 24 > RT_TEMPERATURE_GRID_T9
const size_t rauscher_thielemann_partition_data_len
const unsigned char rauscher_thielemann_partition_data[]
std::array< double, 24 > normalized_g_values
Normalized G values on RT grid.
double ground_state_spin
Spin of the isotope ground state.
Packed binary record of Rauscher-Thielemann partition function data for an isotope.