STORMM Source Documentation
Loading...
Searching...
No Matches
layered_potential.h
1// -*-c++-*-
2#ifndef STORMM_LAYERED_POTENTIAL_H
3#define STORMM_LAYERED_POTENTIAL_H
4
5#include "copyright.h"
6#include "Accelerator/hybrid.h"
7#include "Math/formulas.h"
8#include "Math/log_scale_spline.h"
9#include "Math/matrix_ops.h"
10#include "Potential/pme_util.h"
11#include "Structure/structure_enumerators.h"
12#include "energy_enumerators.h"
13#include "layered_potential_metrics.h"
14
15namespace stormm {
16namespace energy {
17
18using card::Hybrid;
19using card::HybridTargetLevel;
20using energy::elecPMEDirectSpace;
21using stmath::sigmoid;
22using stmath::sigmoidf;
23using stmath::LogScaleSpline;
24using stmath::LogSplineTable;
25using stmath::qrSolver;
26
33template <typename T4>
34class NrgLayerKit {
35
38 NrgLayerKit(const LogSplineTable<T4> &u_in, const LogSplineTable<T4> &du_in,
39 const LogSplineTable<T4> &d2u_in, const LogSplineTable<T4> &d3u_in,
40 double cutoff_in);
41
49 NrgLayerKit(const NrgLayerKit &original) = default;
50 NrgLayerKit(NrgLayerKit &&original) = default;
51 NrgLayerKit& operator=(const NrgLayerKit &original) = default;
52 NrgLayerKit& operator=(NrgLayerKit &&original) = default;
54
55 // A total of four logarithmic spline tables are contained within the abstract.
56 const LogSplineTable<T4> u;
57 const LogSplineTable<T4> du;
58 const LogSplineTable<T4> d2u;
59 const LogSplineTable<T4> d3u;
60 const double cutoff;
68};
69
77template <typename T, typename T4> class LayeredPotential {
78public:
79
91
99 LayeredPotential(const LayeredPotential &original) = default;
100 LayeredPotential(LayeredPotential &&original) = default;
101 LayeredPotential& operator=(const LayeredPotential &other) = default;
102 LayeredPotential& operator=(LayeredPotential &&other) = default;
104
109
114
121 T getSplinedValue(int layer, T r, T r2 = -1.0) const;
122
126 T getAnalyticValue(int layer, T r, T r2 = -1.0) const;
127
136 T getSplinedDerivative(int layer, T r, T r2 = -1.0, int order = 1) const;
137
141 T getAnalyticDerivative(int layer, T r, T r2 = -1.0, int order = 1) const;
142
152 const NrgLayerKit<T4> data(int layer_index,
153 HybridTargetLevel tier = HybridTargetLevel::HOST) const;
154
155private:
156 LayeredPotentialMetrics parameters;
157 std::vector<LogScaleSpline<T4>> spline_tables;
158 std::vector<double4> smoothing_coefficients;
159
164 void validateLayerIndex(int layer_index, const char* caller = nullptr) const;
165
169 void solveLayerCoefficients();
170};
171
172} // namespace energy
173} // namespace stormm
174
175#include "layered_potential.tpp"
176
177#endif
Collect the details needed to formulate a layered potential, including the length of each layer's cut...
Definition layered_potential_metrics.h:33
LayeredPotential(const LayeredPotential &original)=default
So long as the nested parameters manager and LogScaleSpline objects copy and move correctly,...
T getAnalyticDerivative(int layer, T r, T r2=-1.0, int order=1) const
Get the value of the potential derivative at a specified layer and distance, using analytic calculati...
T getSplinedDerivative(int layer, T r, T r2=-1.0, int order=1) const
Get the value of the potential derivative at a specified layer and distance, making use of an interna...
T getAnalyticValue(int layer, T r, T r2=-1.0) const
Compute the value of one of the potential functions, using analytic expressions, at a specified layer...
LayeredPotential(const LayeredPotentialMetrics &parameters_in=LayeredPotentialMetrics())
The constructor requires an enumeration to specify a particular potential form as well as a rough und...
const LayeredPotentialMetrics & getParameters() const
Get a const reference to the underlying metrics, to view specifications such as the cutoff at a parti...
double4 getSmoothingCoefficients(int layer) const
Obtain the quartet of coefficients for one of the layers.
const NrgLayerKit< T4 > data(int layer_index, HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a read-only abstract for the object, gear towards a specific layer of the potential....
T getSplinedValue(int layer, T r, T r2=-1.0) const
Get the value of one of the potential functions at a specified layer and distance,...
The abstract of the LayeredPotential class provides only one of the layers. Kernels can be called wit...
Definition layered_potential.h:34
Definition stormm_vector_types.h:123
Abstract for the logarithmic splined function object, containing the table and critical constants for...
Definition log_scale_spline.h:46