ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cassert>
#include "../bessel_basis.h"
#include "../../source_cell/unitcell.h"
#include "../../source_estate/magnetism.h"
#include "gtest/gtest.h"
#include <mpi.h>
Classes | |
class | TestBesselBasis |
Functions | |
double | SimpsonIntegral (const std::vector< double > &x, const std::vector< double > &y) |
Simpson integral. | |
double | SphericalBessel (int l, double x) |
recursive definition of 1st-kind Spherical Bessel function of the first kind | |
std::vector< double > | CalculateSphericalBessel (int l, double q, const std::vector< double > &r) |
1st-kind Spherical Bessel function of the first kind mapped on realspace grid | |
std::vector< double > | GetSphericalBesselZeros (int order, int number) |
Get the first p zeros of 1st-kind, l-ordered Spherical Bessel function from a constant table. | |
std::vector< double > | GetqList (int order, int number, double rcut) |
Get mod of q vector of Spherical Bessel functions, all q satisfy when r=rcut , j_l(qr)=0. | |
std::vector< double > | operator* (const std::vector< double > &x, const std::vector< double > &y) |
overload operator * for vectors, elements will be multiplied one by one | |
std::vector< std::vector< std::vector< double > > > | GenerateTableOne (const bool smooth, const double sigma, const double ecutwfc, const double rcut, const int lmax, const double dr, const double dk) |
init_TableOne for unit test | |
std::unordered_map< std::string, double > | ReadinC4 (const std::string &FileName, const int &NumAtomType, const int &l, const int &NumChi, const int &NumBesselFunction) |
Improved version of source_io/bessel_basis::readin_C4 and allocate_C4 functions, for generating C4 matrix but now with a higher speed on accessing elements. | |
std::vector< std::vector< std::vector< std::vector< double > > > > | GenerateFaln (const std::string &FileName, const int &NumAtomType, const int &lmax, const int &NumChi, const int &NumBesselFunction, std::vector< std::vector< std::vector< double > > > vvv_d_TableOne) |
Generate F_{alpha, l, chi, k} matrix. | |
TEST_F (TestBesselBasis, InitTest) | |
TEST_F (TestBesselBasis, PolynomialInterpolation2Test) | |
TEST_F (TestBesselBasis, PolynomialInterpolationTest) | |
std::vector< double > CalculateSphericalBessel | ( | int | l, |
double | q, | ||
const std::vector< double > & | r | ||
) |
1st-kind Spherical Bessel function of the first kind mapped on realspace grid
l | order of 1st-kind spherical Bessel function |
q | wave vector |
r | realspace grid |
std::vector< std::vector< std::vector< std::vector< double > > > > GenerateFaln | ( | const std::string & | FileName, |
const int & | NumAtomType, | ||
const int & | lmax, | ||
const int & | NumChi, | ||
const int & | NumBesselFunction, | ||
std::vector< std::vector< std::vector< double > > > | vvv_d_TableOne | ||
) |
Generate F_{alpha, l, chi, k} matrix.
FileName | name of external file where C4-stored file information is contained |
NumAtomType | number of atom types |
l | maximal angular momentum of localized orbitals |
NumChi | number of contracted spherical bessel functions to fit one atomic orbital |
NumBesselFunction | number of spherical bessel functions in one contracted spherical bessel function |
vvv_d_TableOne | Integral table, has subscripts (l, q, k), whose element is the result of integral int{dr r^2 jle(r)*jlk(r)}. l runs over angular momentum, q runs over all spherical bessel functions, k runs over k points sampled controlled by ecutwfc and dk by sqrt(ecutwfc)/dk + 1 + 4. |
std::vector< std::vector< std::vector< double > > > GenerateTableOne | ( | const bool | smooth, |
const double | sigma, | ||
const double | ecutwfc, | ||
const double | rcut, | ||
const int | lmax, | ||
const double | dr, | ||
const double | dk | ||
) |
init_TableOne for unit test
smooth | whether to smooth the function (gaussian function) |
sigma | stddev of gaussian function for smoothing |
ecutwfc | control the number of Spheical Bessel functions |
rcut | cutoff radius of Spherical Bessel functions, r>rcut, Spherical Bessel functions are zero |
lmax | maximal angular momentum of Spherical Bessel functions |
dr | grid spacing of r |
dk | grid spacing of k |
std::vector<std::vector<std::vector<double>>>
TableOne[angular momentum][index of Spherical Bessel function][Arbitrary wave vector k] std::vector< double > GetqList | ( | int | order, |
int | number, | ||
double | rcut | ||
) |
Get mod of q vector of Spherical Bessel functions, all q satisfy when r=rcut
, j_l(qr)=0.
first solve the equation j_l(x) = 0, therefore get the table (l, k) -> x, where l is the order of SBF and k is the k-th zero of j_l(x). Then let x = q*rcut, therefore q = x/rcut, return it.
order | the angular momentum of Spherical Bessel functions |
number | number of q to be returned |
rcut | 'cutoff radius' of Spherical Bessel functions. When r=rcut, Spherical Bessel functions are zero, and for r>rcut, they are zero as required by concept of constructing localized atomic orbital. |
std::vector< double > GetSphericalBesselZeros | ( | int | order, |
int | number | ||
) |
Get the first p zeros of 1st-kind, l-ordered Spherical Bessel function from a constant table.
order | l, angular momentum |
number | p, number of zeros needed |
std::vector< double > operator* | ( | const std::vector< double > & | x, |
const std::vector< double > & | y | ||
) |
overload operator * for vectors, elements will be multiplied one by one
x | one vector |
y | another vector |
std::unordered_map< std::string, double > ReadinC4 | ( | const std::string & | FileName, |
const int & | NumAtomType, | ||
const int & | l, | ||
const int & | NumChi, | ||
const int & | NumBesselFunction | ||
) |
Improved version of source_io/bessel_basis::readin_C4 and allocate_C4 functions, for generating C4 matrix but now with a higher speed on accessing elements.
FileName | name of external file where C4-stored file information is contained |
NumAtomType | number of atom types |
l | maximal angular momentum of localized orbitals |
NumChi | number of contracted spherical bessel functions to fit one atomic orbital |
NumBesselFunction | number of spherical bessel functions in one contracted spherical bessel function |
double SimpsonIntegral | ( | const std::vector< double > & | x, |
const std::vector< double > & | y | ||
) |
Simpson integral.
unit test for source_io/bessel_basis, not tested functions: readin_C4, allocate_C4
x | variable stored in a vector |
y | function value stored in a vector |
double SphericalBessel | ( | int | l, |
double | x | ||
) |
recursive definition of 1st-kind Spherical Bessel function of the first kind
l | order of 1st-kind spherical Bessel function |
x | variable |
TEST_F | ( | TestBesselBasis | , |
InitTest | |||
) |
TEST_F | ( | TestBesselBasis | , |
PolynomialInterpolation2Test | |||
) |
TEST_F | ( | TestBesselBasis | , |
PolynomialInterpolationTest | |||
) |