ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include "gtest/gtest.h"
#include "source_io/module_parameter/parameter.h"
#include "source_base/inverse_matrix.h"
#include "source_base/module_external/lapack_connector.h"
#include "source_pw/module_pwdft/structure_factor.h"
#include "source_psi/psi.h"
#include "source_hamilt/hamilt.h"
#include "source_pw/module_pwdft/hamilt_pw.h"
#include "../diago_cg.h"
#include "../diago_iter_assist.h"
#include "diago_mock.h"
#include "mpi.h"
#include "source_basis/module_pw/test/test_tool.h"
#include <complex>
#include <ATen/core/tensor_map.h>
#include <random>
Classes | |
class | DiagoCGPrepare |
class | DiagoCGTest |
Macros | |
#define | private public |
Functions | |
void | lapackEigen (int &npw, std::vector< std::complex< double > > &hm, double *e, bool outtime=false) |
TEST_P (DiagoCGTest, RandomHamilt) | |
INSTANTIATE_TEST_SUITE_P (VerifyCG, DiagoCGTest, ::testing::Values(DiagoCGPrepare(10, 500, 0, true, 1e-5, 300, 1e-3), DiagoCGPrepare(20, 500, 6, true, 1e-5, 300, 1e-3), DiagoCGPrepare(20, 1000, 8, true, 1e-5, 300, 1e-3), DiagoCGPrepare(40, 1000, 8, true, 1e-6, 300, 1e-3))) | |
TEST (DiagoCGTest, Hamilt) | |
TEST (DiagoCGTest, readH) | |
int | main (int argc, char **argv) |
#define private public |
INSTANTIATE_TEST_SUITE_P | ( | VerifyCG | , |
DiagoCGTest | , | ||
::testing::Values(DiagoCGPrepare(10, 500, 0, true, 1e-5, 300, 1e-3), DiagoCGPrepare(20, 500, 6, true, 1e-5, 300, 1e-3), DiagoCGPrepare(20, 1000, 8, true, 1e-5, 300, 1e-3), DiagoCGPrepare(40, 1000, 8, true, 1e-6, 300, 1e-3)) | |||
) |
void lapackEigen | ( | int & | npw, |
std::vector< std::complex< double > > & | hm, | ||
double * | e, | ||
bool | outtime = false |
||
) |
Class Diago_CG is an approach for eigenvalue problems This unittest test the function Diago_CG::diag() for FPTYPE=double, Device=cpu with different examples.
Note: The test is passed when the eignvalues are closed to these calculated by LAPACK. It is used together with a header file diago_mock.h. The default Hermite matrix generated here is real symmetric, one can add an imaginary part by changing two commented out lines in diago_mock.h.
int main | ( | int | argc, |
char ** | argv | ||
) |
TEST | ( | DiagoCGTest | , |
Hamilt | |||
) |
TEST | ( | DiagoCGTest | , |
readH | |||
) |
TEST_P | ( | DiagoCGTest | , |
RandomHamilt | |||
) |