@@ -17,20 +17,26 @@ void K_Vectors::cal_ik_global()
1717{
1818 const int my_pool = this ->para_k .my_pool ;
1919 this ->ik2iktot .resize (this ->nks );
20+
2021#ifdef __MPI
22+
23+ const int startk = this ->para_k .startk_pool [my_pool];
24+
2125 if (this ->nspin == 2 )
2226 {
23- for (int ik = 0 ; ik < this ->nks / 2 ; ++ik)
27+ // wos: without spin
28+ const int nks_wos = this ->nks /2 ;
29+ for (int ik = 0 ; ik < nks_wos; ++ik)
2430 {
25- this ->ik2iktot [ik] = this -> para_k . startk_pool [my_pool] + ik;
26- this ->ik2iktot [ik + this -> nks / 2 ] = this ->nkstot / 2 + this -> para_k . startk_pool [my_pool] + ik;
31+ this ->ik2iktot [ik] = startk + ik;
32+ this ->ik2iktot [ik+nks_wos ] = this ->nkstot / 2 + startk + ik;
2733 }
2834 }
2935 else
3036 {
3137 for (int ik = 0 ; ik < this ->nks ; ++ik)
3238 {
33- this ->ik2iktot [ik] = this -> para_k . startk_pool [my_pool] + ik;
39+ this ->ik2iktot [ik] = startk + ik;
3440 }
3541 }
3642#else
@@ -184,13 +190,6 @@ void K_Vectors::renew(const int& kpoint_number)
184190 wk.resize (kpoint_number);
185191 isk.resize (kpoint_number);
186192 ngk.resize (kpoint_number);
187-
188- /* ModuleBase::Memory::record("KV::kvec_c",sizeof(double) * kpoint_number*3);
189- ModuleBase::Memory::record("KV::kvec_d",sizeof(double) * kpoint_number*3);
190- ModuleBase::Memory::record("KV::wk",sizeof(double) * kpoint_number*3);
191- ModuleBase::Memory::record("KV::isk",sizeof(int) * kpoint_number*3);
192- ModuleBase::Memory::record("KV::ngk",sizeof(int) * kpoint_number*3);*/
193-
194193 return ;
195194}
196195
@@ -287,12 +286,11 @@ bool K_Vectors::read_kpoints(const UnitCell& ucell,
287286 // input k-points are in 2pi/a units
288287 ModuleBase::GlobalFunc::READ_VALUE (ifk, nkstot);
289288
290- this ->k_nkstot = nkstot; // LiuXh add 20180619
289+ this ->k_nkstot = nkstot;
291290
292- // std::cout << " nkstot = " << nkstot << std::endl;
293291 ModuleBase::GlobalFunc::READ_VALUE (ifk, kword);
294292
295- this ->k_kword = kword; // LiuXh add 20180619
293+ this ->k_kword = kword;
296294
297295 // mohan update 2021-02-22
298296 const int max_kpoints = 100000 ;
@@ -304,7 +302,7 @@ bool K_Vectors::read_kpoints(const UnitCell& ucell,
304302
305303 // 2.2 Select different methods and generate K-point grid
306304 int k_type = 0 ;
307- if (nkstot == 0 ) // nkstot==0, use monkhorst_pack. add by dwan
305+ if (nkstot == 0 ) // nkstot==0, use monkhorst_pack.
308306 {
309307 if (kword == " Gamma" ) // MP(Gamma)
310308 {
@@ -402,7 +400,7 @@ bool K_Vectors::read_kpoints(const UnitCell& ucell,
402400
403401 ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " nkstot" , nkstot);
404402 return true ;
405- } // END SUBROUTINE
403+ }
406404
407405void K_Vectors::interpolate_k_between (std::ifstream& ifk, std::vector<ModuleBase::Vector3<double >>& kvec)
408406{
@@ -533,10 +531,11 @@ void K_Vectors::update_use_ibz(const int& nkstot_ibz,
533531 const std::vector<ModuleBase::Vector3<double >>& kvec_d_ibz,
534532 const std::vector<double >& wk_ibz)
535533{
536- if (GlobalV::MY_RANK != 0 ) {
537- return ;
538- }
539- ModuleBase::TITLE (" K_Vectors" , " update_use_ibz" );
534+ if (GlobalV::MY_RANK != 0 )
535+ {
536+ return ;
537+ }
538+ ModuleBase::TITLE (" K_Vectors" , " update_use_ibz" );
540539 assert (nkstot_ibz > 0 );
541540 assert (nkstot_ibz <= kvec_d_ibz.size ());
542541 // update nkstot
0 commit comments