ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
math_integral.h
Go to the documentation of this file.
1#ifndef MATH_INTEGRAL_H
2#define MATH_INTEGRAL_H
3
4// mohan add 2021-04-03
5namespace ModuleBase
6{
7
9{
10
11 public:
12
13 Integral();
14 ~Integral();
15
26 static void Simpson_Integral
27 (
28 const int mesh,
29 const double * const func,
30 const double * const rab,
31 double &asum
32 );
33
44 static void Simpson_Integral
45 (
46 const int mesh,
47 const double * const func,
48 const double dr,
49 double &asum
50 );
51
63 static void Simpson_Integral_0toall
64 (
65 const int mesh,
66 const double * const func,
67 const double * const rab,
68 double * const asum
69 );
70
81 static void Simpson_Integral_alltoinf
82 (
83 const int mesh,
84 const double * const func,
85 const double * const rab,
86 double * const asum
87 );
88
90 static double simpson(const int n,
91 const double* const f,
92 const double dx
93 );
94
96 static double simpson(const int n,
97 const double* const f,
98 const double* const h
99 );
100
101 // Grid points and weights used to generate Gauss_Legendre integrals. Returns x in [-1, 1], the integration area is -1, 1.
102 // https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_quadrature
103 // \int_{-1}^{1} f(x) dx \approx \sum_{i = 1}^{n} w_{i} f(x_{i})
104 // n is the number of sample points used,
105 // w_{i} are quadrature weights
106 // x_{i} are the roots of the n-th Legendre polynomial.
107 static void Gauss_Legendre_grid_and_weight(const int n, double *x, double *weights);
108
109 // Grid points and weights used to generate Gauss_Legendre integrals. Returns x in [xmin, xmax], the integration area is at xmin, xmax.
110 // \int_{-1}^{1} f(x) dx \approx \sum_{i = 1}^{n} w_{i} f(x_{i})
111 // xl = (xmax - xmin) / 2
112 // xmean = (xmax + xmin) / 2
113 // \int_{xmin}^{xmax} f(x) dx = xl \int_{-1}^{1} f(xl * t + xmean) dt
114 static void Gauss_Legendre_grid_and_weight(const double xmin, const double xmax, const int n, double *x, double *weights);
115
116 // Grid points and weights used to generate Gauss_Legendre integrals. can be generated with function Lebedev_laikov_grid in math_lebedev_laikov.cpp
117 static const double Lebedev_Laikov_grid110_x[110];
118 static const double Lebedev_Laikov_grid110_y[110];
119 static const double Lebedev_Laikov_grid110_z[110];
120 static const double Lebedev_Laikov_grid110_w[110];
121};
122
123}
124#endif
Definition math_integral.h:9
static void Simpson_Integral_alltoinf(const int mesh, const double *const func, const double *const rab, double *const asum)
simpson integral.
Definition math_integral.cpp:212
static void Simpson_Integral_0toall(const int mesh, const double *const func, const double *const rab, double *const asum)
simpson integral.
Definition math_integral.cpp:148
~Integral()
Definition math_integral.cpp:14
static double simpson(const int n, const double *const f, const double dx)
Numerical integration on an evenly-spaced grid using Simpson's rule.
Definition math_integral.cpp:229
static const double Lebedev_Laikov_grid110_y[110]
Definition math_integral.h:118
static const double Lebedev_Laikov_grid110_x[110]
Definition math_integral.h:117
Integral()
Definition math_integral.cpp:12
static const double Lebedev_Laikov_grid110_z[110]
Definition math_integral.h:119
static void Simpson_Integral(const int mesh, const double *const func, const double *const rab, double &asum)
simpson integral.
Definition math_integral.cpp:66
static void Gauss_Legendre_grid_and_weight(const int n, double *x, double *weights)
Definition math_integral.cpp:298
static const double Lebedev_Laikov_grid110_w[110]
Definition math_integral.h:120
Definition array_pool.h:6
double func(const Vec3 &r, const std::vector< Vec3 > &R, const std::vector< double > &a, const std::vector< double > &n)
Definition test_partition.cpp:50