Skip to content

Commit

Permalink
set two_fermi to false for nspin == 1 and add extra checks (#5305)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzx10 authored Oct 18, 2024
1 parent 7fdb1a3 commit 5ccb292
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/module_io/read_input_item_elec_stru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,18 @@ void ReadInput::item_elec_stru()
para.input.nupdown = doublevalue;
para.sys.two_fermi = true;
};

item.reset_value = [](const Input_Item&, Parameter& para) {
if (para.input.nspin == 1)
{
para.sys.two_fermi = false;
}
};
item.check_value = [](const Input_Item&, const Parameter& para) {
if (para.input.nspin == 1 && para.input.nupdown != 0.0)
{
ModuleBase::WARNING_QUIT("ReadInput", "nupdown mustn't have a non-zero value for spin-unpolarized calculations.");
}
};
sync_double(input.nupdown);
this->add_item(item);
}
Expand Down

0 comments on commit 5ccb292

Please sign in to comment.