@@ -140,15 +140,15 @@ void wavefunc::wfcinit(psi::Psi<std::complex<double>>* psi_in, ModulePW::PW_Basi
140140 return ;
141141}
142142
143- int wavefunc::get_starting_nw () const
143+ int wavefunc::get_starting_nw (const int natomwfc ) const
144144{
145145 if (PARAM.inp .init_wfc == " file" )
146146 {
147147 return PARAM.inp .nbands ;
148148 }
149149 else if (PARAM.inp .init_wfc .substr (0 , 6 ) == " atomic" )
150150 {
151- if (GlobalC::ucell. natomwfc >= PARAM.inp .nbands )
151+ if (natomwfc >= PARAM.inp .nbands )
152152 {
153153 if (PARAM.inp .test_wf )
154154 {
@@ -160,11 +160,11 @@ int wavefunc::get_starting_nw() const
160160 if (PARAM.inp .test_wf )
161161 {
162162 GlobalV::ofs_running << " Start wave functions are atomic + "
163- << PARAM.inp .nbands - GlobalC::ucell. natomwfc << " random wave functions."
163+ << PARAM.inp .nbands - natomwfc << " random wave functions."
164164 << std::endl;
165165 }
166166 }
167- return std::max (GlobalC::ucell. natomwfc , PARAM.inp .nbands );
167+ return std::max (natomwfc, PARAM.inp .nbands );
168168 }
169169 else if (PARAM.inp .init_wfc == " random" )
170170 {
@@ -194,6 +194,8 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
194194 wavefunc* p_wf,
195195 const ModuleBase::realArray& tab_at,
196196 const int & lmaxkb,
197+ const int natomwfc,
198+ const int lmax_ppwf,
197199 hamilt::Hamilt<std::complex <float >, base_device::DEVICE_CPU>* phm_in)
198200{
199201 // TODO float func
@@ -207,6 +209,8 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
207209 wavefunc* p_wf,
208210 const ModuleBase::realArray& tab_at,
209211 const int & lmaxkb,
212+ const int natomwfc,
213+ const int lmax_ppwf,
210214 hamilt::Hamilt<std::complex <double >, base_device::DEVICE_CPU>* phm_in)
211215{
212216 ModuleBase::TITLE (" wavefunc" , " diago_PAO_in_pw_k2" );
@@ -252,7 +256,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
252256 }
253257 }
254258 else if (PARAM.inp .init_wfc == " random"
255- || (PARAM.inp .init_wfc .substr (0 , 6 ) == " atomic" && GlobalC::ucell. natomwfc == 0 ))
259+ || (PARAM.inp .init_wfc .substr (0 , 6 ) == " atomic" && natomwfc == 0 ))
256260 {
257261 p_wf->random (wvf.get_pointer (), 0 , nbands, ik, wfc_basis);
258262
@@ -273,7 +277,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
273277 }
274278 else if (PARAM.inp .init_wfc .substr (0 , 6 ) == " atomic" )
275279 {
276- const int starting_nw = p_wf->get_starting_nw ();
280+ const int starting_nw = p_wf->get_starting_nw (natomwfc );
277281 if (starting_nw == 0 )
278282 {
279283 return ;
@@ -289,7 +293,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
289293
290294 p_wf->atomic_wfc (ik,
291295 current_nbasis,
292- GlobalC::ucell. lmax_ppwf ,
296+ lmax_ppwf,
293297 lmaxkb,
294298 wfc_basis,
295299 wfcatom,
@@ -298,7 +302,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
298302 PARAM.globalv .dq );
299303
300304 if (PARAM.inp .init_wfc == " atomic+random"
301- && starting_nw == GlobalC::ucell. natomwfc ) // added by qianrui 2021-5-16
305+ && starting_nw == natomwfc) // added by qianrui 2021-5-16
302306 {
303307 p_wf->atomicrandom (wfcatom, 0 , starting_nw, ik, wfc_basis);
304308 }
@@ -307,7 +311,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
307311 // If not enough atomic wfc are available, complete
308312 // with random wfcs
309313 // ====================================================
310- p_wf->random (wfcatom.c , GlobalC::ucell. natomwfc , nbands, ik, wfc_basis);
314+ p_wf->random (wfcatom.c , natomwfc, nbands, ik, wfc_basis);
311315
312316 // (7) Diago with cg method.
313317 // if(GlobalV::DIAGO_TYPE == "cg") xiaohui modify 2013-09-02
@@ -351,6 +355,8 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_GPU* ctx,
351355 wavefunc* p_wf,
352356 const ModuleBase::realArray& tab_at,
353357 const int & lmaxkb,
358+ const int natomwfc,
359+ const int lmax_ppwf,
354360 hamilt::Hamilt<std::complex <float >, base_device::DEVICE_GPU>* phm_in)
355361{
356362 // TODO float
@@ -364,6 +370,8 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_GPU* ctx,
364370 wavefunc* p_wf,
365371 const ModuleBase::realArray& tab_at,
366372 const int & lmaxkb,
373+ const int natomwfc,
374+ const int lmax_ppwf,
367375 hamilt::Hamilt<std::complex <double >, base_device::DEVICE_GPU>* phm_in)
368376{
369377 ModuleBase::TITLE (" wavefunc" , " diago_PAO_in_pw_k2" );
@@ -393,15 +401,15 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_GPU* ctx,
393401 {
394402 p_wf->atomic_wfc (ik,
395403 current_nbasis,
396- GlobalC::ucell. lmax_ppwf ,
404+ lmax_ppwf,
397405 lmaxkb,
398406 wfc_basis,
399407 wfcatom,
400408 tab_at,
401409 PARAM.globalv .nqx ,
402410 PARAM.globalv .dq );
403411 if (PARAM.inp .init_wfc == " atomic+random"
404- && starting_nw == GlobalC::ucell. natomwfc ) // added by qianrui 2021-5-16
412+ && starting_nw == natomwfc) // added by qianrui 2021-5-16
405413 {
406414 p_wf->atomicrandom (wfcatom, 0 , starting_nw, ik, wfc_basis);
407415 }
@@ -410,7 +418,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_GPU* ctx,
410418 // If not enough atomic wfc are available, complete
411419 // with random wfcs
412420 // ====================================================
413- p_wf->random (wfcatom.c , GlobalC::ucell. natomwfc , nbands, ik, wfc_basis);
421+ p_wf->random (wfcatom.c , natomwfc, nbands, ik, wfc_basis);
414422 }
415423 else if (PARAM.inp .init_wfc == " random" )
416424 {
0 commit comments