43class CoulombP3M :
public Actor<CoulombP3M, ::CoulombP3M> {
48 using Base = Actor<CoulombP3M, ::CoulombP3M>;
61 [
this]() {
return actor()->is_gpu(); }},
63 [
this]() {
return not
actor()->is_double_precision(); }},
65 [
this]() {
return actor()->p3m_params.alpha_L; }},
67 [
this]() {
return actor()->p3m_params.r_cut_iL; }},
69 [
this]() {
return actor()->p3m_params.mesh; }},
71 [
this]() {
return actor()->p3m_params.mesh_off; }},
73 [
this]() {
return actor()->p3m_params.cao; }},
75 [
this]() {
return actor()->p3m_params.accuracy; }},
77 [
this]() {
return actor()->p3m_params.epsilon; }},
79 [
this]() {
return actor()->p3m_params.a; }},
81 [
this]() {
return actor()->p3m_params.alpha; }},
83 [
this]() {
return actor()->p3m_params.r_cut; }},
85 [
this]() {
return actor()->is_tuned(); }},
87 [
this]() {
return m_tuning.verbose; }},
89 [
this]() {
return m_tuning.timings; }},
92#if defined(__clang__) and defined(__cray__) or defined(__INTEL_LLVM_COMPILER)
93 auto const &range_min = m_tuning.limits.first;
94 auto const &range_max = m_tuning.limits.second;
96 auto const &[range_min, range_max] = m_tuning.limits;
98 std::vector<Variant> retval = {
112 m_tuning.limits = {std::nullopt, std::nullopt};
113 if (params.contains(
"tune_limits")) {
114 auto const &variant = params.at(
"tune_limits");
115 std::size_t range_length = 0u;
116 if (
is_type<std::vector<int>>(variant)) {
118 range_length = range.size();
119 if (range_length == 2u) {
120 m_tuning.limits = {range[0u], range[1u]};
124 range_length = range.size();
125 if (range_length == 2u) {
135 if (range_length != 2u) {
136 throw std::invalid_argument(
"Parameter 'tune_limits' needs 2 values");
138 if (m_tuning.limits.first and *m_tuning.limits.first <= 0) {
139 throw std::domain_error(
"Parameter 'tune_limits' must be > 0");
141 if (m_tuning.limits.second and *m_tuning.limits.second <= 0) {
142 throw std::domain_error(
"Parameter 'tune_limits' must be > 0");
147 auto const single_precision =
get_value_or(params,
"single_precision", gpu);
150 std::vector<std::string> required_features;
151 required_features.emplace_back(
"CUDA");
void add_parameters(std::vector< AutoParameter > &¶ms)
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
std::shared_ptr< CoreActorClass > m_actor
std::shared_ptr< CoreActorClass > actor()
void set_charge_neutrality_tolerance(VariantMap const ¶ms)
std::shared_ptr< CoreActorClass > actor()
std::shared_ptr< CoreActorClass > m_actor
void do_construct(VariantMap const ¶ms) override
Actor< CoulombP3M, ::CoulombP3M > Base
void set_charge_neutrality_tolerance(VariantMap const ¶ms)
Type to indicate no value in Variant.
Context * context() const
Responsible context.
void check_features(std::vector< std::string > const &features)
Throw an exception when a feature is missing or not recognized.
constexpr bool is_none(Variant const &v)
constexpr bool is_type(Variant const &v)
Check is a Variant holds a specific type.
make_recursive_variant< ObjectRef > Variant
Possible types for parameters.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
T get_value_or(VariantMap const &vals, std::string const &name, T const &default_)
Get a value from a VariantMap by name, or return a default value if it does not exist.
std::unordered_map< std::string, Variant > VariantMap
std::shared_ptr< CoulombP3M > new_coulomb_p3m(P3MParameters &&p3m_params, TuningParameters const &tuning_params, double prefactor, bool single_precision, Arch arch)
P3M algorithm for long-range Coulomb interaction.
Structure to hold P3M parameters and some dependent variables.
static constexpr const ReadOnly read_only