Skip to content

Commit 8368c62

Browse files
mohanchenabacus_fixer
andauthored
add a small threshold (e.g., 1.0e-15) when writing occupation numbers to eig_occ.txt. For example, if occupation < 1e-15, print 0.0 instead of the tiny numerical value. (#7257)
Co-authored-by: abacus_fixer <mohanchen@pku.eud.cn>
1 parent 9273888 commit 8368c62

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

source/source_io/module_energy/write_eig_occ.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,13 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb,
262262
ofs_eig << std::setiosflags(std::ios::showpoint);
263263
for (int ib = 0; ib < ekb.nc; ib++)
264264
{
265+
double occupation = wg(ik, ib);
266+
if (std::abs(occupation) < 1.0e-15)
267+
{
268+
occupation = 0.0;
269+
}
265270
ofs_eig << " " << ib + 1 << " " << ekb(ik, ib) * ModuleBase::Ry_to_eV
266-
<< " " << wg(ik, ib) << std::endl;
271+
<< " " << occupation << std::endl;
267272
}
268273
ofs_eig << std::endl;
269274
}

0 commit comments

Comments
 (0)