2121 * Class Diago_CG is an approach for eigenvalue problems
2222 * This unittest test the function Diago_CG::diag()
2323 * with different examples.
24- * - the Hermite matrices (npw=50,100,200 ) produced using random numbers and with sparsity of 0%, 60%, 80%
24+ * - the Hermite matrices (npw=500,1000 ) produced using random numbers and with sparsity of 0%, 60%, 80%
2525 * - the Hamiltonian matrix read from "data-H", produced by using out_hs in INPUT of a LCAO calculation
2626 * - a 2x2 Hermite matrix for learning and checking
2727 *
@@ -57,8 +57,6 @@ class DiagoCGPrepare
5757 : nband(nband), npw(npw), sparsity(sparsity), reorder(reorder), eps(eps), maxiter(maxiter),
5858 threshold (threshold)
5959 {
60- hsolver::DiagoIterAssist::PW_DIAG_NMAX = maxiter;
61- hsolver::DiagoIterAssist::PW_DIAG_THR = eps;
6260 }
6361
6462 int nband, npw, sparsity, maxiter, notconv;
@@ -128,6 +126,10 @@ TEST_P(DiagoCGTest, RandomHamilt)
128126 DiagoCGPrepare dcp = GetParam ();
129127 // std::cout << "npw=" << dcp.npw << ", nband=" << dcp.nband << ", sparsity="
130128 // << dcp.sparsity << ", eps=" << dcp.eps << std::endl;
129+ hsolver::DiagoIterAssist::PW_DIAG_NMAX = dcp.maxiter ;
130+ hsolver::DiagoIterAssist::PW_DIAG_THR = dcp.eps ;
131+ // std::cout<<"maxiter "<<hsolver::DiagoIterAssist::PW_DIAG_NMAX<<std::endl;
132+ // std::cout<<"eps "<<hsolver::DiagoIterAssist::PW_DIAG_THR<<std::endl;
131133 HPsi hpsi (dcp.nband , dcp.npw , dcp.sparsity );
132134 DIAGOTEST::hmatrix = hpsi.hamilt ();
133135
@@ -140,10 +142,12 @@ INSTANTIATE_TEST_SUITE_P(VerifyCG,
140142 DiagoCGTest,
141143 ::testing::Values (
142144 // nband, npw, sparsity, reorder, eps, maxiter, threshold
143- DiagoCGPrepare (10 , 50 , 0 , true , 1e-5 , 50 , 1e-3 ),
144- DiagoCGPrepare(20 , 50 , 6 , true , 1e-5 , 50 , 1e-3 ),
145- DiagoCGPrepare(20 , 100 , 8 , true , 1e-5 , 50 , 1e-3 ),
146- DiagoCGPrepare(40 , 200 , 8 , true , 1e-5 , 50 , 1e-2 )));
145+ DiagoCGPrepare (10 , 500 , 0 , true , 1e-5 , 100 , 1e-3 ),
146+ DiagoCGPrepare(20 , 500 , 6 , true , 1e-5 , 300 , 1e-3 ),
147+ DiagoCGPrepare(20 , 1000 , 8 , true , 1e-5 , 300 , 1e-3 ),
148+ DiagoCGPrepare(40 , 1000 , 8 , true , 1e-6 , 300 , 1e-3 )));
149+ // DiagoCGPrepare(40, 2000, 8, true, 1e-5, 500, 1e-2)));
150+ // the last one is passed but time-consumming.
147151
148152// check that the mock class HPsi work well
149153// in generating a Hermite matrix
@@ -194,6 +198,8 @@ TEST(DiagoCGTest, TwoByTwo)
194198 hm (1 , 1 ) = std::complex <double >{3.0 , 0.0 };
195199 // nband, npw, sub, sparsity, reorder, eps, maxiter, threshold
196200 DiagoCGPrepare dcp (nband, dim, 0 , true , 1e-4 , 50 , 1e-10 );
201+ hsolver::DiagoIterAssist::PW_DIAG_NMAX = dcp.maxiter ;
202+ hsolver::DiagoIterAssist::PW_DIAG_THR = dcp.eps ;
197203 HPsi hpsi;
198204 hpsi.create (nband, dim);
199205 DIAGOTEST::hmatrix = hm;
@@ -212,7 +218,9 @@ TEST(DiagoCGTest, readH)
212218 int dim = hm.nr ;
213219 int nband = 10 ; // not nband < dim, here dim = 26 in data-H
214220 // nband, npw, sub, sparsity, reorder, eps, maxiter, threshold
215- DiagoCGPrepare dcp (nband, dim, 0 , true , 1e-4 , 50 , 1e-3 );
221+ DiagoCGPrepare dcp (nband, dim, 0 , true , 1e-4 , 300 , 1e-3 );
222+ hsolver::DiagoIterAssist::PW_DIAG_NMAX = dcp.maxiter ;
223+ hsolver::DiagoIterAssist::PW_DIAG_THR = dcp.eps ;
216224 HPsi hpsi;
217225 hpsi.create (nband, dim);
218226 DIAGOTEST::hmatrix = hpsi.hamilt ();
0 commit comments