From 2d5089254ebb794aeadaaff22a1373a95ffa81a0 Mon Sep 17 00:00:00 2001 From: YuLiu98 Date: Mon, 13 Jan 2025 11:56:19 +0800 Subject: [PATCH] Fix: modify orb info manually --- .../module_nao/atomic_radials.cpp | 74 ++++++++++--------- tests/PP_ORB/Ti_gga_8au_100Ry_4s2p2d1f.orb | 2 +- tests/integrate/284_NO_KP_symmetry/result.ref | 10 +-- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/source/module_basis/module_nao/atomic_radials.cpp b/source/module_basis/module_nao/atomic_radials.cpp index e2461a3970..42a9867662 100644 --- a/source/module_basis/module_nao/atomic_radials.cpp +++ b/source/module_basis/module_nao/atomic_radials.cpp @@ -221,51 +221,55 @@ void AtomicRadials::read_abacus_orb(std::ifstream& ifs, std::ofstream* ptr_log, is_read[i] = false; } - int l = 0; - int izeta = 0; - for (int i = 0; i != nchi_; ++i) + for (int l = 0; l <= lmax_; ++l) { - if (rank == 0) + for (int izeta = 0; izeta < nzeta_[l]; ++izeta) { - /* - * read the orbital information, including - * - * 1. angular momentum - * 2. zeta number - * 3. values on the grid - * */ - // ifs >> tmp >> tmp >> tmp; // skip "Type" "L" "N" - ifs >> tmp >> tmp >> tmp; -#ifdef __DEBUG - assert(tmp == "N"); -#endif - - ifs >> tmp >> l >> izeta; -#ifdef __DEBUG - assert(l >= 0 && l <= lmax_); - assert(izeta >= 0 && izeta < nzeta_[l]); -#endif - - for (int ir = 0; ir != ngrid; ++ir) + if (rank == 0) { - ifs >> rvalue[ir]; + /* + * read the orbital information, including + * + * 1. angular momentum + * 2. zeta number + * 3. values on the grid + * */ + while (ifs.good()) + { + while (ifs >> tmp) + { + if (tmp == "N") + { + break; + } + } + int read_l, read_izeta; + ifs >> tmp >> read_l >> read_izeta; + if (l == read_l && izeta == read_izeta) + { + break; + } + } + + for (int ir = 0; ir != ngrid; ++ir) + { + ifs >> rvalue[ir]; + } } - } #ifdef __MPI - Parallel_Common::bcast_int(l); - Parallel_Common::bcast_int(izeta); - Parallel_Common::bcast_double(rvalue, ngrid); + Parallel_Common::bcast_double(rvalue, ngrid); #endif #ifdef __DEBUG - assert(index(l, izeta) >= 0 && index(l, izeta) < nchi_); - assert(!is_read[index(l, izeta)]); + assert(index(l, izeta) >= 0 && index(l, izeta) < nchi_); + assert(!is_read[index(l, izeta)]); #endif - is_read[index(l, izeta)] = true; + is_read[index(l, izeta)] = true; - // skip the initialization of sbt_ in this stage - chi_[index(l, izeta)].build(l, true, ngrid, rgrid, rvalue, 0, izeta, symbol_, itype_, false); - chi_[index(l, izeta)].normalize(); + // skip the initialization of sbt_ in this stage + chi_[index(l, izeta)].build(l, true, ngrid, rgrid, rvalue, 0, izeta, symbol_, itype_, false); + chi_[index(l, izeta)].normalize(); + } } delete[] is_read; diff --git a/tests/PP_ORB/Ti_gga_8au_100Ry_4s2p2d1f.orb b/tests/PP_ORB/Ti_gga_8au_100Ry_4s2p2d1f.orb index 53c70a7b2a..1d626176a4 100644 --- a/tests/PP_ORB/Ti_gga_8au_100Ry_4s2p2d1f.orb +++ b/tests/PP_ORB/Ti_gga_8au_100Ry_4s2p2d1f.orb @@ -3,7 +3,7 @@ Element Ti Energy Cutoff(Ry) 100 Radius Cutoff(a.u.) 8 Lmax 3 -Number of Sorbital--> 4 +Number of Sorbital--> 3 Number of Porbital--> 2 Number of Dorbital--> 2 Number of Forbital--> 1 diff --git a/tests/integrate/284_NO_KP_symmetry/result.ref b/tests/integrate/284_NO_KP_symmetry/result.ref index 2971aacf21..dce80e2293 100644 --- a/tests/integrate/284_NO_KP_symmetry/result.ref +++ b/tests/integrate/284_NO_KP_symmetry/result.ref @@ -1,8 +1,8 @@ -etotref -23542.4694009632003144 -etotperatomref -1569.4979600642 -totalforceref 735.306633 -totalstressref 771.858070 +etotref -23542.3282006428744353 +etotperatomref -1569.4885467095 +totalforceref 685.072329 +totalstressref 829.696556 pointgroupref C_1h spacegroupref D_3h nksibzref 4 -totaltimeref 18.68 +totaltimeref 21.81