11#ifndef GLOBAL_FUNCTION_H
22#define GLOBAL_FUNCTION_H
33
4- #include " module_external/blas_connector.h"
54#include " glob_fn_each2.h" // Peize Lin add 2016-09-07
65#include " global_variable.h"
6+ #include " module_external/blas_connector.h"
77#include " tool_check.h" // mohan add 2021-05-08
88#include " tool_quit.h" // mohan add 2021-05-07
99#include " tool_title.h" // mohan add 2021-05-05
@@ -146,37 +146,34 @@ static void READ_VALUE(std::ifstream& ifs, T& v)
146146}
147147
148148// -------------------------------------------------------------
149- // ! The `SCAN_BEGIN` function efficiently searches
150- // ! text files for specified keywords
149+ // ! The `SCAN_BEGIN` function efficiently searches
150+ // ! text files for specified keywords
151151// -------------------------------------------------------------
152- bool SCAN_BEGIN (std::ifstream& ifs,
153- const std::string& TargetName,
154- const bool restart = true ,
155- const bool ifwarn = true );
152+ bool SCAN_BEGIN (std::ifstream& ifs, const std::string& TargetName, const bool restart = true , const bool ifwarn = true );
156153
157154// -------------------------------------------------------------
158- // The `SCAN_LINE_BEGIN` function efficiently searches
155+ // The `SCAN_LINE_BEGIN` function efficiently searches
159156// text files for specified keywords while ignoring comment
160- // lines and whitespace. It skips any line starting with '#'
157+ // lines and whitespace. It skips any line starting with '#'
161158// -------------------------------------------------------------
162- bool SCAN_LINE_BEGIN (std::ifstream& ifs,
163- const std::string& TargetName,
164- const bool restart = true ,
165- const bool ifwarn = true );
159+ bool SCAN_LINE_BEGIN (std::ifstream& ifs, const std::string& TargetName, const bool restart = true , const bool ifwarn = true );
166160
167161void SCAN_END (std::ifstream& ifs, const std::string& TargetName, const bool ifwarn = true );
168162
169163template <class T >
170164static inline void DCOPY (const T& a, T& b, const int & dim)
171165{
172- for (int i = 0 ; i < dim; ++i) {
166+ for (int i = 0 ; i < dim; ++i)
167+ {
173168 b[i] = a[i];
174169 }
175170}
176171
177172template <typename T>
178- inline void DCOPY (const T* a, T* b, const int & dim) {
179- for (int i = 0 ; i < dim; ++i) {
173+ inline void DCOPY (const T* a, T* b, const int & dim)
174+ {
175+ for (int i = 0 ; i < dim; ++i)
176+ {
180177 b[i] = a[i];
181178 }
182179}
@@ -236,7 +233,7 @@ static inline const T* VECTOR_TO_PTR(const std::valarray<T>& v)
236233// Peize Lin add 2016-07-18
237234// ==========================================================
238235template <typename T>
239- std::string TO_STRING (const T& t, const int n= 20 ) // n=20 since LDBL_EPSILON is 1E-16 or 1E-19
236+ std::string TO_STRING (const T& t, const int n = 20 ) // n=20 since LDBL_EPSILON is 1E-16 or 1E-19
240237{
241238 std::stringstream newstr;
242239 newstr << std::setprecision (n) << t;
@@ -255,7 +252,8 @@ template <typename T_map, typename T_key1>
255252inline void * MAP_EXIST (T_map& ms, const T_key1& key1)
256253{
257254 auto ms1 = ms.find (key1);
258- if (ms1 == ms.end ()) {
255+ if (ms1 == ms.end ())
256+ {
259257 return nullptr ;
260258 }
261259 return static_cast <void *>(&ms1->second );
@@ -265,7 +263,8 @@ template <typename T_map, typename T_key1, typename... T_key_tail>
265263inline void * MAP_EXIST (T_map& ms, const T_key1& key1, const T_key_tail&... key_tail)
266264{
267265 auto ms1 = ms.find (key1);
268- if (ms1 == ms.end ()) {
266+ if (ms1 == ms.end ())
267+ {
269268 return nullptr ;
270269 }
271270 return MAP_EXIST (ms1->second , key_tail...);
@@ -275,7 +274,8 @@ template <typename T_map, typename T_key1>
275274inline const void * MAP_EXIST (const T_map& ms, const T_key1& key1)
276275{
277276 auto ms1 = ms.find (key1);
278- if (ms1 == ms.end ()) {
277+ if (ms1 == ms.end ())
278+ {
279279 return nullptr ;
280280 }
281281 return static_cast <const void *>(&ms1->second );
@@ -285,7 +285,8 @@ template <typename T_map, typename T_key1, typename... T_key_tail>
285285inline const void * MAP_EXIST (const T_map& ms, const T_key1& key1, const T_key_tail&... key_tail)
286286{
287287 auto ms1 = ms.find (key1);
288- if (ms1 == ms.end ()) {
288+ if (ms1 == ms.end ())
289+ {
289290 return nullptr ;
290291 }
291292 return MAP_EXIST (ms1->second , key_tail...);
@@ -323,7 +324,8 @@ static inline void DELETE_MUL_PTR(T_element* v)
323324template <typename T_element, typename T_N_first, typename ... T_N_tail>
324325static inline void DELETE_MUL_PTR (T_element* v, const T_N_first N_first, const T_N_tail... N_tail)
325326{
326- for (T_N_first i = 0 ; i < N_first; ++i) {
327+ for (T_N_first i = 0 ; i < N_first; ++i)
328+ {
327329 DELETE_MUL_PTR (v[i], N_tail...);
328330 }
329331 delete[] v;
@@ -353,7 +355,8 @@ static inline void FREE_MUL_PTR(T_element* v)
353355template <typename T_element, typename T_N_first, typename ... T_N_tail>
354356static inline void FREE_MUL_PTR (T_element* v, const T_N_first N_first, const T_N_tail... N_tail)
355357{
356- for (T_N_first i = 0 ; i < N_first; ++i) {
358+ for (T_N_first i = 0 ; i < N_first; ++i)
359+ {
357360 FREE_MUL_PTR (v[i], N_tail...);
358361 }
359362 free (v);
@@ -371,7 +374,7 @@ T ddot_real(const int& dim, const std::complex<T>* psi_L, const std::complex<T>*
371374static inline bool IS_COLUMN_MAJOR_KS_SOLVER (std::string ks_solver)
372375{
373376 return ks_solver == " genelpa" || ks_solver == " elpa" || ks_solver == " scalapack_gvx" || ks_solver == " cusolver"
374- || ks_solver == " cusolvermp" || ks_solver == " cg_in_lcao " || ks_solver == " pexsi" || ks_solver == " lapack" ;
377+ || ks_solver == " cusolvermp" || ks_solver == " pexsi" || ks_solver == " lapack" ;
375378}
376379
377380} // namespace GlobalFunc
0 commit comments