@@ -14,7 +14,8 @@ void ModuleIO::read_wfc_nao_one_data(std::ifstream& ifs, double& data)
1414
1515void ModuleIO::read_wfc_nao_one_data (std::ifstream& ifs, std::complex <double >& data)
1616{
17- double a = 0.0 , b = 0.0 ;
17+ double a = 0.0 ;
18+ double b = 0.0 ;
1819 ifs >> a >> b;
1920 data = std::complex <double >(a, b);
2021}
@@ -24,15 +25,19 @@ bool ModuleIO::read_wfc_nao(
2425 const std::string& global_readin_dir,
2526 const Parallel_Orbitals& ParaV,
2627 psi::Psi<T>& psid,
27- elecstate::ElecState* const pelec,
28+ elecstate::ElecState* const pelec,
29+ const std::vector<int > &ik2iktot,
30+ const int nkstot,
31+ const int nspin,
2832 const int skip_band)
2933{
3034 ModuleBase::TITLE (" ModuleIO" , " read_wfc_nao" );
3135 ModuleBase::timer::tick (" ModuleIO" , " read_wfc_nao" );
3236
33- int nk = pelec->ekb .nr ;
34- bool gamma_only = std::is_same<T, double >::value;
35- int out_type = 1 ; // only support text file now
37+ const int nk = pelec->ekb .nr ;
38+
39+ const bool gamma_only = std::is_same<T, double >::value;
40+ const int out_type = 1 ; // only support .txt file now
3641 bool read_success = true ;
3742 int myrank = 0 ;
3843 int nbands = ParaV.get_wfc_global_nbands (); // the global number of bands
@@ -129,20 +134,31 @@ bool ModuleIO::read_wfc_nao(
129134 }
130135 ifs.close ();
131136 return true ;
132- };
137+ }; // end read one file
133138
134139
135140 std::string errors;
136- std::vector<T> ctot ((myrank==0 )?nbands * nlocal:0 );
141+
142+ std::vector<T> ctot;
143+ if (myrank == 0 )
144+ {
145+ ctot.resize (nbands * nlocal);
146+ }
147+ else
148+ {
149+ ctot.resize (0 );
150+ }
137151
138152 for (int ik=0 ;ik<nk;ik++)
139153 {
140154 if (myrank == 0 )
141155 {
156+ const bool out_app_flag = false ;
157+ const int nstep = -1 ;
142158 std::stringstream error_message;
143159 std::string ss = global_readin_dir + ModuleIO::wfc_nao_gen_fname (
144- out_type, gamma_only, false , ik,
145- pelec-> klist -> ik2iktot , pelec-> klist -> get_nkstot (), PARAM. inp . nspin );
160+ out_type, gamma_only, out_app_flag , ik,
161+ ik2iktot, nkstot, nspin, nstep );
146162
147163 read_success = read_one_file (ss, error_message, ik, ctot);
148164 errors = error_message.str ();
@@ -186,11 +202,17 @@ bool ModuleIO::read_wfc_nao(
186202template bool ModuleIO::read_wfc_nao<double >(const std::string& global_readin_dir,
187203 const Parallel_Orbitals& ParaV,
188204 psi::Psi<double >& psid,
189- elecstate::ElecState* const pelec,
205+ elecstate::ElecState* const pelec,
206+ const std::vector<int > &ik2iktot,
207+ const int nkstot,
208+ const int nspin,
190209 const int skip_band);
191210
192211template bool ModuleIO::read_wfc_nao<std::complex <double >>(const std::string& global_readin_dir,
193212 const Parallel_Orbitals& ParaV,
194- psi::Psi<std::complex <double >>& psid,
195- elecstate::ElecState* const pelec,
196- const int skip_band);
213+ psi::Psi<std::complex <double >>& psid,
214+ elecstate::ElecState* const pelec,
215+ const std::vector<int > &ik2iktot,
216+ const int nkstot,
217+ const int nspin,
218+ const int skip_band);
0 commit comments