Skip to content

Commit 5394a1c

Browse files
committed
test 2
1 parent 2352026 commit 5394a1c

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

source/module_psi/psi_init.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,21 @@ PSIInit<T, Device>::PSIInit(const std::string& init_wfc_in,
2626
this->use_psiinitializer = use_psiinitializer_in;
2727
this->pw_wfc = pw_wfc_in;
2828

29-
if (PARAM.inp.init_wfc == "file" || PARAM.inp.device == "gpu")
29+
if (PARAM.inp.psi_initializer == true)
3030
{
31-
this->init_psi_method = "old"; // old method;
31+
this->init_psi_method = "new";
3232
}
3333
else
3434
{
35-
this->init_psi_method = "new"; // new method;
35+
if (PARAM.inp.init_wfc == "file" || PARAM.inp.init_wfc == "atomic" || PARAM.inp.device == "gpu"
36+
|| PARAM.inp.esolver_type == "sdft")
37+
{
38+
this->init_psi_method = "old"; // old method;
39+
}
40+
else
41+
{
42+
this->init_psi_method = "new"; // new method;
43+
}
3644
}
3745
}
3846

source/module_psi/psi_initializer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void psi_initializer<T, Device>::random_t(T* psi, const int iw_start, const int
171171
#endif
172172
}
173173
// then for each g-component, initialize the wavefunction value
174-
#pragma omp parallel for schedule(static, 4096/sizeof(T))
174+
// #pragma omp parallel for schedule(static, 4096/sizeof(T))
175175
for (int ig = 0; ig < ng; ig++)
176176
{
177177
// get the correct value of "rr" and "arg" by indexing map "getigl2isz"
@@ -192,7 +192,7 @@ void psi_initializer<T, Device>::random_t(T* psi, const int iw_start, const int
192192
{
193193
T* psi_slice = &(psi[iw * this->pw_wfc_->npwk_max * PARAM.globalv.npol]); // get the memory to write directly. For nspin 4, nbasis*2
194194

195-
#pragma omp parallel for schedule(static, 4096/sizeof(T))
195+
// #pragma omp parallel for schedule(static, 4096/sizeof(T))
196196
for (int ig = 0; ig < ng; ig++)
197197
{
198198
const double rr = std::rand()/double(RAND_MAX); //qianrui add RAND_MAX
@@ -202,7 +202,7 @@ void psi_initializer<T, Device>::random_t(T* psi, const int iw_start, const int
202202
}
203203
if(PARAM.globalv.npol == 2) // additionally for nspin 4...
204204
{
205-
#pragma omp parallel for schedule(static, 4096/sizeof(T))
205+
// #pragma omp parallel for schedule(static, 4096/sizeof(T))
206206
for (int ig = this->pw_wfc_->npwk_max; ig < this->pw_wfc_->npwk_max + ng; ig++)
207207
{
208208
const double rr = std::rand()/double(RAND_MAX);

source/module_psi/psi_initializer_nao.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ void psi_initializer_nao<T, Device>::proj_ao_onkG(const int ik)
276276
std::vector<double> qnorm(npw);
277277
std::vector<ModuleBase::Vector3<double>> q(npw);
278278

279-
#pragma omp parallel for schedule(static, 4096 / sizeof(double))
279+
// #pragma omp parallel for schedule(static, 4096 / sizeof(double))
280280
for (int ig = 0; ig < npw; ig++)
281281
{
282282
q[ig] = this->pw_wfc_->getgpluskcar(ik, ig);
@@ -335,13 +335,13 @@ void psi_initializer_nao<T, Device>::proj_ao_onkG(const int ik)
335335
for (int m = 0; m < 2 * L + 1; m++)
336336
{
337337
const int lm = L * L + m;
338-
#pragma omp parallel for
338+
// #pragma omp parallel for
339339
for (int ig = 0; ig < npw; ig++)
340340
{
341341
aux[ig] = sk[ig] * ylm(lm, ig) * Jlfq[ig];
342342
}
343343

344-
#pragma omp parallel for
344+
// #pragma omp parallel for
345345
for (int ig = 0; ig < npw; ig++)
346346
{
347347
fup = cos(0.5 * alpha) * aux[ig];
@@ -374,7 +374,7 @@ void psi_initializer_nao<T, Device>::proj_ao_onkG(const int ik)
374374
for (int m = 0; m < 2 * L + 1; m++)
375375
{
376376
const int lm = L * L + m;
377-
#pragma omp parallel for
377+
// #pragma omp parallel for
378378
for (int ig = 0; ig < npw; ig++)
379379
{
380380
(*(this->psig_))(ibasis, ig)

0 commit comments

Comments
 (0)