Skip to content

Commit 430d19f

Browse files
authored
Merge branch 'develop' into Charge_template
2 parents ffc2bc0 + c82406b commit 430d19f

File tree

19 files changed

+128
-23
lines changed

19 files changed

+128
-23
lines changed

source/source_base/module_container/ATen/kernels/cuda/lapack.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ struct lapack_hegvd<T, DEVICE_GPU> {
289289
{
290290
const int itype = 1;
291291
const char jobz = 'V';
292-
const char uplo = 'L';
292+
const char uplo = 'U';
293293
cudaErrcheck(cudaMemcpy(eigen_vec, Mat_A, sizeof(T) * dim * lda, cudaMemcpyDeviceToDevice));
294294

295295
// prevent B from being overwritten by Cholesky

source/source_hamilt/module_vdw/vdwd2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class Vdwd2 : public Vdw
3636
int yidx = para_.period().y / 2;
3737
int zidx = para_.period().z / 2;
3838

39-
for (int it1 = 0; it1 != ucell_.ntype; ++it1)
39+
for (int it1 = 0; it1 < ucell_.ntype; ++it1)
4040
{
41-
for (int it2 = 0; it2 != ucell_.ntype; ++it2)
41+
for (int it2 = 0; it2 < ucell_.ntype; ++it2)
4242
{
4343
const double C6_product
4444
= sqrt(para_.C6().at(ucell_.atoms[it1].ncpp.psd) * para_.C6().at(ucell_.atoms[it2].ncpp.psd))

source/source_hsolver/diago_lapack.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void DiagoLapack<std::complex<double>>::diag(hamilt::Hamilt<std::complex<double>
5858
Real* eigenvalue_in,
5959
MPI_Comm& comm)
6060
{
61-
ModuleBase::TITLE("DiagoScalapack", "diag_pool");
61+
ModuleBase::TITLE("DiagoLapack", "diag_pool");
6262
assert(h_mat.col == s_mat.col && h_mat.row == s_mat.row && h_mat.desc == s_mat.desc);
6363
std::vector<double> eigen(PARAM.globalv.nlocal, 0.0);
6464
this->dsygvx_diag(h_mat.col, h_mat.row, h_mat.p, s_mat.p, eigen.data(), psi);
@@ -72,7 +72,7 @@ void DiagoLapack<std::complex<double>>::diag(hamilt::Hamilt<std::complex<double>
7272
Real* eigenvalue_in,
7373
MPI_Comm& comm)
7474
{
75-
ModuleBase::TITLE("DiagoScalapack", "diag_pool");
75+
ModuleBase::TITLE("DiagoLapack", "diag_pool");
7676
assert(h_mat.col == s_mat.col && h_mat.row == s_mat.row && h_mat.desc == s_mat.desc);
7777
std::vector<double> eigen(PARAM.globalv.nlocal, 0.0);
7878
this->zhegvx_diag(h_mat.col, h_mat.row, h_mat.p, s_mat.p, eigen.data(), psi);
@@ -207,9 +207,7 @@ std::pair<int, std::vector<int>> DiagoLapack<T>::zhegvx_once(const int ncol,
207207
const int itype = 1, il = 1, iu = PARAM.inp.nbands, one = 1;
208208
int M = 0, NZ = 0, lwork = -1, lrwork = -1, liwork = -1, info = 0;
209209
const double abstol = 0, orfac = -1;
210-
//Note: pzhegvx_ has a bug
211-
// We must give vl,vu a value, although we do not use range 'V'
212-
// We must give rwork at least a memory of sizeof(double) * 3
210+
213211
const double vl = 0, vu = 0;
214212
std::vector<std::complex<double>> work(1, 0);
215213
std::vector<double> rwork(3, 0);

source/source_hsolver/hsolver_lcao.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void HSolverLCAO<TK, Device>::solve(hamilt::Hamilt<TK>* pHamilt,
6161
}else
6262
#endif
6363
if (PARAM.globalv.kpar_lcao > 1
64-
&& (this->method == "genelpa" || this->method == "elpa" || this->method == "scalapack_gvx"))
64+
&& (this->method == "genelpa" || this->method == "elpa" || this->method == "scalapack_gvx" || this->method == "lapack"))
6565
{
6666
this->parakSolve(pHamilt, psi, pes, PARAM.globalv.kpar_lcao);
6767
} else
@@ -254,6 +254,11 @@ void HSolverLCAO<T, Device>::parakSolve(hamilt::Hamilt<T>* pHamilt,
254254
DiagoScalapack<T> sa;
255255
sa.diag_pool(hk_pool, sk_pool, psi_pool, &(pes->ekb(ik_global, 0)), k2d.POOL_WORLD_K2D);
256256
}
257+
else if (this->method == "lapack")
258+
{
259+
DiagoLapack<T> la;
260+
la.diag_pool(hk_pool, sk_pool, psi_pool, &(pes->ekb(ik_global, 0)), k2d.POOL_WORLD_K2D);
261+
}
257262
#ifdef __ELPA
258263
else if (this->method == "genelpa")
259264
{

source/source_main/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#ifndef VERSION
2-
#define VERSION "v3.9.0.22"
2+
#define VERSION "v3.9.0.23"
33
#endif

source/source_psi/psi_init.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,28 @@ void PSIInit<T, Device>::prepare_init(const int& random_seed)
4444
if (this->init_wfc == "random")
4545
{
4646
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_random<T>());
47+
GlobalV::ofs_running << "\n Using RANDOM starting wave functions for all " << PARAM.inp.nbands << " bands\n";
4748
}
4849
else if (this->init_wfc == "file")
4950
{
5051
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_file<T>());
52+
GlobalV::ofs_running << "\n Using FILE starting wave functions\n";
5153
}
5254
else if ((this->init_wfc.substr(0, 6) == "atomic") && (this->ucell.natomwfc == 0))
5355
{
54-
ModuleBase::WARNING_QUIT("PSIInit::prepare_init",
55-
"init_wfc = atomic requires pseudo wavefunctions, but number of atom wfc = 0. \n"
56-
" Please use init_wfc = random or try a pseudopotential with pseudo wavefunctions.");
56+
std::cout << " WARNING: init_wfc = " + this->init_wfc +
57+
" requires atomic pseudo wavefunctions(PP_PSWFC),\n but none available."
58+
" Automatically switch to random initialization." << std::endl;
59+
GlobalV::ofs_running << "\n Using RANDOM starting wave functions for all " << PARAM.inp.nbands << " bands\n";
60+
GlobalV::ofs_running << "\n WARNING:\n init_wfc = " + this->init_wfc + " requires atomic pseudo wavefunctions(PP_PSWFC), but none available. \n"
61+
" Automatically switch to random initialization.\n"
62+
" Note: Random starting wavefunctions may slow down convergence.\n"
63+
" For faster convergence, consider using:\n"
64+
" 1) A pseudopotential file that includes atomic wavefunctions (with PP_PSWFC), or\n"
65+
" 2) Numerical atomic orbitals with 'init_wfc = nao' or 'nao+random' if available.\n"
66+
<< std::endl;
5767
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_random<T>());
68+
5869
}
5970
else if (this->init_wfc == "atomic"
6071
|| (this->init_wfc == "atomic+random" && this->ucell.natomwfc < PARAM.inp.nbands))
@@ -64,26 +75,30 @@ void PSIInit<T, Device>::prepare_init(const int& random_seed)
6475
int nrandom = PARAM.inp.nbands - this->ucell.natomwfc;
6576
GlobalV::ofs_running << "\n Using ATOMIC starting wave functions with " << this->ucell.natomwfc << " atomic orbitals"
6677
<< " + " << nrandom << " random orbitals"
67-
<< " (total " << PARAM.inp.nbands << " bands)";
78+
<< " (total " << PARAM.inp.nbands << " bands)\n";
6879
}
6980
else
7081
{
7182
GlobalV::ofs_running << "\n Using ATOMIC starting wave functions for all " << this->ucell.natomwfc << " atomic orbitals"
72-
<< " (covers " << PARAM.inp.nbands << " bands)";
83+
<< " (covers " << PARAM.inp.nbands << " bands)\n";
7384
}
7485
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_atomic<T>());
7586
}
7687
else if (this->init_wfc == "atomic+random")
7788
{
7889
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_atomic_random<T>());
90+
GlobalV::ofs_running << "\n Using ATOMIC+RANDOM starting wave functions with "
91+
<< this->ucell.natomwfc << " atomic orbitals\n";
7992
}
8093
else if (this->init_wfc == "nao")
8194
{
8295
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_nao<T>());
96+
GlobalV::ofs_running << "\n Using NAO starting wave functions\n";
8397
}
8498
else if (this->init_wfc == "nao+random")
8599
{
86100
this->psi_initer = std::unique_ptr<psi_initializer<T>>(new psi_initializer_nao_random<T>());
101+
GlobalV::ofs_running << "\n Using NAO+RANDOM starting wave functions\n";
87102
}
88103
else
89104
{

tests/04_FF/101_NEP_HfO2/INPUT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ pot_file ../../PP_ORB/nep_hfo2.txt
1010
cal_force 1
1111
cal_stress 1
1212

13-
md_nstep 3
13+
md_nstep 4
1414
md_type npt
1515
md_dt 1
1616
md_tfirst 300
1717
md_thermostat nhc
1818
md_dumpfreq 1
1919
md_seed 1
2020

21-
init_vel 1
21+
init_vel 1

tests/04_FF/50_DP_Al/INPUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pot_file ../../PP_ORB/Al-SCAN.pb
1010
cal_force 1
1111
cal_stress 1
1212

13-
md_nstep 3
13+
md_nstep 4
1414
md_type msst
1515
md_dt 1
1616
md_tfirst 200

tests/11_PW_GPU/002_PW_CG_GPU/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ This test for:
44
*kpoints 2*2*2
55
*sg15 pseudopotential
66
*smearing_method gauss
7-
*ks_solver bpcg
7+
*ks_solver cg
88
*mixing_type broyden-kerker
99
*mixing_beta 0.4

tests/11_PW_GPU/003_PW_DA_GPU/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ This test for:
44
*kpoints 2*2*2
55
*sg15 pseudopotential
66
*smearing_method gauss
7-
*ks_solver bpcg
7+
*ks_solver dav
88
*mixing_type broyden-kerker
99
*mixing_beta 0.4

0 commit comments

Comments
 (0)