@@ -18,13 +18,13 @@ namespace hsolver
1818// Produces on output n_band eigenvectors (n_band <= nstart) in evc.
1919// ----------------------------------------------------------------------
2020template <typename T, typename Device>
21- void DiagoIterAssist<T, Device>::diagH_subspace (const hamilt::Hamilt<T, Device>* const pHamilt, // hamiltonian operator carrier
21+ void DiagoIterAssist<T, Device>::diag_subspace (const hamilt::Hamilt<T, Device>* const pHamilt, // hamiltonian operator carrier
2222 const psi::Psi<T, Device>& psi, // [in] wavefunction
2323 psi::Psi<T, Device>& evc, // [out] wavefunction, eigenvectors
2424 Real* en, // [out] eigenvalues
2525 int n_band, // [in] number of bands to be calculated, also number of rows
2626 // of evc, if set to 0, n_band = nstart, default 0
27- const bool is_S_orthogonal // [in] if true, psi is already orthogonalized
27+ const bool S_orth // [in] if true, psi is assumed to be already S- orthogonalized
2828)
2929{
3030 ModuleBase::TITLE (" DiagoIterAssist" , " diag_subspace" );
@@ -47,7 +47,7 @@ void DiagoIterAssist<T, Device>::diagH_subspace(const hamilt::Hamilt<T, Device>*
4747 setmem_complex_op ()(hcc, 0 , nstart * nstart);
4848
4949 // scc is overlap matrix, only needed when psi is not orthogonal
50- if (!is_S_orthogonal ){
50+ if (!S_orth ){
5151 resmem_complex_op ()(scc, nstart * nstart, " DiagSub::scc" );
5252 setmem_complex_op ()(scc, 0 , nstart * nstart);
5353 }
@@ -96,7 +96,7 @@ void DiagoIterAssist<T, Device>::diagH_subspace(const hamilt::Hamilt<T, Device>*
9696 hcc,
9797 nstart);
9898
99- if (!is_S_orthogonal ){
99+ if (!S_orth ){
100100 // Only calculate S_sub if not orthogonal
101101 T *spsi = temp;
102102 // do sPsi for all bands
@@ -121,21 +121,20 @@ void DiagoIterAssist<T, Device>::diagH_subspace(const hamilt::Hamilt<T, Device>*
121121 if (GlobalV::NPROC_IN_POOL > 1 )
122122 {
123123 Parallel_Reduce::reduce_pool (hcc, nstart * nstart);
124- if (!is_S_orthogonal ){
124+ if (!S_orth ){
125125 Parallel_Reduce::reduce_pool (scc, nstart * nstart);
126126 }
127127 }
128128
129129 // after generation of H and (optionally) S matrix, diag them
130- if (is_S_orthogonal ) {
130+ if (S_orth ) {
131131 // Solve standard eigenproblem: H_sub * y = lambda * y
132- DiagoIterAssist::diagH_LAPACK_standard (nstart, n_band, hcc, nstart, en, vcc);
132+ DiagoIterAssist::diag_heevx (nstart, n_band, hcc, nstart, en, vcc);
133133 } else {
134134 // Solve generalized eigenproblem: H_sub * y = lambda * S_sub * y
135- DiagoIterAssist::diagH_LAPACK_generalized (nstart, n_band, hcc, scc, nstart, en, vcc);
135+ DiagoIterAssist::diag_hegvd (nstart, n_band, hcc, scc, nstart, en, vcc);
136136 }
137137
138-
139138 const int ld_temp = in_place ? dmax : dmin;
140139
141140 { // code block to calculate evc
@@ -160,7 +159,7 @@ void DiagoIterAssist<T, Device>::diagH_subspace(const hamilt::Hamilt<T, Device>*
160159 delmem_complex_op ()(temp);
161160 }
162161 delmem_complex_op ()(hcc);
163- if (!is_S_orthogonal ){
162+ if (!S_orth ){
164163 delmem_complex_op ()(scc);
165164 }
166165 delmem_complex_op ()(vcc);
@@ -315,7 +314,7 @@ void DiagoIterAssist<T, Device>::diagH_subspace_init(hamilt::Hamilt<T, Device>*
315314 }
316315 }*/
317316
318- DiagoIterAssist::diagH_LAPACK_generalized (nstart, n_band, hcc, scc, nstart, en, vcc);
317+ DiagoIterAssist::diag_hegvd (nstart, n_band, hcc, scc, nstart, en, vcc);
319318
320319 export_vcc (vcc, nstart, n_band);
321320
@@ -381,15 +380,15 @@ void DiagoIterAssist<T, Device>::diagH_subspace_init(hamilt::Hamilt<T, Device>*
381380}
382381
383382template <typename T, typename Device>
384- void DiagoIterAssist<T, Device>::diagH_LAPACK_standard (const int matrix_size,
383+ void DiagoIterAssist<T, Device>::diag_heevx (const int matrix_size,
385384 const int num_eigenpairs,
386385 const T *h,
387386 const int ldh,
388387 Real *e, // always in CPU
389388 T *v)
390389{
391- ModuleBase::TITLE (" DiagoIterAssist" , " diagH_LAPACK_standard " );
392- ModuleBase::timer::tick (" DiagoIterAssist" , " diagH_LAPACK_standard " );
390+ ModuleBase::TITLE (" DiagoIterAssist" , " diag_heevx " );
391+ ModuleBase::timer::tick (" DiagoIterAssist" , " diag_heevx " );
393392
394393 Real *eigenvalues = nullptr ;
395394 // device memory for eigenvalues
@@ -414,20 +413,20 @@ void DiagoIterAssist<T, Device>::diagH_LAPACK_standard(const int matrix_size,
414413
415414 delmem_var_op ()(eigenvalues);
416415
417- ModuleBase::timer::tick (" DiagoIterAssist" , " diagH_LAPACK_standard " );
416+ ModuleBase::timer::tick (" DiagoIterAssist" , " diag_heevx " );
418417}
419418
420419template <typename T, typename Device>
421- void DiagoIterAssist<T, Device>::diagH_LAPACK_generalized (const int nstart,
420+ void DiagoIterAssist<T, Device>::diag_hegvd (const int nstart,
422421 const int nbands,
423422 const T *hcc,
424423 const T *scc,
425424 const int ldh, // nstart
426425 Real *e, // always in CPU
427426 T *vcc)
428427{
429- ModuleBase::TITLE (" DiagoIterAssist" , " diagH_LAPACK_generalized " );
430- ModuleBase::timer::tick (" DiagoIterAssist" , " diagH_LAPACK_generalized " );
428+ ModuleBase::TITLE (" DiagoIterAssist" , " diag_hegvd " );
429+ ModuleBase::timer::tick (" DiagoIterAssist" , " diag_hegvd " );
431430
432431 Real *eigenvalues = nullptr ;
433432 resmem_var_op ()(eigenvalues, nstart);
@@ -465,7 +464,7 @@ void DiagoIterAssist<T, Device>::diagH_LAPACK_generalized(const int nstart,
465464 // dngvx_op<Real, Device>()(ctx, nstart, ldh, hcc, scc, nbands, res, vcc);
466465 // }
467466
468- ModuleBase::timer::tick (" DiagoIterAssist" , " diagH_LAPACK_generalized " );
467+ ModuleBase::timer::tick (" DiagoIterAssist" , " diag_hegvd " );
469468}
470469
471470template <typename T, typename Device>
@@ -557,7 +556,7 @@ void DiagoIterAssist<T, Device>::diag_responce( const T* hcc,
557556 setmem_complex_op ()(vcc, 0 , nstart * nstart);
558557
559558 // after generation of H and S matrix, diag them
560- DiagoIterAssist::diagH_LAPACK_generalized (nstart, nstart, hcc, scc, nstart, en, vcc);
559+ DiagoIterAssist::diag_hegvd (nstart, nstart, hcc, scc, nstart, en, vcc);
561560
562561 { // code block to calculate tar_mat
563562 ModuleBase::gemm_op<T, Device>()(' N' ,
@@ -599,7 +598,7 @@ void DiagoIterAssist<T, Device>::diag_subspace_psi(const T* hcc,
599598 setmem_complex_op ()(vcc, 0 , nstart * nstart);
600599
601600 // after generation of H and S matrix, diag them
602- DiagoIterAssist::diagH_LAPACK_generalized (nstart, nstart, hcc, scc, nstart, en, vcc);
601+ DiagoIterAssist::diag_hegvd (nstart, nstart, hcc, scc, nstart, en, vcc);
603602
604603 { // code block to calculate tar_mat
605604 const int dmin = evc.get_current_ngk ();
@@ -633,7 +632,7 @@ template <typename T, typename Device>
633632bool DiagoIterAssist<T, Device>::test_exit_cond(const int & ntry, const int & notconv)
634633{
635634 // ================================================================
636- // If this logical function is true, need to do diagH_subspace
635+ // If this logical function is true, need to do diag_subspace
637636 // and cg again.
638637 // ================================================================
639638
@@ -649,7 +648,7 @@ bool DiagoIterAssist<T, Device>::test_exit_cond(const int& ntry, const int& notc
649648 const bool f2 = ((!scf && (notconv > 0 )));
650649
651650 // if self consistent calculation, if not converged > 5,
652- // using diagH_subspace and cg method again. ntry++
651+ // using diag_subspace and cg method again. ntry++
653652 const bool f3 = ((scf && (notconv > 5 )));
654653 return (f1 && (f2 || f3));
655654}
0 commit comments