Skip to content
Closed
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
4 changes: 3 additions & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@ OBJS_VDW=vdw.o\
vdwd3_parameters.o\
vdwd2.o\
vdwd3.o\
vdwd3_parameters_tab.o
vdwd3_parameters_tab.o\
vdwd3_autoset_xcparam.o\
vdwd3_autoset_xcname.o

OBJS_DFTU=dftu.o\
dftu_force.o\
Expand Down
146 changes: 69 additions & 77 deletions source/module_base/tool_quit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#endif

#ifdef __NORMAL

#else
#include "global_variable.h"
#include "module_parameter/parameter.h"
Expand All @@ -20,17 +19,14 @@ namespace ModuleBase
// NAME : WARNING( write information into GlobalV::ofs_warning)
// NAME : QUIT( exit the running program)
// NAME : WARNING_QUIT( write information into
// GlobalV::ofs_warning , and then quit)
// GlobalV::ofs_warning , and then quit)
//==========================================================
void WARNING(const std::string &file,const std::string &description)
{
#ifdef __NORMAL

#ifdef __NORMAL /* what is this??? */
#else

if (GlobalV::MY_RANK==0)
{
// std::cout << "\n "<<file<<" Warning : "<<description<<std::endl;
GlobalV::ofs_warning << " " << file <<" warning : "<< description<<std::endl;
}
#endif
Expand All @@ -39,69 +35,65 @@ void WARNING(const std::string &file,const std::string &description)

void QUIT()
{
QUIT(0);
/* it is quite strange to exit with code 0 by default... */
QUIT(0);
}

void QUIT(int ret)
void QUIT(const int ret)
{

#ifdef __NORMAL

#ifdef __NORMAL /* what is this??? */
#else
ModuleBase::timer::finish(GlobalV::ofs_running , !GlobalV::MY_RANK);

ModuleBase::Global_File::close_all_log(GlobalV::MY_RANK);

std::cout<<" See output information in : "<<PARAM.globalv.global_out_dir<<std::endl;
#endif

#ifdef __MPI /* if it is MPI run, finalize first, then exit */
MPI_Finalize();
#endif
exit(ret);
}


void WARNING_QUIT(const std::string &file,const std::string &description)
void WARNING_QUIT(const std::string &file, const std::string &description)
{
WARNING_QUIT(file, description, 0);
WARNING_QUIT(file, description, 0);
/* really? we return with 0? it is something like "we exit the program normally" */
}

void WARNING_QUIT(const std::string &file,const std::string &description,int ret)
void WARNING_QUIT(const std::string &file, const std::string &description, int ret)
{
#ifdef __NORMAL

std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " NOTICE " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

#ifdef __NORMAL /* what is this??? */
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " NOTICE " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
#else
std::cout << " " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " NOTICE " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << description << std::endl;
std::cout << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
std::cout << " " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " NOTICE " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;


GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << " NOTICE " << std::endl;
GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << std::endl;
GlobalV::ofs_running << " " << description << std::endl;
GlobalV::ofs_running << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
GlobalV::ofs_running << std::endl;
GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << " NOTICE " << std::endl;
GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

WARNING(file,description);
std::cout << " " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " NOTICE " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " " << std::endl;
std::cout << " " << description << std::endl;
std::cout << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
std::cout << " " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " NOTICE " << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;


GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << " NOTICE " << std::endl;
GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << std::endl;
GlobalV::ofs_running << " " << description << std::endl;
GlobalV::ofs_running << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
GlobalV::ofs_running << std::endl;
GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << " NOTICE " << std::endl;
GlobalV::ofs_running << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

WARNING(file,description);
GlobalV::ofs_running<<" Check in file : "<<PARAM.globalv.global_out_dir<<"warning.log"<<std::endl;

#endif

QUIT(ret);
}

Expand All @@ -112,34 +104,34 @@ void CHECK_WARNING_QUIT(const bool error_in, const std::string &file,const std::
#ifdef __NORMAL
// only for UT, do nothing here
#else
if(error_in)
{
//All cores will print inforamtion
std::cout.clear();
if(!GlobalV::ofs_running.is_open())
{
std::string logfile = PARAM.globalv.global_out_dir + "running_" + calculation + ".log";
GlobalV::ofs_running.open( logfile.c_str(), std::ios::app );
}
if(!GlobalV::ofs_warning.is_open())
{
std::string warningfile = PARAM.globalv.global_out_dir + "warning.log";
GlobalV::ofs_warning.open( warningfile.c_str(), std::ios::app );
}

//print error information
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " ERROR! " << description << std::endl;
std::cout << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << " ERROR! CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
GlobalV::ofs_warning << std::endl;
GlobalV::ofs_warning << " ERROR! " << file << ", core " << GlobalV::MY_RANK+1 << ": " << description << std::endl;
GlobalV::ofs_warning << std::endl;
exit(1);
}
if(error_in)
{
//All cores will print inforamtion
std::cout.clear();
if(!GlobalV::ofs_running.is_open())
{
std::string logfile = PARAM.globalv.global_out_dir + "running_" + calculation + ".log";
GlobalV::ofs_running.open( logfile.c_str(), std::ios::app );
}
if(!GlobalV::ofs_warning.is_open())
{
std::string warningfile = PARAM.globalv.global_out_dir + "warning.log";
GlobalV::ofs_warning.open( warningfile.c_str(), std::ios::app );
}

//print error information
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << " ERROR! " << description << std::endl;
std::cout << " CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
std::cout << " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
GlobalV::ofs_running << " ERROR! CHECK IN FILE : " << PARAM.globalv.global_out_dir << "warning.log" << std::endl;
GlobalV::ofs_warning << std::endl;
GlobalV::ofs_warning << " ERROR! " << file << ", core " << GlobalV::MY_RANK+1 << ": " << description << std::endl;
GlobalV::ofs_warning << std::endl;
exit(1);
}
#endif
return;
return;
}

}
2 changes: 1 addition & 1 deletion source/module_base/tool_quit.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void WARNING(const std::string &file, const std::string &description);
* @brief Close .log files and exit
*
*/
[[noreturn]] void QUIT(int ret);
[[noreturn]] void QUIT(const int ret);

/**
* @brief Combine the functions of WARNING and QUIT
Expand Down
2 changes: 2 additions & 0 deletions source/module_hamilt_general/module_vdw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ add_library(
vdwd2_parameters.cpp
vdwd3_parameters_tab.cpp
vdwd3_parameters.cpp
vdwd3_autoset_xcname.cpp
vdwd3_autoset_xcparam.cpp
vdwd2.cpp
vdwd3.cpp
vdw.cpp
Expand Down
Loading
Loading