@@ -221,51 +221,55 @@ void AtomicRadials::read_abacus_orb(std::ifstream& ifs, std::ofstream* ptr_log,
221221 is_read[i] = false ;
222222 }
223223
224- int l = 0 ;
225- int izeta = 0 ;
226- for (int i = 0 ; i != nchi_; ++i)
224+ for (int l = 0 ; l <= lmax_; ++l)
227225 {
228- if (rank == 0 )
226+ for ( int izeta = 0 ; izeta < nzeta_[l]; ++izeta )
229227 {
230- /*
231- * read the orbital information, including
232- *
233- * 1. angular momentum
234- * 2. zeta number
235- * 3. values on the grid
236- * */
237- // ifs >> tmp >> tmp >> tmp; // skip "Type" "L" "N"
238- ifs >> tmp >> tmp >> tmp;
239- #ifdef __DEBUG
240- assert (tmp == " N" );
241- #endif
242-
243- ifs >> tmp >> l >> izeta;
244- #ifdef __DEBUG
245- assert (l >= 0 && l <= lmax_);
246- assert (izeta >= 0 && izeta < nzeta_[l]);
247- #endif
248-
249- for (int ir = 0 ; ir != ngrid; ++ir)
228+ if (rank == 0 )
250229 {
251- ifs >> rvalue[ir];
230+ /*
231+ * read the orbital information, including
232+ *
233+ * 1. angular momentum
234+ * 2. zeta number
235+ * 3. values on the grid
236+ * */
237+ while (ifs.good ())
238+ {
239+ while (ifs >> tmp)
240+ {
241+ if (tmp == " N" )
242+ {
243+ break ;
244+ }
245+ }
246+ int read_l, read_izeta;
247+ ifs >> tmp >> read_l >> read_izeta;
248+ if (l == read_l && izeta == read_izeta)
249+ {
250+ break ;
251+ }
252+ }
253+
254+ for (int ir = 0 ; ir != ngrid; ++ir)
255+ {
256+ ifs >> rvalue[ir];
257+ }
252258 }
253- }
254259
255260#ifdef __MPI
256- Parallel_Common::bcast_int (l);
257- Parallel_Common::bcast_int (izeta);
258- Parallel_Common::bcast_double (rvalue, ngrid);
261+ Parallel_Common::bcast_double (rvalue, ngrid);
259262#endif
260263#ifdef __DEBUG
261- assert (index (l, izeta) >= 0 && index (l, izeta) < nchi_);
262- assert (!is_read[index (l, izeta)]);
264+ assert (index (l, izeta) >= 0 && index (l, izeta) < nchi_);
265+ assert (!is_read[index (l, izeta)]);
263266#endif
264- is_read[index (l, izeta)] = true ;
267+ is_read[index (l, izeta)] = true ;
265268
266- // skip the initialization of sbt_ in this stage
267- chi_[index (l, izeta)].build (l, true , ngrid, rgrid, rvalue, 0 , izeta, symbol_, itype_, false );
268- chi_[index (l, izeta)].normalize ();
269+ // skip the initialization of sbt_ in this stage
270+ chi_[index (l, izeta)].build (l, true , ngrid, rgrid, rvalue, 0 , izeta, symbol_, itype_, false );
271+ chi_[index (l, izeta)].normalize ();
272+ }
269273 }
270274
271275 delete[] is_read;
0 commit comments