1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2019 QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //
11 //////////////////////////////////////////////////////////////////////////////////////
12
13 #ifndef QMCPLUSPLUS_SMOOTH_FUNCTIONS_H
14 #define QMCPLUSPLUS_SMOOTH_FUNCTIONS_H
15
16 namespace qmcplusplus
17 {
18
19 enum class smoothing_functions
20 {
21 LEKS2018 = 0,
22 COSCOS,
23 LINEAR
24 };
25
26 template<typename T>
27 T smoothing(smoothing_functions func_id, T x, T& dx, T& d2x);
28
29 extern template float smoothing(smoothing_functions func_id, float x, float& dx, float& d2x);
30 extern template double smoothing(smoothing_functions func_id, double x, double& dx, double& d2x);
31 }
32
33 #if defined(DEBUG_MAIN)
34 #include <iostream>
35
main()36 int main()
37 {
38 using RealType = double;
39 const RealType num_grid(1000);
40 std::cout << "# x dx d2x" << std::endl;
41 for (int i = -2; i < num_grid + 2; i++)
42 {
43 RealType x = RealType(i) / num_grid;
44 RealType f, df, d2f;
45 f = qmcplusplus::SmoothFunctions::func(COSCOS, x, df, d2f);
46 std::cout << x << " " << f << " " << df << " " << d2f << std::endl;
47 }
48 return 0;
49 }
50 #endif
51 #endif
52