Skip to content

Commit ae6d7a4

Browse files
YuLiu98dyzheng
authored andcommitted
Fix: modify orb info manually (deepmodeling#5853)
1 parent 816fe47 commit ae6d7a4

File tree

3 files changed

+45
-41
lines changed

3 files changed

+45
-41
lines changed

source/module_basis/module_nao/atomic_radials.cpp

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

tests/PP_ORB/Ti_gga_8au_100Ry_4s2p2d1f.orb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Element Ti
33
Energy Cutoff(Ry) 100
44
Radius Cutoff(a.u.) 8
55
Lmax 3
6-
Number of Sorbital--> 4
6+
Number of Sorbital--> 3
77
Number of Porbital--> 2
88
Number of Dorbital--> 2
99
Number of Forbital--> 1
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
etotref -23542.4694009632003144
2-
etotperatomref -1569.4979600642
3-
totalforceref 735.306633
4-
totalstressref 771.858070
1+
etotref -23542.3282006428744353
2+
etotperatomref -1569.4885467095
3+
totalforceref 685.072329
4+
totalstressref 829.696556
55
pointgroupref C_1h
66
spacegroupref D_3h
77
nksibzref 4
8-
totaltimeref 18.68
8+
totaltimeref 21.81

0 commit comments

Comments
 (0)