Skip to content

Commit eae0460

Browse files
committed
update the reading wave functions according to eig.txt instead of the old istate.info
1 parent 585fc9b commit eae0460

File tree

4 files changed

+60
-73
lines changed

4 files changed

+60
-73
lines changed

source/module_io/read_wf2rho_pw.cpp

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void ModuleIO::read_wf2rho_pw(
6565
ModuleBase::matrix wg_tmp(nkstot, nbands);
6666
if (my_rank == 0)
6767
{
68-
std::string filename = readin_dir + "istate.info";
68+
std::string filename = readin_dir + "eig.txt";
6969
std::ifstream ifs(filename);
7070

7171
if(!ifs)
@@ -79,33 +79,19 @@ void ModuleIO::read_wf2rho_pw(
7979
ofs_running << " Find file containing weights of wave function: " << filename << std::endl;
8080
}
8181

82-
std::string useless;
83-
if (nspin == 2)
84-
{
85-
const int nkstot_np = nkstot / 2;
86-
for (int iktot_np = 0; iktot_np < nkstot_np; ++iktot_np)
87-
{
88-
ifs >> useless;
89-
getline(ifs, useless);
90-
for (int ib = 0; ib < nbands; ++ib)
91-
{
92-
ifs >> useless >> useless >> wg_tmp(iktot_np, ib) >> useless >> wg_tmp(iktot_np + nkstot_np, ib);
93-
}
94-
}
95-
}
96-
else
97-
{
98-
for (int ik_tot = 0; ik_tot < nkstot; ++ik_tot)
99-
{
100-
ifs >> useless;
101-
getline(ifs, useless);
102-
for (int ib = 0; ib < nbands; ++ib)
103-
{
104-
ifs >> useless >> useless >> wg_tmp(ik_tot, ib);
105-
}
106-
}
107-
}
108-
}
82+
std::string useless;
83+
getline(ifs, useless);
84+
getline(ifs, useless);
85+
for (int ik_tot = 0; ik_tot < nkstot; ++ik_tot)
86+
{
87+
ifs >> useless;
88+
getline(ifs, useless);
89+
for (int ib = 0; ib < nbands; ++ib)
90+
{
91+
ifs >> useless >> useless >> wg_tmp(ik_tot, ib);
92+
}
93+
}
94+
}
10995

11096
#ifdef __MPI
11197
MPI_Bcast(wg_tmp.c, nkstot * nbands, MPI_DOUBLE, 0, MPI_COMM_WORLD);

source/module_io/write_istate_info.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void ModuleIO::write_istate_info(const ModuleBase::matrix &ekb,const ModuleBase:
7777
if (GlobalV::MY_POOL == ip && ip_flag)
7878
{
7979
std::ofstream ofs_eig(filename.c_str(), std::ios::app);
80-
ofs_eig << std::setprecision(5);
80+
ofs_eig << std::setprecision(8);
8181
ofs_eig << std::setiosflags(std::ios::showpoint);
8282

8383
const int start_ik = nks_np * is;
@@ -89,12 +89,12 @@ void ModuleIO::write_istate_info(const ModuleBase::matrix &ekb,const ModuleBase:
8989
<< " Cartesian=" << kv.kvec_c[ik].x << " " << kv.kvec_c[ik].y
9090
<< " " << kv.kvec_c[ik].z << " (" << ngk_tot[ik] << " plane wave)" << std::endl;
9191

92-
ofs_eig << std::setprecision(6);
92+
ofs_eig << std::setprecision(12);
9393
ofs_eig << std::setiosflags(std::ios::showpoint);
9494
for (int ib = 0; ib < ekb.nc; ib++)
9595
{
96-
ofs_eig << std::setw(8) << ib + 1 << std::setw(15) << ekb(ik, ib) * ModuleBase::Ry_to_eV
97-
<< std::setw(15) << wg(ik, ib) << std::endl;
96+
ofs_eig << " " << ib + 1 << " " << ekb(ik, ib) * ModuleBase::Ry_to_eV
97+
<< " " << wg(ik, ib) << std::endl;
9898
}
9999
ofs_eig << std::endl;
100100
}

tests/01_PW/057_PW_SO_IW/eig.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Electronic state energy (eV) and occupations
2+
Spin number 4
3+
spin=1 k-point=1/1 Cartesian=0.0000000 0.0000000 0.0000000 (459 plane wave)
4+
1 -5.80225222622 1.00000000000
5+
2 -4.86534434633 1.00000000000
6+
3 -1.35559361415 1.00000000000
7+
4 -1.28770881944 1.00000000000
8+
5 -1.20706060019 1.00000000000
9+
6 -0.832239230496 1.00000000000
10+
7 -0.745307723916 1.00000000000
11+
8 -0.697268567366 1.00000000000
12+
9 -0.112301628562 1.00000000000
13+
10 0.123623125781 1.00000000000
14+
11 0.341813744923 1.00000000000
15+
12 0.428354671894 1.00000000000
16+
13 5.04091981334 1.00000000000
17+
14 5.77892613770 1.00000000000
18+
15 7.80569592791 1.00000000000
19+
16 7.87725397013 1.00000000000
20+
17 8.15442595699 1.00000000000
21+
18 8.89322368722 1.00000000000
22+
19 9.11964038392 0.00000000000
23+
20 9.19552421755 0.00000000000
24+
21 10.5213838032 0.00000000000
25+
22 10.6320182260 0.00000000000
26+
23 10.8531271179 0.00000000000
27+
24 11.3477901066 0.00000000000
28+
25 11.5256948470 0.00000000000
29+
26 11.6581831328 0.00000000000
30+
27 14.3648470428 0.00000000000
31+
28 14.6499211384 0.00000000000
32+
29 20.2108680938 0.00000000000
33+
30 20.2320077701 0.00000000000
34+
31 20.2362409803 0.00000000000
35+
32 20.3432622143 0.00000000000
36+
33 20.4942834293 0.00000000000
37+
34 20.6081562024 0.00000000000
38+
35 20.6542582936 0.00000000000
39+
36 20.6743662012 0.00000000000
40+
37 21.2186717697 0.00000000000
41+
38 21.4338476449 0.00000000000
42+

tests/01_PW/057_PW_SO_IW/istate.info

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)