8#include "quill/LogMacros.h"
12 const std::vector<BasePartitionType>& partitionFunctions
14 for (
const auto&
type : partitionFunctions) {
28 LOG_TRACE_L3(
m_logger,
"Evaluating partition function for Z={} A={} T9={}", z, a, T9);
30 if (partitionFunction->supports(z, a)) {
31 LOG_TRACE_L3(
m_logger,
"Partition function of type {} supports Z={} A={}", partitionFunction->type(), z, a);
32 return partitionFunction->evaluate(z, a, T9);
34 LOG_TRACE_L3(
m_logger,
"Partition function of type {} does not support Z={} A={}", partitionFunction->type(), z, a);
39 "No partition function supports Z={} A={} T9={}. Tried: {}",
45 throw std::runtime_error(
"No partition function supports the given Z, A, and T9 values.");
50 if (partitionFunction->supports(z, a)) {
51 LOG_TRACE_L3(
m_logger,
"Evaluating derivative of partition function for Z={} A={} T9={}", z, a, T9);
52 return partitionFunction->evaluateDerivative(z, a, T9);
57 "No partition function supports Z={} A={} T9={}. Tried: {}",
63 throw std::runtime_error(
"No partition function supports the given Z, A, and T9 values.");
68 if (partitionFunction->supports(z, a)) {
69 LOG_TRACE_L2(
m_logger,
"Partition function supports Z={} A={}", z, a);
78 ss <<
"CompositePartitionFunction(";
81 ss << partitionFunction->type();
88 std::string types = ss.str();
97 return std::make_unique<RauscherThielemannPartitionFunction>();
100 return std::make_unique<GroundStatePartitionFunction>();
103 LOG_ERROR(
m_logger,
"Unknown partition function type");
104 throw std::runtime_error(
"Unknown partition function type");
std::unique_ptr< PartitionFunction > selectPartitionFunction(const BasePartitionType type) const
std::string type() const override
std::vector< std::unique_ptr< PartitionFunction > > m_partitionFunctions
Set of partition functions to use in the composite partition function.
double evaluate(int z, int a, double T9) const override
double evaluateDerivative(int z, int a, double T9) const override
CompositePartitionFunction(const std::vector< BasePartitionType > &partitionFunctions)
bool supports(int z, int a) const override
std::unordered_map< BasePartitionType, std::string > basePartitionTypeToString
Mapping from BasePartitionType enum to human-readable string.
BasePartitionType
Enumerates available partition function implementations.
@ RauscherThielemann
Rauscher-Thielemann partition function.
@ GroundState
Ground state partition function.