@@ -600,11 +600,30 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry &symm, bool use_symm)
600600// {
601601// out.printM3("rot matrix",kgmatrix[i]);
602602// }
603-
603+ // output in kpoints file
604+ std::stringstream ss;
605+ ss << GlobalV::global_readin_dir << " kpoints" ;
606+ std::ofstream ofkpt ( ss.str ().c_str ()); // clear kpoints
607+ ofkpt<< " " << std::setw (40 ) <<" nkstot" << " = " << nkstot
608+ << std::setw (66 ) << " ibzkpt" << std::endl;
609+ ofkpt << " " << std::setw (8 ) << " KPT"
610+ << std::setw (20 ) << " DirectX"
611+ << std::setw (20 ) << " DirectY"
612+ << std::setw (20 ) << " DirectZ"
613+ << std::setw (8 ) << " IBZ"
614+ << std::setw (20 ) << " DirectX"
615+ << std::setw (20 ) << " DirectY"
616+ << std::setw (20 ) << " DirectZ" << std::endl;
604617
605618 // search in all k-poins.
606619 for (int i = 0 ; i < nkstot; ++i)
607620 {
621+ // output in kpoints file
622+ ofkpt << " "
623+ << std::setw (8 ) << i+1
624+ << std::setw (20 ) << this ->kvec_d [i].x
625+ << std::setw (20 ) << this ->kvec_d [i].y
626+ << std::setw (20 ) << this ->kvec_d [i].z ;
608627 // std::cout << "\n kpoint = " << i << std::endl;
609628 // std::cout << "\n kvec_d = " << kvec_d[i].x << " " << kvec_d[i].y << " " << kvec_d[i].z;
610629 bool already_exist = false ;
@@ -637,10 +656,15 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry &symm, bool use_symm)
637656 symm.equal (kvec_rot.z , this ->kvec_d_ibz [k].z ))
638657 {
639658 already_exist = true ;
640-
641659 // find another ibz k point,
642660 // but is already in the ibz_kpoint list.
643- // so the weight need to +1;
661+ // so the weight need to +1;
662+ // output in kpoints file
663+ ofkpt << std::setw (8 ) << k+1
664+ << std::setw (20 ) << this ->kvec_d_ibz [k].x
665+ << std::setw (20 ) << this ->kvec_d_ibz [k].y
666+ << std::setw (20 ) << this ->kvec_d_ibz [k].z << std::endl;
667+
644668 this ->wk_ibz [k] += weight;
645669 exist_number = k;
646670 break ;
@@ -654,6 +678,11 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry &symm, bool use_symm)
654678 // if it's a new ibz kpoint.
655679 // nkstot_ibz indicate the index of ibz kpoint.
656680 this ->kvec_d_ibz [nkstot_ibz] = kvec_rot;
681+ // output in kpoints file
682+ ofkpt << std::setw (8 ) << nkstot_ibz+1
683+ << std::setw (20 ) << this ->kvec_d_ibz [nkstot_ibz].x
684+ << std::setw (20 ) << this ->kvec_d_ibz [nkstot_ibz].y
685+ << std::setw (20 ) << this ->kvec_d_ibz [nkstot_ibz].z << std::endl;
657686
658687 // the weight should be averged k-point weight.
659688 this ->wk_ibz [nkstot_ibz] = weight;
@@ -692,6 +721,9 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry &symm, bool use_symm)
692721 }
693722// BLOCK_HERE("check k point");
694723 }
724+
725+ ofkpt.close ();
726+
695727 ModuleBase::GlobalFunc::OUT (GlobalV::ofs_running," nkstot_ibz" ,nkstot_ibz);
696728
697729 GlobalV::ofs_running << " " << std::setw (8 ) << " IBZ" << std::setw (20 ) << " DirectX"
@@ -795,6 +827,27 @@ void K_Vectors::set_both_kvec(const ModuleBase::Matrix3 &G, const ModuleBase::Ma
795827 << std::setw (20 ) << this ->wk [i] << std::endl;
796828 }
797829
830+ if (GlobalV::MY_RANK==0 )
831+ {
832+ std::stringstream ss;
833+ ss << GlobalV::global_readin_dir << " kpoints" ;
834+ std::ofstream ofkpt ( ss.str ().c_str (), ios::app ); // clear kpoints
835+ ofkpt << " " << std::setw (40 ) <<" nkstot now" << " = " << nkstot << std::endl;
836+ ofkpt << " " << std::setw (8 ) << " KPT" << std::setw (20 ) << " DirectX"
837+ << std::setw (20 ) << " DirectY" << std::setw (20 ) << " DirectZ"
838+ << std::setw (20 ) << " Weight" << std::endl;
839+ for (int ik=0 ; ik<nkstot; ik++)
840+ {
841+ ofkpt << " " << std::setw (8 ) << ik+1
842+ << std::setw (20 ) << this ->kvec_d [ik].x
843+ << std::setw (20 ) << this ->kvec_d [ik].y
844+ << std::setw (20 ) << this ->kvec_d [ik].z
845+ << std::setw (20 ) << this ->wk [ik] << std::endl;
846+ // << std::setw(10) << this->ibz2bz[ik] << std::endl;
847+ }
848+ ofkpt.close ();
849+ }
850+
798851 return ;
799852}
800853
0 commit comments