1 /*
2  *                This source code is part of
3  *
4  *                          HelFEM
5  *                             -
6  * Finite element methods for electronic structure calculations on small systems
7  *
8  * Written by Susi Lehtola, 2018-
9  * Copyright (c) 2018- Susi Lehtola
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  */
16 #ifndef INTEGRALS_H
17 #define INTEGRALS_H
18 
19 #include <armadillo>
20 #include "../general/legendretable.h"
21 #include "polynomial_basis.h"
22 
23 namespace helfem {
24   namespace diatomic {
25     namespace quadrature {
26       /**
27        * Computes a radial integral of the type \f$ \int_0^\infty B_1 (\mu) B_2(\mu) \sinh^m (\mu) \cosh^n (\mu) d\mu \f$.
28        *
29        * Input
30        *   mumin: start of element boundary
31        *   mumax: end of element boundary
32        *       x: integration nodes
33        *      wx: integration weights
34        *      bf: basis functions evaluated at integration nodes.
35        */
36       arma::mat radial_integral(double mumin, double mumax, int m, int n, const arma::vec & x, const arma::vec & wx, const arma::mat & bf);
37 
38       /**
39        * Computes a radial integral of the type \f$ \int_0^\infty B_1 (\mu) B_2(\mu) \cosh^m (\mu) P_L^M (\mu) d\mu \f$.
40        *
41        * Input
42        *   mumin: start of element boundary
43        *   mumax: end of element boundary
44        *       x: integration nodes
45        *      wx: integration weights
46        *      bf: basis functions evaluated at integration nodes.
47        */
48       arma::mat Plm_radial_integral(double mumin, double mumax, int m, const arma::vec & x, const arma::vec & wx, const arma::mat & bf, int L, int M, const legendretable::LegendreTable & tab);
49 
50       /**
51        * Computes a radial integral of the type \f$ \int_0^\infty B_1 (\mu) B_2(\mu) \cosh^m (\mu) Q_L^M (\mu) d\mu \f$.
52        *
53        * Input
54        *   mumin: start of element boundary
55        *   mumax: end of element boundary
56        *       x: integration nodes
57        *      wx: integration weights
58        *      bf: basis functions evaluated at integration nodes.
59        */
60       arma::mat Qlm_radial_integral(double mumin, double mumax, int m, const arma::vec & x, const arma::vec & wx, const arma::mat & bf, int L, int M, const legendretable::LegendreTable & tab);
61 
62       /**
63        * Computes the inner in-element two-electron integral:
64        * \f$ \phi^{l,LM}(\mu) = \int_{0}^{\mu}d\mu'\cosh^{l}\mu'\sinh\mu'B_{\gamma}(\mu')B_{\delta}(\mu')P_{L,|M|}(\cosh\mu') \f$
65        */
66       arma::mat twoe_inner_integral(double mumin, double mumax, int l, const arma::vec & x, const arma::vec & wx, const polynomial_basis::PolynomialBasis * poly, int L, int M, const legendretable::LegendreTable & tab);
67 
68       /**
69        * Computes a primitive two-electron in-element integral.
70        * Cross-element integrals reduce to products of radial integrals.
71        * Note that the routine needs the polynomial representation.
72        */
73       arma::mat twoe_integral(double rmin, double rmax, int k, int l, const arma::vec & x, const arma::vec & wx, const polynomial_basis::PolynomialBasis * poly, int L, int M, const legendretable::LegendreTable & tab);
74     }
75   }
76 }
77 
78 #endif
79