Skip to content

Commit 5be25fb

Browse files
author
abacus_fixer
committed
Revert "refactor(source_io): replace std::exception with WARNING_QUIT"
This reverts commit 39811c4.
1 parent 25528eb commit 5be25fb

7 files changed

Lines changed: 9 additions & 14 deletions

File tree

source/source_io/module_parameter/input_conv.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "source_base/global_function.h"
44
#include "source_base/global_variable.h"
5-
#include "source_base/tool_quit.h"
65
#include "source_cell/module_symmetry/symmetry.h"
76
#include "source_cell/unitcell.h"
87
#include "source_estate/occupy.h"
@@ -399,7 +398,7 @@ void Input_Conv::Convert()
399398
}
400399
else
401400
{
402-
ModuleBase::WARNING_QUIT("input_conv", "Invalid exx_hybrid_alpha type");
401+
throw std::invalid_argument(std::string(__FILE__)+" line "+std::to_string(__LINE__));
403402
}
404403
}
405404
if(!erfc_alpha.empty())

source/source_io/module_parameter/read_input_tool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <string>
22
#include <vector>
3+
#include <stdexcept>
34
#ifdef __MPI
45
#include "source_base/parallel_common.h"
56
#endif
6-
#include "source_base/tool_quit.h"
77

88
#define strvalue item.str_values[0]
99
#define intvalue std::stoi(item.str_values[0])
@@ -200,7 +200,7 @@ void parse_expression(const std::vector<std::string>& expressions, std::vector<T
200200
// If more than one '*' found, output an error message
201201
else
202202
{
203-
ModuleBase::WARNING_QUIT("split_expr", "Invalid expression: " + expr + " - More than one '*' found.");
203+
throw std::runtime_error("Invalid expression: " + expr + " - More than one '*' found.");
204204
}
205205
}
206206
}

source/source_io/module_unk/berryphase.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "source_cell/klist.h"
99
#include "source_psi/psi.h"
1010
#include "source_basis/module_ao/parallel_orbitals.h"
11-
#include "source_base/tool_quit.h"
1211

1312
class berryphase
1413
{
@@ -70,7 +69,7 @@ class berryphase
7069
const ModulePW::PW_Basis_K* wfcpw,
7170
const K_Vectors& kv)
7271
{
73-
ModuleBase::WARNING_QUIT("berryphase", "berry phase supports only multi-k");
72+
throw std::logic_error("berry phase supports only multi-k");
7473
};
7574
void Macroscopic_polarization(const UnitCell& ucell,
7675
const int npwx,

source/source_io/module_wannier/to_wannier90.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "source_base/math_polyint.h"
66
#include "source_base/math_sphbes.h"
77
#include "source_base/math_ylmreal.h"
8-
#include "source_base/tool_quit.h"
98

109
toWannier90::toWannier90()
1110
{
@@ -426,7 +425,8 @@ bool toWannier90::try_read_nnkp(const UnitCell& ucell, const K_Vectors& kv)
426425
}
427426
else
428427
{
429-
ModuleBase::WARNING_QUIT("toWannier90::read_nnkp", "numkpt_nnkp uninitialized, nspin must be 1 or 2");
428+
throw std::runtime_error("numkpt_nnkp uninitialized in " + std::string(__FILE__)
429+
+ " line " + std::to_string(__LINE__));
430430
}
431431

432432
for (int ik = 0; ik < numkpt_nnkp; ik++)

source/source_io/module_wannier/to_wannier90_lcao.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "source_base/parallel_reduce.h"
1111
#include "source_base/sph_bessel_recursive.h"
1212
#include "source_base/timer.h"
13-
#include "source_base/tool_quit.h"
1413
#include "source_base/vector3.h"
1514
#include "source_base/ylm.h"
1615
#include "source_basis/module_ao/ORB_atomic_lm.h"
@@ -91,7 +90,7 @@ class toWannier90_LCAO : public toWannier90
9190
const psi::Psi<double>& psi,
9291
const Parallel_Orbitals* pv)
9392
{
94-
ModuleBase::WARNING_QUIT("toWannier90_LCAO", "The wave function of toWannier90_LCAO is generally a std::complex<double> type.");
93+
throw std::logic_error("The wave function of toWannier90_LCAO_IN_PW is generally a std::complex<double> type.");
9594
}
9695

9796
void cal_Amn(const UnitCell& ucell, const K_Vectors& kv, const psi::Psi<std::complex<double>>& psi);

source/source_io/module_wannier/to_wannier90_lcao_in_pw.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "source_base/matrix3.h"
1010
#include "source_base/parallel_reduce.h"
1111
#include "source_base/timer.h"
12-
#include "source_base/tool_quit.h"
1312
#include "source_base/vector3.h"
1413
#include "source_base/ylm.h"
1514
#include "source_basis/module_ao/ORB_atomic_lm.h"
@@ -62,7 +61,7 @@ class toWannier90_LCAO_IN_PW : public toWannier90_PW
6261
const psi::Psi<double>* psi,
6362
const Parallel_Orbitals* pv)
6463
{
65-
ModuleBase::WARNING_QUIT("toWannier90_LCAO_IN_PW", "The wave function of toWannier90_LCAO_IN_PW is generally a std::complex<double> type.");
64+
throw std::logic_error("The wave function of toWannier90_LCAO_IN_PW is generally a std::complex<double> type.");
6665
}
6766

6867
protected:

source/source_io/module_wannier/to_wannier90_pw.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "source_base/global_function.h"
1414
#include "source_base/global_variable.h"
1515
#include "source_base/matrix.h"
16-
#include "source_base/tool_quit.h"
1716
#include "source_base/matrix3.h"
1817
#include "source_cell/klist.h"
1918
#include "source_lcao/wavefunc_in_pw.h"
@@ -51,7 +50,7 @@ class toWannier90_PW : public toWannier90
5150
const psi::Psi<double>* psi
5251
)
5352
{
54-
ModuleBase::WARNING_QUIT("toWannier90_PW", "The wave function of toWannier90_PW is generally a std::complex<double> type.");
53+
throw std::logic_error("The wave function of toWannier90_PW is generally a std::complex<double> type.");
5554
}
5655

5756
void cal_Amn(const psi::Psi<std::complex<double>>& psi_pw, const ModulePW::PW_Basis_K* wfcpw);

0 commit comments

Comments
 (0)