Skip to content

Commit f0c8985

Browse files
wenfei-liwenfei-li
andauthored
Feature: exit with error when deepks/exx is not linked but deepks/hybrid is used (#1578)
* removed unused second_order from old relax module * Feature: add warning when deepks/exx not installed but is used in input Co-authored-by: wenfei-li <[email protected]>
1 parent 437cc26 commit f0c8985

File tree

4 files changed

+12
-56
lines changed

4 files changed

+12
-56
lines changed

source/input_conv.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ void Input_Conv::Convert(void)
549549
}
550550
if (GlobalV::deepks_scf || GlobalV::deepks_out_labels)
551551
GlobalV::deepks_setorb = 1;
552+
#else
553+
if(INPUT.deepks_scf || INPUT.deepks_out_labels || INPUT.deepks_bandgap)
554+
{
555+
ModuleBase::WARNING_QUIT("Input_conv","please compile with DeePKS");
556+
}
552557
#endif
553558
//-----------------------------------------------
554559
// sunml add for implicit solvation model

source/module_relax/relax_old/ions_move_basic.cpp

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -279,49 +279,6 @@ double Ions_Move_Basic::dot_func(const double* a, const double* b, const int &di
279279
}
280280

281281

282-
//----------------------------------------------------------------------------
283-
// second order interpolation scheme,
284-
//----------------------------------------------------------------------------
285-
void Ions_Move_Basic::second_order(
286-
const double &e0, // energy of previous step
287-
const double &e1, // energy at this step
288-
const double *g0, // gradient at first step
289-
const double *x, // movement
290-
const int &dim,
291-
double &best_x,
292-
double &best_e
293-
)
294-
{
295-
ModuleBase::TITLE("Ions_Move_Basic","second_order");
296-
297-
// (1) E = ax^2 + bx + c
298-
// |x> is the movement,or the trust radius
299-
// so c=e0,
300-
// and dE/dx = 2ax + b, so b=|g0>
301-
// ax^2+<g0|x>+e0=e1
302-
double bx = dot_func(g0, x, dim);
303-
double xx = dot_func(x, x, dim);
304-
305-
assert(xx!=0);
306-
double b = bx / sqrt(xx);
307-
308-
double a = ( (e1-e0) - bx ) / xx;
309-
assert(a!=0);
310-
311-
// (2) 2ax + b = 0; so best_x=-b/2a,
312-
best_x = -0.5 * b / a;
313-
best_e = a*best_x*best_x+b*best_x+e0;
314-
GlobalV::ofs_running << " The next E should be ( 2nd order interpolation)"
315-
<< best_e * ModuleBase::Ry_to_eV << " eV" << std::endl;
316-
317-
std::cout << " The next E should be ( 2nd order interpolation)"
318-
<< best_e * ModuleBase::Ry_to_eV << " eV" << std::endl;
319-
320-
return;
321-
}
322-
323-
324-
325282

326283

327284

source/module_relax/relax_old/ions_move_basic.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,6 @@ namespace Ions_Move_Basic
5252

5353
double dot_func(const double* a, const double* b, const int &dim);
5454

55-
56-
//----------------------------------------------------------------------------
57-
// second order interpolation scheme,
58-
//----------------------------------------------------------------------------
59-
void second_order(
60-
const double &e0, // energy of previous step
61-
const double &e1, // energy at this step
62-
const double *f0, // force at first step
63-
const double *x, // movement
64-
const int &dim,
65-
double &best_x,
66-
double &best_e);
67-
6855
//----------------------------------------------------------------------------
6956
// third order interpolation scheme,
7057
//----------------------------------------------------------------------------

source/module_xc/xc_functional.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
169169
ModuleBase::WARNING_QUIT("set_xc_type","mgga stress not implemented for polarized case yet");
170170
}
171171

172+
#ifndef __EXX
173+
if(func_type == 4 || func_type == 5)
174+
{
175+
ModuleBase::WARNING_QUIT("set_xc_type","compile with libri to use hybrid functional");
176+
}
177+
#endif
178+
172179
#ifndef USE_LIBXC
173180
if(xc_func == "SCAN" || xc_func == "HSE" || xc_func == "SCAN0")
174181
{

0 commit comments

Comments
 (0)