feat(partition-functions): added framework and some concrete partition functions
GroundState partition function, Rauscher&Thielemann partition function, and composite partition function added
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "gridfire/partition/partition_abstract.h"
|
||||
|
||||
#include "fourdst/logging/logging.h"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace gridfire::partition {
|
||||
enum BasePartitionType {
|
||||
RauscherThielemann, ///< Rauscher-Thielemann partition function
|
||||
GroundState, ///< Ground state partition function
|
||||
};
|
||||
|
||||
inline std::unordered_map<BasePartitionType, std::string> basePartitionTypeToString = {
|
||||
{RauscherThielemann, "RauscherThielemann"},
|
||||
{GroundState, "GroundState"}
|
||||
};
|
||||
|
||||
inline std::unordered_map<std::string, BasePartitionType> stringToBasePartitionType = {
|
||||
{"RauscherThielemann", RauscherThielemann},
|
||||
{"GroundState", GroundState}
|
||||
};
|
||||
|
||||
class CompositePartitionFunction final : public PartitionFunction {
|
||||
public:
|
||||
explicit CompositePartitionFunction(const std::vector<BasePartitionType>& partitionFunctions);
|
||||
double evaluate(int z, int a, double T9) const override;
|
||||
double evaluateDerivative(int z, int a, double T9) const override;
|
||||
bool supports(int z, int a) const override;
|
||||
std::string type() const override;
|
||||
private:
|
||||
quill::Logger* m_logger = fourdst::logging::LogManager::getInstance().getLogger("log");
|
||||
std::vector<std::unique_ptr<PartitionFunction>> m_partitionFunctions; ///< Set of partition functions to use in the composite partition function.
|
||||
private:
|
||||
std::unique_ptr<PartitionFunction> selectPartitionFunction(const BasePartitionType type) const;
|
||||
};
|
||||
}
|
||||
14
src/network/include/gridfire/partition/partition_abstract.h
Normal file
14
src/network/include/gridfire/partition/partition_abstract.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace gridfire::partition {
|
||||
class PartitionFunction {
|
||||
public:
|
||||
virtual ~PartitionFunction() = default;
|
||||
virtual double evaluate(int z, int a, double T9) const = 0;
|
||||
virtual double evaluateDerivative(int z, int a, double T9) const = 0;
|
||||
virtual bool supports(int z, int a) const = 0;
|
||||
virtual std::string type() const = 0;
|
||||
};
|
||||
}
|
||||
38
src/network/include/gridfire/partition/partition_ground.h
Normal file
38
src/network/include/gridfire/partition/partition_ground.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "gridfire/partition/partition_abstract.h"
|
||||
|
||||
#include "fourdst/logging/logging.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "quill/Logger.h"
|
||||
|
||||
namespace gridfire::partition {
|
||||
class GroundStatePartitionFunction final : public PartitionFunction {
|
||||
public:
|
||||
GroundStatePartitionFunction();
|
||||
double evaluate(
|
||||
const int z,
|
||||
const int a,
|
||||
const double T9
|
||||
) const override;
|
||||
double evaluateDerivative(
|
||||
const int z,
|
||||
const int a,
|
||||
const double T9
|
||||
) const override;
|
||||
bool supports(
|
||||
const int z,
|
||||
const int a
|
||||
) const override;
|
||||
std::string type() const override { return "GroundState"; }
|
||||
private:
|
||||
quill::Logger* m_logger = fourdst::logging::LogManager::getInstance().getLogger("log");
|
||||
std::unordered_map<int, double> m_ground_state_spin;
|
||||
static constexpr int make_key(
|
||||
const int z,
|
||||
const int a);
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include "gridfire/partition/partition_abstract.h"
|
||||
|
||||
#include "fourdst/logging/logging.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <array>
|
||||
#include <utility>
|
||||
|
||||
namespace gridfire::partition {
|
||||
class RauscherThielemannPartitionFunction final : public PartitionFunction {
|
||||
public:
|
||||
RauscherThielemannPartitionFunction();
|
||||
double evaluate(int z, int a, double T9) const override;
|
||||
double evaluateDerivative(int z, int a, double T9) const override;
|
||||
bool supports(int z, int a) const override;
|
||||
std::string type() const override { return "RauscherThielemann"; }
|
||||
private:
|
||||
enum Bounds {
|
||||
FRONT,
|
||||
BACK,
|
||||
MIDDLE
|
||||
};
|
||||
private:
|
||||
struct IsotopeData {
|
||||
double ground_state_spin;
|
||||
std::array<double, 24> normalized_g_values;
|
||||
};
|
||||
struct InterpolationPoints {
|
||||
double T9_high;
|
||||
double G_norm_high;
|
||||
double T9_low;
|
||||
double G_norm_low;
|
||||
};
|
||||
struct IdentifiedIsotope {
|
||||
Bounds bound;
|
||||
const IsotopeData& data;
|
||||
size_t upperIndex;
|
||||
size_t lowerIndex;
|
||||
};
|
||||
private:
|
||||
quill::Logger* m_logger = fourdst::logging::LogManager::getInstance().getLogger("log");
|
||||
std::unordered_map<int, IsotopeData> m_partitionData;
|
||||
private:
|
||||
static InterpolationPoints get_interpolation_points(
|
||||
const size_t upper_index,
|
||||
const size_t lower_index,
|
||||
const std::array<double, 24>& normalized_g_values
|
||||
);
|
||||
IdentifiedIsotope find(int z, int a, double T9) const;
|
||||
static constexpr int make_key(int z, int a);
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace gridfire::partition::record {
|
||||
#pragma pack(push, 1)
|
||||
struct RauscherThielemannPartitionDataRecord {
|
||||
uint32_t z; ///< Atomic number
|
||||
uint32_t a; ///< Mass number
|
||||
double ground_state_spin; ///< Ground state spin
|
||||
double partition_function; ///< Partition function value
|
||||
double normalized_g_values[24]; ///< Normalized g-values for the first 24 energy levels
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
||||
Reference in New Issue
Block a user