Skip to content

Commit 442b4be

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into issue780
2 parents 895bc42 + b3bba62 commit 442b4be

File tree

236 files changed

+4412
-5970
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+4412
-5970
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ target_link_libraries(${ABACUS_BIN_NAME}
260260
cell
261261
symmetry
262262
md
263-
symmetry
264263
neighbor
265264
orb
266265
io
@@ -272,6 +271,7 @@ target_link_libraries(${ABACUS_BIN_NAME}
272271
pw
273272
ri
274273
driver
274+
xc
275275
-lm
276276
)
277277

source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ add_subdirectory(module_neighbor)
55
add_subdirectory(module_orbital)
66
add_subdirectory(module_md)
77
add_subdirectory(module_deepks)
8+
add_subdirectory(module_xc)
89
add_subdirectory(src_io)
910
add_subdirectory(src_ions)
1011
add_subdirectory(src_lcao)

source/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ VPATH=./src_global\
1515
:./module_base\
1616
:./module_md\
1717
:./module_deepks\
18+
:./module_xc\
1819
:./src_pw\
1920
:./src_lcao\
2021
:./src_ions\

source/Makefile.Objects

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ input_conv.o\
1919
run_pw.o\
2020
run_lcao.o\
2121

22-
OBJS_PW=xc_type.o \
23-
xc_functional.o\
22+
OBJS_PW=xc_functional.o\
2423
xc_3.o \
2524
vdwd2.o\
2625
vdwd2_parameters.o\
@@ -265,7 +264,6 @@ write_HS.o\
265264
write_HS_R.o\
266265
write_dm.o\
267266
write_wfc_realspace.o\
268-
potential_libxc.o \
269267
potential_libxc_meta.o \
270268
efield.o \
271269
magnetism.o\

source/input.cpp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void Input::Default(void)
135135
//----------------------------------------------------------
136136
// electrons / spin
137137
//----------------------------------------------------------
138-
dft_functional = "none";
138+
dft_functional = "default";
139139
nspin = 1;
140140
nelec = 0.0;
141141
lmaxmax = 2;
@@ -205,7 +205,6 @@ void Input::Default(void)
205205
vl_in_h = 1;
206206
vnl_in_h = 1;
207207
vh_in_h = 1;
208-
vxc_in_h = 1;
209208
vion_in_h = 1;
210209
test_force = 0;
211210
test_stress = 0;
@@ -291,7 +290,6 @@ void Input::Default(void)
291290
//----------------------------------------------------------
292291
// exx //Peize Lin add 2018-06-20
293292
//----------------------------------------------------------
294-
exx_hybrid_type = "no";
295293

296294
exx_hybrid_alpha = 0.25;
297295
exx_hse_omega = 0.11;
@@ -800,10 +798,6 @@ bool Input::Read(const std::string &fn)
800798
{
801799
read_value(ifs, vh_in_h);
802800
}
803-
else if (strcmp("vxc_in_h", word) == 0)
804-
{
805-
read_value(ifs, vxc_in_h);
806-
}
807801
else if (strcmp("vion_in_h", word) == 0)
808802
{
809803
read_value(ifs, vion_in_h);
@@ -1263,9 +1257,9 @@ bool Input::Read(const std::string &fn)
12631257
// exx
12641258
// Peize Lin add 2018-06-20
12651259
//----------------------------------------------------------
1266-
else if (strcmp("exx_hybrid_type", word) == 0)
1260+
else if (strcmp("dft_functional", word) == 0)
12671261
{
1268-
read_value(ifs, exx_hybrid_type);
1262+
read_value(ifs, dft_functional);
12691263
}
12701264
else if (strcmp("exx_hybrid_alpha", word) == 0)
12711265
{
@@ -1823,7 +1817,6 @@ void Input::Bcast()
18231817
Parallel_Common::bcast_int( vl_in_h );
18241818
Parallel_Common::bcast_int( vnl_in_h );
18251819
Parallel_Common::bcast_int( vh_in_h );
1826-
Parallel_Common::bcast_int( vxc_in_h );
18271820
Parallel_Common::bcast_int( vion_in_h );
18281821

18291822
Parallel_Common::bcast_int( test_force );
@@ -1964,7 +1957,7 @@ void Input::Bcast()
19641957
Parallel_Common::bcast_int( GlobalV::mulliken);//qifeng add 2019/9/10
19651958

19661959
// Peize Lin add 2018-06-20
1967-
Parallel_Common::bcast_string( exx_hybrid_type );
1960+
Parallel_Common::bcast_string( dft_functional );
19681961
Parallel_Common::bcast_double( exx_hybrid_alpha );
19691962
Parallel_Common::bcast_double( exx_hse_omega );
19701963
Parallel_Common::bcast_bool( exx_separate_loop );
@@ -2511,16 +2504,7 @@ void Input::Check(void)
25112504
}
25122505
}
25132506

2514-
if(exx_hybrid_type!="no" &&
2515-
exx_hybrid_type!="hf" &&
2516-
exx_hybrid_type!="pbe0" &&
2517-
exx_hybrid_type!="hse" &&
2518-
exx_hybrid_type!="opt_orb")
2519-
{
2520-
ModuleBase::WARNING_QUIT("INPUT","exx_hybrid_type must be no or hf or pbe0 or hse or opt_orb");
2521-
}
2522-
2523-
if(exx_hybrid_type=="hf" || exx_hybrid_type=="pbe0" || exx_hybrid_type=="hse")
2507+
if(dft_functional=="hf" || dft_functional=="pbe0" || dft_functional=="hse")
25242508
{
25252509
if(exx_hybrid_alpha<0 || exx_hybrid_alpha>1)
25262510
{
@@ -2542,7 +2526,7 @@ void Input::Check(void)
25422526
ModuleBase::WARNING_QUIT("INPUT","exx_distribute_type must be htime or kmeans2 or kmeans1");
25432527
}
25442528
}
2545-
if(exx_hybrid_type=="opt_orb")
2529+
if(dft_functional=="opt_orb")
25462530
{
25472531
if(exx_opt_orb_lmax<0)
25482532
{

source/input.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class Input
7777
// electrons / spin
7878
//==========================================================
7979
std::string dft_functional; // input DFT functional.
80+
bool use_libxc; // whether to use LIBXC
8081
int nspin; // LDA ; LSDA ; non-linear spin
8182
double nelec; // total number of electrons
8283
int lmaxmax;
@@ -151,7 +152,6 @@ class Input
151152
int vnl_in_h; // calculate the vnl or not.
152153

153154
int vh_in_h; // calculate the hartree potential or not
154-
int vxc_in_h; // calculate the xc potential or not
155155
int vion_in_h; // calculate the local ionic potential or not
156156
//only relevant when vl_in_h = 1
157157

@@ -295,8 +295,6 @@ class Input
295295
// exx
296296
// Peize Lin add 2018-06-20
297297
//==========================================================
298-
std::string exx_hybrid_type; // "no", "hf", "pbe0", "hse"
299-
300298
double exx_hybrid_alpha;
301299
double exx_hse_omega;
302300

source/input_conv.cpp

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ void Input_Conv::Convert(void)
141141
GlobalV::VL_IN_H = INPUT.vl_in_h;
142142
GlobalV::VNL_IN_H = INPUT.vnl_in_h;
143143
GlobalV::VH_IN_H = INPUT.vh_in_h;
144-
GlobalV::VXC_IN_H = INPUT.vxc_in_h;
145144
GlobalV::VION_IN_H = INPUT.vion_in_h;
146145
GlobalV::TEST_FORCE = INPUT.test_force;
147146
GlobalV::TEST_STRESS = INPUT.test_stress;
@@ -308,20 +307,20 @@ void Input_Conv::Convert(void)
308307
const std::string command0 = "test -d " + GlobalC::restart.folder + " || mkdir " + GlobalC::restart.folder;
309308
if (GlobalV::MY_RANK == 0)
310309
system(command0.c_str());
311-
if (INPUT.exx_hybrid_type == "no")
310+
if (INPUT.dft_functional == "hf" || INPUT.dft_functional == "pbe0" || INPUT.dft_functional == "hse" || INPUT.dft_functional == "opt_orb")
312311
{
313312
GlobalC::restart.info_save.save_charge = true;
313+
GlobalC::restart.info_save.save_H = true;
314314
}
315315
else
316316
{
317317
GlobalC::restart.info_save.save_charge = true;
318-
GlobalC::restart.info_save.save_H = true;
319318
}
320319
}
321320
if (INPUT.restart_load)
322321
{
323322
GlobalC::restart.folder = GlobalV::global_out_dir + "restart/";
324-
if (INPUT.exx_hybrid_type == "no")
323+
if (INPUT.dft_functional == "hf" || INPUT.dft_functional == "pbe0" || INPUT.dft_functional == "hse" || INPUT.dft_functional == "opt_orb")
325324
{
326325
GlobalC::restart.info_load.load_charge = true;
327326
}
@@ -336,28 +335,30 @@ void Input_Conv::Convert(void)
336335
// about exx, Peize Lin add 2018-06-20
337336
//----------------------------------------------------------
338337
#ifdef __LCAO
339-
if (INPUT.exx_hybrid_type == "no")
338+
339+
if (INPUT.dft_functional == "hf")
340340
{
341-
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::No;
341+
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::HF;
342+
}
343+
else if (INPUT.dft_functional == "pbe0")
344+
{
345+
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::PBE0;
346+
}
347+
else if (INPUT.dft_functional == "hse")
348+
{
349+
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::HSE;
350+
}
351+
else if (INPUT.dft_functional == "opt_orb")
352+
{
353+
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::Generate_Matrix;
342354
}
343355
else
344356
{
345-
if (INPUT.exx_hybrid_type == "hf")
346-
{
347-
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::HF;
348-
}
349-
else if (INPUT.exx_hybrid_type == "pbe0")
350-
{
351-
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::PBE0;
352-
}
353-
else if (INPUT.exx_hybrid_type == "hse")
354-
{
355-
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::HSE;
356-
}
357-
else if (INPUT.exx_hybrid_type == "opt_orb")
358-
{
359-
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::Generate_Matrix;
360-
}
357+
GlobalC::exx_global.info.hybrid_type = Exx_Global::Hybrid_Type::No;
358+
}
359+
360+
if(GlobalC::exx_global.info.hybrid_type != Exx_Global::Hybrid_Type::No)
361+
{
361362
GlobalC::exx_global.info.hybrid_alpha = INPUT.exx_hybrid_alpha;
362363
GlobalC::exx_global.info.hse_omega = INPUT.exx_hse_omega;
363364
GlobalC::exx_global.info.separate_loop = INPUT.exx_separate_loop;
@@ -458,16 +459,6 @@ void Input_Conv::Convert(void)
458459
// mohan add 2021-02-16
459460
berryphase::berry_phase_flag = INPUT.berry_phase;
460461

461-
// wenfei 2021-7-28
462-
if (GlobalV::DFT_FUNCTIONAL == "scan")
463-
{
464-
if (GlobalV::BASIS_TYPE != "pw")
465-
{
466-
ModuleBase::WARNING_QUIT("Input_conv", "add metaGGA for pw first");
467-
}
468-
GlobalV::DFT_META = 1;
469-
}
470-
471462
ModuleBase::timer::tick("Input_Conv", "Convert");
472463
//-----------------------------------------------
473464
// caoyu add for DeePKS

source/module_base/constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const double RYDBERG_SI = HARTREE_SI/2.0; //J
9494

9595
// zero up to a given accuracy
9696
//const double epsr = 1.0e-6;
97-
//const double epsg = 1.0e-10;
97+
const double threshold_wg = 1.0e-14;
9898
}
9999

100100
#endif

source/module_base/global_variable.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ std::string CALCULATION = "scf";
2929
int EFIELD = 0; // 5: add electric field
3030
int DIPOLE = 0; // 7: add dipole field
3131

32-
std::string DFT_FUNCTIONAL = "none";
33-
bool DFT_META = 0;
32+
std::string DFT_FUNCTIONAL = "default";
3433
int NSPIN = 1; // LDA
3534
bool TWO_EFERMI = 0; // two fermi energy, exist only magnetization is fixed.
3635
int CURRENT_SPIN = 0;
@@ -76,7 +75,6 @@ int T_IN_H = 1; // mohan add 2010-11-28
7675
int VL_IN_H = 1;
7776
int VNL_IN_H = 1;
7877
int VH_IN_H = 1;
79-
int VXC_IN_H = 1;
8078
int VION_IN_H = 1;
8179
int ZEEMAN_IN_H = 1;
8280
double STRESS_THR = 1.0e-2; //LiuXh add 20180515

source/module_base/global_variable.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ extern int DIPOLE; // 7 add dipole correction
3131

3232

3333
extern std::string DFT_FUNCTIONAL; // 6.5 change the DFT functional from input file.
34-
extern bool DFT_META; // whether is meta-GGA
3534
extern int NSPIN; // 7
3635
extern bool TWO_EFERMI; // 7.5 mohan add 2011-04-03, two fermi energy, exist if magnetization is fixed.
3736
extern int CURRENT_SPIN; // 8
@@ -89,7 +88,6 @@ extern int T_IN_H; // 23, calculate T in H or not.
8988
extern int VL_IN_H; // 24, calculate Vl in H or not.
9089
extern int VNL_IN_H; // 25, calculate Vnl in H or not.
9190
extern int VH_IN_H; // 26, calculate Vh in H or not.
92-
extern int VXC_IN_H; // 27, calculate Vxc in H or not.
9391
extern int VION_IN_H; // 28, calculate Vion_loc in H or not.
9492
extern double STRESS_THR; //LiuXh add 20180515
9593

0 commit comments

Comments
 (0)