From 9a953b9ac728ce7ac526a53338ea2ffd6b0abe49 Mon Sep 17 00:00:00 2001 From: abacus_fixer Date: Sun, 19 Apr 2026 20:55:56 +0800 Subject: [PATCH] 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. --- source/source_io/module_energy/write_eig_occ.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/source_io/module_energy/write_eig_occ.cpp b/source/source_io/module_energy/write_eig_occ.cpp index 018ff9a833..e589a66524 100644 --- a/source/source_io/module_energy/write_eig_occ.cpp +++ b/source/source_io/module_energy/write_eig_occ.cpp @@ -262,8 +262,13 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb, ofs_eig << std::setiosflags(std::ios::showpoint); for (int ib = 0; ib < ekb.nc; ib++) { + double occupation = wg(ik, ib); + if (std::abs(occupation) < 1.0e-15) + { + occupation = 0.0; + } ofs_eig << " " << ib + 1 << " " << ekb(ik, ib) * ModuleBase::Ry_to_eV - << " " << wg(ik, ib) << std::endl; + << " " << occupation << std::endl; } ofs_eig << std::endl; }