Skip to content

Commit cbc5c0f

Browse files
author
dyzheng
committed
Fix(dftu): write dm_onsite.txt format matching read_occup_m parser
write_occup_m emits tokens like "Atom=1" (no space after '='), but read_occup_m reads with >> and strcmp against "Atom=". The mismatch causes NSCF runs reading dm_onsite.txt to fail with "WRONG IN READING LOCAL OCCUPATION NUMBER MATRIX FROM Plus_U FILE". Add a space after '=' for Atom, L, ORBITAL, and spin tokens so the written format matches what read_occup_m expects. Verified with the examples/19_dftu/01_lcao_NiO DFT+U case: SCF converges and the subsequent NSCF step completes successfully.
1 parent dd1a240 commit cbc5c0f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

source/source_lcao/module_dftu/dftu_io.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ void Plus_U::write_occup_m(const UnitCell& ucell,
125125
continue;
126126
}
127127

128-
ofs << "\n Atom=" << iat+1;
129-
ofs << " L=" << l;
130-
ofs << " ORBITAL=" << n << std::endl;
128+
ofs << "\n Atom= " << iat+1;
129+
ofs << " L= " << l;
130+
ofs << " ORBITAL= " << n << std::endl;
131131

132132
if (nspin == 1 || nspin == 2)
133133
{
@@ -156,7 +156,7 @@ void Plus_U::write_occup_m(const UnitCell& ucell,
156156
ofs << std::endl;
157157
ofs << " sum is " << std::setw(12) << sum0[is] << std::endl;
158158
}
159-
ofs << " spin=" << is+1 << std::endl;
159+
ofs << " spin= " << is+1 << std::endl;
160160
ofs << std::setprecision(8) << std::fixed;
161161
for (int m0 = 0; m0 < 2 * l + 1; m0++)
162162
{

0 commit comments

Comments
 (0)