@@ -1017,68 +1017,8 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry& symm,
10171017// if direct coordinates are given, then cartesian coordinates are calculated
10181018void K_Vectors::set_both_kvec (const ModuleBase::Matrix3& G, const ModuleBase::Matrix3& R, std::string& skpt)
10191019{
1020+ KVectorUtils::set_both_kvec (*this , G, R, skpt);
10201021
1021- if (PARAM.inp .final_scf ) // LiuXh add 20180606
1022- {
1023- if (k_nkstot == 0 )
1024- {
1025- kd_done = true ;
1026- kc_done = false ;
1027- }
1028- else
1029- {
1030- if (k_kword == " Cartesian" || k_kword == " C" )
1031- {
1032- kc_done = true ;
1033- kd_done = false ;
1034- }
1035- else if (k_kword == " Direct" || k_kword == " D" )
1036- {
1037- kd_done = true ;
1038- kc_done = false ;
1039- }
1040- else
1041- {
1042- GlobalV::ofs_warning << " Error : neither Cartesian nor Direct kpoint." << std::endl;
1043- }
1044- }
1045- }
1046-
1047- // set cartesian k vectors.
1048- if (!kc_done && kd_done)
1049- {
1050- KVectorUtils::k_vec_d2c (*this , G);
1051- kc_done = true ;
1052- }
1053-
1054- // set direct k vectors
1055- else if (kc_done && !kd_done)
1056- {
1057- KVectorUtils::k_vec_c2d (*this , R);
1058- kd_done = true ;
1059- }
1060- std::string table;
1061- table += " K-POINTS DIRECT COORDINATES\n " ;
1062- table += FmtCore::format (" %8s%12s%12s%12s%8s\n " , " KPOINTS" , " DIRECT_X" , " DIRECT_Y" , " DIRECT_Z" , " WEIGHT" );
1063- for (int i = 0 ; i < nkstot; i++)
1064- {
1065- table += FmtCore::format (" %8d%12.8f%12.8f%12.8f%8.4f\n " ,
1066- i + 1 ,
1067- this ->kvec_d [i].x ,
1068- this ->kvec_d [i].y ,
1069- this ->kvec_d [i].z ,
1070- this ->wk [i]);
1071- }
1072- GlobalV::ofs_running << table << std::endl;
1073- if (GlobalV::MY_RANK == 0 )
1074- {
1075- std::stringstream ss;
1076- ss << " " << std::setw (40 ) << " nkstot now"
1077- << " = " << nkstot << std::endl;
1078- ss << table << std::endl;
1079- skpt = ss.str ();
1080- }
1081- return ;
10821022}
10831023
10841024void K_Vectors::normalize_wk (const int & degspin)
@@ -1332,29 +1272,7 @@ void K_Vectors::set_after_vc(const int& nspin_in,
13321272{
13331273 ModuleBase::TITLE (" K_Vectors" , " set_after_vc" );
13341274
1335- GlobalV::ofs_running << " \n SETUP K-POINTS" << std::endl;
1336- this ->nspin = nspin_in;
1337- ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running, " nspin" , nspin);
1338-
1339- // set cartesian k vectors.
1340- KVectorUtils::k_vec_d2c (*this , reciprocal_vec);
1341-
1342- std::string table;
1343- table += " K-POINTS DIRECT COORDINATES\n " ;
1344- table += FmtCore::format (" %8s%12s%12s%12s%8s\n " , " KPOINTS" , " DIRECT_X" , " DIRECT_Y" , " DIRECT_Z" , " WEIGHT" );
1345- for (int i = 0 ; i < nks; i++)
1346- {
1347- table += FmtCore::format (" %8d%12.8f%12.8f%12.8f%8.4f\n " ,
1348- i + 1 ,
1349- this ->kvec_d [i].x ,
1350- this ->kvec_d [i].y ,
1351- this ->kvec_d [i].z ,
1352- this ->wk [i]);
1353- }
1354- GlobalV::ofs_running << table << std::endl;
1355- // this->set_both_kvec(reciprocal_vec, latvec);
1356-
1357- this ->print_klists (GlobalV::ofs_running);
1275+ KVectorUtils::set_after_vc (*this , nspin_in, reciprocal_vec);
13581276
13591277 return ;
13601278}
0 commit comments