Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions source/module_io/read_input_item_elec_stru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,7 @@ void ReadInput::item_elec_stru()
GlobalV::ofs_warning << " WARNING : gamma_only has not been implemented for pw yet" << std::endl;
GlobalV::ofs_warning << "gamma_only is not supported in the pw model" << std::endl;
GlobalV::ofs_warning << " the INPUT parameter gamma_only has been reset to 0" << std::endl;
GlobalV::ofs_warning << " and a new KPT is generated with "
"gamma point as the only k point"<< std::endl;
GlobalV::ofs_warning << " and a new KPT is generated with gamma point as the only k point"<< std::endl;
GlobalV::ofs_warning << " Auto generating k-points file: " << para.input.kpoint_file << std::endl;
std::ofstream ofs(para.input.kpoint_file.c_str());
ofs << "K_POINTS" << std::endl;
Expand All @@ -479,6 +478,13 @@ void ReadInput::item_elec_stru()
ofs << "1 1 1 0 0 0" << std::endl;
ofs.close();
}
if (para.input.basis_type == "lcao" && para.input.gamma_only)
{
if (para.input.nspin == 4)
{
ModuleBase::WARNING_QUIT("NOTICE", "nspin=4(soc or noncollinear-spin) does not support gamma only calculation");
}
}
};
this->add_item(item);
}
Expand Down
1 change: 1 addition & 0 deletions source/module_io/read_set_globalv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void ReadInput::set_globalv(Parameter& para)
{
para.sys.deepks_setorb = true;
}
/// set the noncolin and lspinorb from nspin
switch (para.input.nspin)
{
case 4:
Expand Down
8 changes: 8 additions & 0 deletions source/module_io/test_serial/read_input_item_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,14 @@ TEST_F(InputTest, Item_test)
ifs.close();
EXPECT_EQ(line, "K_POINTS");

param.input.basis_type = "lcao";
param.input.gamma_only = true;
param.input.nspin = 4;
testing::internal::CaptureStdout();
EXPECT_EXIT(it->second.reset_value(it->second, param), ::testing::ExitedWithCode(0), "");
output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr("NOTICE"));

}
{ // out_mat_r
auto it = find_label("out_mat_r", readinput.input_lists);
Expand Down
Loading