File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
source/module_hamilt_lcao/module_dftu Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ void DFTU::write_occup_m(const UnitCell& ucell,
119119 if (PARAM.inp .nspin == 1 || PARAM.inp .nspin == 2 )
120120 {
121121 double sum0[2 ];
122- for (int is = 0 ; is < 2 ; is++)
122+ for (int is = 0 ; is < PARAM. inp . nspin ; is++)
123123 {
124124 if (diag)// diagonalization for local occupation matrix and print the eigenvalues
125125 {
@@ -144,19 +144,22 @@ void DFTU::write_occup_m(const UnitCell& ucell,
144144 ofs << std::setw (12 ) << std::setprecision (8 ) << std::fixed
145145 << sum0[is] << std::endl;
146146 }
147- ofs << " spin"
148- << " " << is << std::endl;
149- for (int m0 = 0 ; m0 < 2 * l + 1 ; m0++)
147+ else
150148 {
151- for (int m1 = 0 ; m1 < 2 * l + 1 ; m1++)
149+ ofs << " spin"
150+ << " " << is << std::endl;
151+ for (int m0 = 0 ; m0 < 2 * l + 1 ; m0++)
152152 {
153- ofs << std::setw (12 ) << std::setprecision (8 ) << std::fixed
154- << locale[iat][l][n][is](m0, m1);
153+ for (int m1 = 0 ; m1 < 2 * l + 1 ; m1++)
154+ {
155+ ofs << std::setw (12 ) << std::setprecision (8 ) << std::fixed
156+ << locale[iat][l][n][is](m0, m1);
157+ }
158+ ofs << std::endl;
155159 }
156- ofs << std::endl;
157160 }
158161 }
159- if (diag)
162+ if (diag && PARAM. inp . nspin == 2 )
160163 {
161164 ofs << std::setw (12 ) << std::setprecision (8 ) << std::fixed<< " atomic mag: " <<iat<<" " << sum0[0 ] - sum0[1 ] << std::endl;
162165 }
You can’t perform that action at this time.
0 commit comments