Skip to content

Commit 1501ed1

Browse files
committed
update the test read_wf2rho_pw_test.cpp
1 parent e78b052 commit 1501ed1

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

source/module_io/test/read_wf2rho_pw_test.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,30 @@ TEST_F(ReadWfcRhoTest, ReadWfcRho)
186186
wg.fill_out(1.0);
187187
if (GlobalV::MY_RANK == 0)
188188
{
189-
std::ofstream ofs("istate.info");
189+
// mohan update 2025-06-02
190+
std::ofstream ofs("eig.txt");
191+
ofs << " Electronic state energy (eV) and occupations" << std::endl;
192+
ofs << " Spin number " << nspin << std::endl;
193+
ofs << std::setprecision(8);
194+
ofs << std::setiosflags(std::ios::showpoint);
195+
196+
const int is = 0; // nspin is 1
190197
for (int ik = 0; ik < nkstot; ++ik)
191-
{
192-
ofs << "BAND Energy(ev) Occupation Kpoint" << std::endl;
193-
for (int ib = 0; ib < nbands; ++ib)
194-
{
195-
ofs << " " << ib + 1 << " 0.0000000 " << 1.0 << std::endl;
196-
}
198+
{
199+
ofs << " spin=" << is+1 << " k-point="
200+
<< ik + 1 << "/" << nkstot
201+
<< " Cartesian=" << kv->kvec_c[ik].x << " " << kv->kvec_c[ik].y
202+
<< " " << kv->kvec_c[ik].z << " (" << kv->ngk[ik] << " plane wave)" << std::endl;
203+
204+
ofs << std::setprecision(16);
205+
ofs << std::setiosflags(std::ios::showpoint);
206+
207+
double ekb = -1.23456; // energy
208+
for (int ib = 0; ib < nbands; ib++)
209+
{
210+
ofs << " " << ib + 1 << " " << ekb << " " << wg(ik,ib) << std::endl;
211+
}
212+
197213
ofs << std::endl;
198214
}
199215
ofs.close();
@@ -313,7 +329,7 @@ TEST_F(ReadWfcRhoTest, ReadWfcRho)
313329
if (GlobalV::MY_RANK == 0)
314330
{
315331
remove("running_log0.txt");
316-
remove("istate.info");
332+
remove("eig.txt");
317333
remove("wfs1k1_pw.dat");
318334
remove("wfs1k2_pw.dat");
319335
if (GlobalV::KPAR == 2)

0 commit comments

Comments
 (0)