Skip to content

Commit 5ccb292

Browse files
authored
set two_fermi to false for nspin == 1 and add extra checks (#5305)
1 parent 7fdb1a3 commit 5ccb292

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

source/module_io/read_input_item_elec_stru.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,18 @@ void ReadInput::item_elec_stru()
235235
para.input.nupdown = doublevalue;
236236
para.sys.two_fermi = true;
237237
};
238-
238+
item.reset_value = [](const Input_Item&, Parameter& para) {
239+
if (para.input.nspin == 1)
240+
{
241+
para.sys.two_fermi = false;
242+
}
243+
};
244+
item.check_value = [](const Input_Item&, const Parameter& para) {
245+
if (para.input.nspin == 1 && para.input.nupdown != 0.0)
246+
{
247+
ModuleBase::WARNING_QUIT("ReadInput", "nupdown mustn't have a non-zero value for spin-unpolarized calculations.");
248+
}
249+
};
239250
sync_double(input.nupdown);
240251
this->add_item(item);
241252
}

0 commit comments

Comments
 (0)