@@ -250,7 +250,6 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_CPU* ctx,
250250 wvf (ib, ig) = wfcatom (ib, ig);
251251 }
252252 }
253- return ;
254253 }
255254 else if (PARAM.inp .init_wfc == " random"
256255 || (PARAM.inp .init_wfc .substr (0 , 6 ) == " atomic" && GlobalC::ucell.natomwfc == 0 ))
@@ -354,103 +353,7 @@ void diago_PAO_in_pw_k2(const base_device::DEVICE_GPU* ctx,
354353 const int & lmaxkb,
355354 hamilt::Hamilt<std::complex <float >, base_device::DEVICE_GPU>* phm_in)
356355{
357- ModuleBase::TITLE (" wavefunc" , " diago_PAO_in_pw_k2" );
358-
359- const int nbasis = wvf.get_nbasis ();
360- const int nbands = wvf.get_nbands ();
361- const int current_nbasis = wfc_basis->npwk [ik];
362- int starting_nw = nbands;
363-
364- ModuleBase::ComplexMatrix wfcatom (nbands, nbasis);
365- if (PARAM.inp .init_wfc == " file" )
366- {
367- std::stringstream filename;
368- int ik_tot = K_Vectors::get_ik_global (ik, p_wf->nkstot );
369- filename << PARAM.globalv .global_readin_dir << " WAVEFUNC" << ik_tot + 1 << " .dat" ;
370- ModuleIO::read_wfc_pw (filename.str (), wfc_basis, ik, p_wf->nkstot , wfcatom);
371- }
372-
373- starting_nw = p_wf->get_starting_nw ();
374- if (starting_nw == 0 )
375- return ;
376- assert (starting_nw > 0 );
377- wfcatom.create (starting_nw, nbasis); // added by zhengdy-soc
378- if (PARAM.inp .test_wf )
379- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " starting_nw" , starting_nw);
380-
381- if (PARAM.inp .init_wfc .substr (0 , 6 ) == " atomic" )
382- {
383- p_wf->atomic_wfc (ik,
384- current_nbasis,
385- GlobalC::ucell.lmax_ppwf ,
386- lmaxkb,
387- wfc_basis,
388- wfcatom,
389- tab_at,
390- PARAM.globalv .nqx ,
391- PARAM.globalv .dq );
392- if (PARAM.inp .init_wfc == " atomic+random"
393- && starting_nw == GlobalC::ucell.natomwfc ) // added by qianrui 2021-5-16
394- {
395- p_wf->atomicrandom (wfcatom, 0 , starting_nw, ik, wfc_basis);
396- }
397-
398- // ====================================================
399- // If not enough atomic wfc are available, complete
400- // with random wfcs
401- // ====================================================
402- p_wf->random (wfcatom.c , GlobalC::ucell.natomwfc , nbands, ik, wfc_basis);
403- }
404- else if (PARAM.inp .init_wfc == " random" )
405- {
406- p_wf->random (wfcatom.c , 0 , nbands, ik, wfc_basis);
407- }
408-
409- std::complex <float >* c_wfcatom = nullptr ;
410- if (PARAM.inp .ks_solver != " bpcg" )
411- {
412- // store wfcatom on the GPU
413- resmem_cd_op ()(gpu_ctx, c_wfcatom, wfcatom.nr * wfcatom.nc );
414- castmem_z2c_h2d_op ()(gpu_ctx, cpu_ctx, c_wfcatom, wfcatom.c , wfcatom.nr * wfcatom.nc );
415- }
416- if (PARAM.inp .ks_solver == " cg" ) // xiaohui add 2013-09-02
417- {
418- // (7) Diago with cg method.
419- if (phm_in != nullptr )
420- {
421- std::vector<float > etatom (starting_nw, 0.0 );
422- hsolver::DiagoIterAssist<std::complex <float >, base_device::DEVICE_GPU>::diagH_subspace_init (phm_in,
423- c_wfcatom,
424- wfcatom.nr ,
425- wfcatom.nc ,
426- wvf,
427- etatom.data ());
428- }
429- else
430- {
431- // this diagonalization method is obsoleted now
432- // GlobalC::hm.diagH_subspace(ik ,starting_nw, nbands, wfcatom, wfcatom, etatom.data());
433- }
434- }
435- else if (PARAM.inp .ks_solver == " dav" || PARAM.inp .ks_solver == " dav_subspace" )
436- {
437- assert (nbands <= wfcatom.nr );
438- // replace by haozhihan 2022-11-23
439- hsolver::matrixSetToAnother<std::complex <float >, base_device::DEVICE_GPU>()(gpu_ctx,
440- nbands,
441- c_wfcatom,
442- wfcatom.nc ,
443- &wvf (0 , 0 ),
444- nbasis);
445- }
446- else if (PARAM.inp .ks_solver == " bpcg" )
447- {
448- castmem_z2c_h2d_op ()(gpu_ctx, cpu_ctx, &wvf (0 , 0 ), wfcatom.c , wfcatom.nr * wfcatom.nc );
449- }
450- if (PARAM.inp .ks_solver != " bpcg" )
451- {
452- delmem_cd_op ()(gpu_ctx, c_wfcatom);
453- }
356+ // TODO float
454357}
455358
456359template <>
0 commit comments