Skip to content

Commit eb44e46

Browse files
committed
Remove scc completely in traditional Davidson.
1 parent c120f6e commit eb44e46

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

source/source_hsolver/diago_david.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
185185
// slice index in this piece of code is in C manner. i.e. 0:id stands for [0,id)
186186
hpsi_func(basis, hpsi, dim, nband);
187187

188-
this->cal_elem(dim, nbase, nbase_x, this->notconv, this->hpsi, this->spsi, this->hcc, this->scc);
188+
this->cal_elem(dim, nbase, nbase_x, this->notconv, this->hpsi, this->spsi, this->hcc);
189189

190-
this->diag_zhegvx(nbase, nband, this->hcc, this->scc, nbase_x, this->eigenvalue, this->vcc);
190+
this->diag_zhegvx(nbase, nband, this->hcc, nbase_x, this->eigenvalue, this->vcc);
191191

192192
for (int m = 0; m < nband; m++)
193193
{
@@ -213,9 +213,9 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
213213
unconv.data(),
214214
this->eigenvalue);
215215

216-
this->cal_elem(dim, nbase, nbase_x, this->notconv, this->hpsi, this->spsi, this->hcc, this->scc);
216+
this->cal_elem(dim, nbase, nbase_x, this->notconv, this->hpsi, this->spsi, this->hcc);
217217

218-
this->diag_zhegvx(nbase, nband, this->hcc, this->scc, nbase_x, this->eigenvalue, this->vcc);
218+
this->diag_zhegvx(nbase, nband, this->hcc, nbase_x, this->eigenvalue, this->vcc);
219219

220220
// check convergence and update eigenvalues
221221
ModuleBase::timer::tick("DiagoDavid", "check_update");
@@ -277,7 +277,6 @@ int DiagoDavid<T, Device>::diag_once(const HPsiFunc& hpsi_func,
277277
this->hpsi,
278278
this->spsi,
279279
this->hcc,
280-
this->scc,
281280
this->vcc);
282281
ModuleBase::timer::tick("DiagoDavid", "last");
283282
}
@@ -531,8 +530,7 @@ void DiagoDavid<T, Device>::cal_elem(const int& dim,
531530
const int& notconv, // number of newly added basis vectors
532531
const T* hpsi,
533532
const T* spsi,
534-
T* hcc,
535-
T* scc)
533+
T* hcc)
536534
{
537535
if (test_david == 1) {
538536
ModuleBase::TITLE("DiagoDavid", "cal_elem");
@@ -608,7 +606,6 @@ template <typename T, typename Device>
608606
void DiagoDavid<T, Device>::diag_zhegvx(const int& nbase,
609607
const int& nband,
610608
const T* hcc,
611-
const T* /*scc*/,
612609
const int& nbase_x,
613610
Real* eigenvalue, // in CPU
614611
T* vcc)
@@ -665,7 +662,6 @@ void DiagoDavid<T, Device>::refresh(const int& dim,
665662
T* hpsi,
666663
T* spsi,
667664
T* hcc,
668-
T* scc,
669665
T* vcc)
670666
{
671667
if (test_david == 1) {

source/source_hsolver/diago_david.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class DiagoDavid
6161
* @brief Destructor for the DiagoDavid class.
6262
*
6363
* This destructor releases the dynamically allocated memory used by the class members.
64-
* It deletes the basis, hpsi, spsi, hcc, scc, vcc, lagrange_matrix, and eigenvalue arrays.
64+
* It deletes the basis, hpsi, spsi, hcc, vcc, lagrange_matrix, and eigenvalue arrays.
6565
*
6666
*/
6767
~DiagoDavid();
@@ -170,8 +170,6 @@ class DiagoDavid
170170

171171
T* hcc = nullptr; /// Hamiltonian on the reduced basis
172172

173-
T* scc = nullptr; /// overlap on the reduced basis
174-
175173
T* vcc = nullptr; /// eigenvectors of hc
176174

177175
T* lagrange_matrix = nullptr;
@@ -228,16 +226,14 @@ class DiagoDavid
228226
* @param hpsi The output array for the Hamiltonian H times blockvector psi.
229227
* @param spsi The output array for the overlap matrix S times blockvector psi.
230228
* @param hcc Pointer to the array where the calculated Hamiltonian matrix elements will be stored.
231-
* @param scc Pointer to the array where the calculated overlap matrix elements will be stored.
232229
*/
233230
void cal_elem(const int& dim,
234231
int& nbase,
235232
const int nbase_x,
236233
const int& notconv,
237234
const T* hpsi,
238235
const T* spsi,
239-
T* hcc,
240-
T* scc);
236+
T* hcc);
241237

242238
/**
243239
* Refreshes the diagonalization solver by updating the basis and the reduced Hamiltonian.
@@ -252,7 +248,6 @@ class DiagoDavid
252248
* @param hpsi Pointer to the output array for the updated basis set.
253249
* @param spsi Pointer to the output array for the updated basis set (nband-th column).
254250
* @param hcc Pointer to the output array for the updated reduced Hamiltonian.
255-
* @param scc Pointer to the output array for the updated overlap matrix.
256251
* @param vcc Pointer to the output array for the updated eigenvector matrix.
257252
*
258253
*/
@@ -266,7 +261,6 @@ class DiagoDavid
266261
T* hpsi,
267262
T* spsi,
268263
T* hcc,
269-
T* scc,
270264
T* vcc);
271265

272266
/**
@@ -304,7 +298,6 @@ class DiagoDavid
304298
void diag_zhegvx(const int& nbase,
305299
const int& nband,
306300
const T* hcc,
307-
const T* scc,
308301
const int& nbase_x,
309302
Real* eigenvalue,
310303
T* vcc);

0 commit comments

Comments
 (0)