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
6 changes: 4 additions & 2 deletions source/module_base/test/global_function_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,10 @@ TEST_F(GlobalFunctionTest, MakeDir)
{
GlobalV::MY_RANK = 0;
ModuleBase::GlobalFunc::MAKE_DIR("scf");
std::system("test -d ");
std::system("rm -r scf ");
auto error1 = std::system("test -d ");
EXPECT_EQ(error1, 0);
auto error2 = std::system("rm -r scf ");
EXPECT_EQ(error2, 0);
SUCCEED();
}

Expand Down
2 changes: 2 additions & 0 deletions source/module_base/test/tool_threading_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ TEST(ToolThreadingTEST, OmpParalle)
EXPECT_THAT(output1,testing::HasSubstr("1"));
EXPECT_THAT(output1,testing::HasSubstr("0"));
}
#ifndef _OPENMP
#define _OPENMP
#endif
TEST(ToolThreadingTEST, OmpParalleOpenmp)
{
std::string output2;
Expand Down
6 changes: 4 additions & 2 deletions source/module_cell/test/unitcell_test_para.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ TEST_F(UcellTest,ReadPseudo)
ifs.close();
std::string command1 = "test -d C && rm -rf C";
std::string command2 = "test -d H && rm -rf H";
std::system( command1.c_str() );
std::system( command2.c_str() );
auto error1 = std::system( command1.c_str() );
EXPECT_EQ(error1,0);
auto error2 = std::system( command2.c_str() );
EXPECT_EQ(error2,0);
}
//read_cell_pseudopots
//bcast_unitcell2
Expand Down
5 changes: 5 additions & 0 deletions source/module_hamilt_general/module_xc/xc_functional_vxc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ std::tuple<double,double,ModuleBase::matrix> XC_Functional::v_xc_libxc( // Peiz
ModuleBase::timer::tick("XC_Functional","v_xc_libxc");
return std::make_tuple( etxc, vtxc, std::move(v_nspin4) );
} // end if(4==GlobalV::NSPIN)
else//NSPIN != 1,2,4 is not supported
{
throw std::domain_error("GlobalV::NSPIN ="+std::to_string(GlobalV::NSPIN)
+" unfinished in "+std::string(__FILE__)+" line "+std::to_string(__LINE__));
}
}

//the interface to libxc xc_mgga_exc_vxc(xc_func,n,rho,grho,laplrho,tau,e,v1,v2,v3,v4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ void OperatorLCAO<T>::init(const int ik_in)

break;
}
default:
{
ModuleBase::WARNING_QUIT("OperatorLCAO::init", "unknown cal_type");
break;
}
}
if(this->next_op != nullptr)
{//it is not the last node, loop next init() function
Expand Down
6 changes: 4 additions & 2 deletions source/module_io/restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ void Restart::write_file2(const std::string &file_name, const void*const ptr, co
{
const int file = open(file_name.c_str(), O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
if(-1==file) throw std::runtime_error("can't open restart save file. \nerrno="+ModuleBase::GlobalFunc::TO_STRING(errno)+".\n"+ModuleBase::GlobalFunc::TO_STRING(__FILE__)+" line "+ModuleBase::GlobalFunc::TO_STRING(__LINE__));
write(file, ptr, size);
auto error = write(file, ptr, size);
if(-1==error) throw std::runtime_error("can't write restart save file. \nerrno="+ModuleBase::GlobalFunc::TO_STRING(errno)+".\n"+ModuleBase::GlobalFunc::TO_STRING(__FILE__)+" line "+ModuleBase::GlobalFunc::TO_STRING(__LINE__) );
close(file);
}

void Restart::read_file2(const std::string &file_name, void*const ptr, const size_t size) const
{
const int file = open(file_name.c_str(), O_RDONLY);
if(-1==file) throw std::runtime_error("can't open restart load file. \nerrno="+ModuleBase::GlobalFunc::TO_STRING(errno)+".\n"+ModuleBase::GlobalFunc::TO_STRING(__FILE__)+" line "+ModuleBase::GlobalFunc::TO_STRING(__LINE__));
read(file, ptr, size);
auto error = read(file, ptr, size);
if(-1==error) throw std::runtime_error("can't read restart load file. \nerrno="+ModuleBase::GlobalFunc::TO_STRING(errno)+".\n"+ModuleBase::GlobalFunc::TO_STRING(__FILE__)+" line "+ModuleBase::GlobalFunc::TO_STRING(__LINE__));
close(file);
}

Expand Down
2 changes: 1 addition & 1 deletion source/module_io/test/input_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ TEST_F(InputTest, Check)

class ReadKSpacingTest : public ::testing::Test {
protected:
void SetUp()
void SetUp() override
{
// create a temporary file for testing
char tmpname[] = "tmpfile.tmp";
Expand Down