Skip to content

Commit af1b238

Browse files
Flying-dragon-boxingzhangzh-pkuWHUweiqingzhoukirk0830haozhihan
authored andcommitted
Feature: Hybrid functionals for planewave basis (deepmodeling#5940)
* feat pexsi * fix : diag not completed * feat * feat: pexsi hsolver * CMake building implemented * Works * adapt to the new container * Turn off USE_PEXSI * Update LibRI to 553c91c * modify include files * namespace-ize * new inputs added * Configure Makefile Compiling, fix typos * Fix Makefile Intel toolchains compile errors * Fix even more PEXSI related Makefile compiling issues * Modify inputs and update to latest version (deepmodeling#2) * run INPUT.Default() in every process in InputParaTest (deepmodeling#3490) Co-authored-by: kirk0830 <[email protected]> * add blas support for FindLAPACK.cmake (deepmodeling#3497) * more unittest of QO: towards orbital selection (deepmodeling#3499) * Fix: fix bug in mulliken charge calculation (deepmodeling#3503) * fix phase * fix case test * Refactor: namespace Conv_Coulomb_Pot_K (deepmodeling#3446) * Refactor: namespace Conv_Coulomb_Pot_K * Refactor: namespace Conv_Coulomb_Pot_K --------- Co-authored-by: wqzhou <[email protected]> * enable the computation of all zeros in one function call (deepmodeling#3449) Co-authored-by: wqzhou <[email protected]> * replace ios.eof() by ios.good() to avoid meeting badbit and failbit in reading STRU (deepmodeling#3506) * Build: add ccache to accelerate the testing process (deepmodeling#3509) * Build: add ccache to accelerate the testing process * Update test.yml * Update test.yml * Update test.yml * Docs: to avoid the misunderstanding in docs (deepmodeling#3518) * to avoid the misunderstanding in docs * Update docs/quick_start/hands_on.md Co-authored-by: Chun Cai <[email protected]> --------- Co-authored-by: Chun Cai <[email protected]> * Docs: fix a missing depencency in conda build env (deepmodeling#3508) * Feature: Add ENABLE_RAPIDJSON option to control the output of abacus.json (deepmodeling#3519) Add ENABLE_RAPIDJSON option to control the output of abacus.json * Feature: add python wrapper for math sphbes (deepmodeling#3475) * recommit for review * add python wrapper * remove timer since performace tests add * Feature: support segment split in kline mode in KPT file and `out_band` band output precision control, `8` as default (deepmodeling#3493) * add precision control * correct serial version of nscf_band function * fix issue 3482 * update unit and integrated test * update document * correct unittest and make compatible with false and true * fix: bug in Autotest.sh when result.ref has no totaltimeref (deepmodeling#3523) * Fix : unit test of module_xc (deepmodeling#3524) * Fix: omit small magnetic moments to avoid numerical instability (deepmodeling#3530) * update deltalambda * avoid numerical error in orbMulP * add constrain on Mi * change case reference value * Fix: fix multiple compiler warnings (deepmodeling#3515) * Fix: add noreturn attribute to warning_quit * Add type conversion * fix string literal * fix small number trunctuation * Fix system call returned value not checked * fix missing braket * Refactor parameter_pool.cpp and parameter_pool.h * remove duplicated return statements * Change WARNING_QUIT occurances in tests * Add warning message to help debug UT * output the default precision flag (deepmodeling#3496) Co-authored-by: kirk0830 <[email protected]> * Build: Improving CMake performance for finding LibXC and ELPA (deepmodeling#3478) * Fix for finding LibXC and ELPA * For compatibility to previous routines * syntax fix for FindELPA.cmake * Update cmake/FindELPA.cmake Co-authored-by: Chun Cai <[email protected]> * Using CMake interface as default for finding LibXC * update docs * fix for FindLibxc: changing imcompatible if statement * fix for FindLibxc: changing imcompatible if statement * fix for FindLibxc: changing imcompatible if statement * update docs for installing pkg-config * Update FindLibxc.cmake * Update FindLibxc.cmake * remove previous LibXC routine in CMakeLists.txt Co-authored-by: Chun Cai <[email protected]> * Update easy_install.md with Makefile-built LibXC supported * Update easy_install.md to include different behavior in different version on finding ELPA --------- Co-authored-by: Chun Cai <[email protected]> * Docs: correct some docs about mp2 smearing method (deepmodeling#3533) * correct some docs about mp2 smearing method * add docs about mv method * Feature : printing band density (deepmodeling#3501) Co-authored-by: wenfei-li <[email protected]> Co-authored-by: wqzhou <[email protected]> * add some docs for PR#3501 (deepmodeling#3537) * Feature: enable restart charge density mixing during SCF (deepmodeling#3542) * add a new parameter mixing_restart * do not update rho if iter==mixing_restart * do not update rho if iter==mixing_restart-1 * reset mix and rho_mdata if iter==mixing_restart * fix SCF exit directly since drho=0 if iter=GlobalV::MIXING_RESTART * re-set_mixing in eachiterinit for PW and LCAO * enable SCF restarts in esolver_ks::RUN * add some UnitTests * add some Docs * new inputs added * Update input-main.md (deepmodeling#3551) Solve the format problem mentioned in issue 3543 * Build: fix compatibility issue against toolchain install (deepmodeling#3540) * Fix for finding LibXC and ELPA * For compatibility to previous routines * syntax fix for FindELPA.cmake * Update cmake/FindELPA.cmake Co-authored-by: Chun Cai <[email protected]> * Using CMake interface as default for finding LibXC * update docs * fix for FindLibxc: changing imcompatible if statement * fix for FindLibxc: changing imcompatible if statement * fix for FindLibxc: changing imcompatible if statement * update docs for installing pkg-config * Update FindLibxc.cmake * Update FindLibxc.cmake * remove previous LibXC routine in CMakeLists.txt Co-authored-by: Chun Cai <[email protected]> * Update easy_install.md with Makefile-built LibXC supported * Update easy_install.md to include different behavior in different version on finding ELPA * fix compatibility issue against toolchain * Change default ELPA install routine to old one --------- Co-authored-by: Chun Cai <[email protected]> * Test: Configure performance tests for math libraries (deepmodeling#3511) * add performace test of sphbes functions. * fix benchmark cmake errors * add dependencies for docker * update docs * add performance tests for sphbes * add google benchmark * rewrite benchmark tests in fixtures * disable internal testing in benchmark * merge benchmark into integration test --------- Co-authored-by: StarGrys <[email protected]> * Configure Makefile Compiling, fix typos * Fix Makefile Intel toolchains compile errors * Fix even more PEXSI related Makefile compiling issues * Update hsolver_pw.cpp (deepmodeling#3556) when use_uspp==false, overlap matrix should be E. * Fix: cuda build target (deepmodeling#3276) * Fix: cuda buid target * Update CMakeLists.txt --------- Co-authored-by: Denghui Lu <[email protected]> --------- Co-authored-by: wqzhou <[email protected]> Co-authored-by: kirk0830 <[email protected]> Co-authored-by: Haozhi Han <[email protected]> Co-authored-by: Zhao Tianqi <[email protected]> Co-authored-by: PeizeLin <[email protected]> Co-authored-by: jinzx10 <[email protected]> Co-authored-by: Chun Cai <[email protected]> Co-authored-by: Peng Xingliang <[email protected]> Co-authored-by: Jie Li <[email protected]> Co-authored-by: Wenfei Li <[email protected]> Co-authored-by: Denghui Lu <[email protected]> Co-authored-by: YI Zeping <[email protected]> Co-authored-by: wenfei-li <[email protected]> Co-authored-by: jingan-181 <[email protected]> Co-authored-by: StarGrys <[email protected]> Co-authored-by: Haozhi Han <[email protected]> * Revert "Modify inputs and update to latest version" * Update FindPEXSI.cmake to fix Comments * Fix CI errors * Fix CI Errors and Merge with Upstream * Resolve Pull Request Reviews * Fix parallel communication related issue * Fix vars in Makefile.vars, add input tests and comments for pexsi vars * Fix nspin > 1 cases * Improvement: take calculated mu as new initial guess, may slightly improve performance * Fix mistakes in the last commit * Fix: params and features - set default pexsi_temp - fix md in pexsi * fix empty lines * Fix: move params to pexsi_solver, rename USE_PEXSI to ENABLE_PEXSI * Tests: Modify Dockerfile and GitHub Workflows * Fix: wrong abacus link for dockerfile * Docs: added docs for pexsi inputs * Tests: three tests added for pexsi * Fix unit test issues in input_conv * Very good unit test, making my laptop fan spin * Change default pexsi_npole from 80 to 40 * Place pexsi_EDM in DensityMatrix, set size of pexsi_dm = 1 when GlobalV::NSPIN==4, and add comments for dmToRho * An unit test added for DiagoPexsi * modify for changed gint interface * correct nspin related behaviors * add efermi passthrough * Revert "add efermi passthrough" This reverts commit d7b402d. * commits to resolve conversations related to codes * DM and EDM pointers in pexsi now handled by diagopexsi, and copying h s matrices no longer needed * add pexsi examples * fix pexsi unit test (original version shouldn't run) * add building docs for pexsi * set cxx standard to c++14, which is required in make_unique * Fix: Fix typo related to pexsi * update to PPEXSIDFTDriver2 * default npoints to 1, so single core pexsi will work * Feature: exx operator for pw basis, single kpt * apply pexsi changes(?) * q-e style exx_div * Correct exxdiv * Fix Compile errors * refactor to abandon `pdiagh` * Fix mu_buffer and nspin * HSE examples * Feature: Multi-K exx * Feature: Multi-K exx * Updates with latest * Remove redundant global vars * Update to v3.9.0 * Update to v3.9.0, now code works * Remove Redundant cal_exx_energy in esolver_ks_pw.cpp * Some mess * Minor Fixes * Fix separate loop and screening * Add EXX stress * EXX Energy??? * Multi-K is broken??? * Fix: Multi-K and stress * Feature: ACE for single-K * Feature: ACE should work for multi-K, but not for sure * Feature: ACE works. Next step is ACE energy. * Fix: adapt to the latest instruction for variable `conv_esolver` * Reconstruct: move exx_helper to hamilt_pwdft * Fix: Now EXX PW doesn't depend on LibRI * Fix: Add input constraints for EXX PW * Fix: Remove redundant mpi barrier * Fix: Clean irrelevant files * Fix: Clean irrelevant files * Feature: add ace flag, exit on using gpu * Refactor: Phase 1 for refactoring exx energy * Feature: now ace calculates energy * Feature: enable exx energy * Fix: fix makefile compilation error --------- Co-authored-by: zhangzhihao <[email protected]> Co-authored-by: zhangzh-pku <[email protected]> Co-authored-by: wqzhou <[email protected]> Co-authored-by: kirk0830 <[email protected]> Co-authored-by: Haozhi Han <[email protected]> Co-authored-by: Zhao Tianqi <[email protected]> Co-authored-by: PeizeLin <[email protected]> Co-authored-by: jinzx10 <[email protected]> Co-authored-by: Chun Cai <[email protected]> Co-authored-by: Peng Xingliang <[email protected]> Co-authored-by: Jie Li <[email protected]> Co-authored-by: Wenfei Li <[email protected]> Co-authored-by: Denghui Lu <[email protected]> Co-authored-by: YI Zeping <[email protected]> Co-authored-by: wenfei-li <[email protected]> Co-authored-by: jingan-181 <[email protected]> Co-authored-by: StarGrys <[email protected]> Co-authored-by: Haozhi Han <[email protected]> Co-authored-by: Mohan Chen <[email protected]>
1 parent 5aa2703 commit af1b238

31 files changed

+1764
-33
lines changed

examples/hse/pw_Si2/INPUT

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
INPUT_PARAMETERS
2+
pseudo_dir ../../../tests/PP_ORB
3+
orbital_dir ../../../tests/PP_ORB
4+
nbands 4
5+
nspin 1
6+
calculation scf
7+
basis_type pw
8+
ks_solver dav
9+
ecutwfc 50
10+
scf_thr 1e-9
11+
scf_nmax 100
12+
gamma_only 0
13+
symmetry -1
14+
smearing_method fixed
15+
mixing_type broyden
16+
mixing_beta 0.7
17+
18+
dft_functional hse
19+
20+
# init_wfc file
21+
# init_chg file
22+
23+
pseudo_mesh 1
24+
pseudo_rcut 10
25+
26+
# out_wfc_pw 1
27+
# out_chg 1
28+
29+
exx_hybrid_alpha 0.25
30+
31+
cal_stress 1
32+
# cal_force 1

examples/hse/pw_Si2/KPT

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
3 3 3 0 0 0

examples/hse/pw_Si2/STRU

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
ATOMIC_SPECIES
2+
Si 1 Si_ONCV_PBE_FR-1.1.upf #Pseudopotentials are downloaded from http://www.quantum-simulation.org/potentials/sg15_oncv/upf/
3+
4+
NUMERICAL_ORBITAL
5+
orb_Si.dat
6+
7+
LATTICE_CONSTANT
8+
1.889766
9+
10+
LATTICE_VECTORS
11+
0.0 2.708337 2.708337
12+
2.708337 0.0 2.708337
13+
2.708337 2.708337 0.0
14+
15+
16+
17+
ATOMIC_POSITIONS
18+
Direct
19+
20+
Si
21+
0
22+
2
23+
0.125 0.125 0.125 0 0 0
24+
0.875 0.875 0.875 0 0 0

source/Makefile.Objects

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ VPATH=./src_global:\
5050
./module_hamilt_pw/hamilt_stodft:\
5151
./module_hamilt_pw/hamilt_pwdft/operator_pw:\
5252
./module_hamilt_pw/hamilt_pwdft/kernels:\
53+
./module_hamilt_pw/hamilt_pwdft/module_exx_helper:\
5354
./module_hamilt_pw/hamilt_stodft/kernels:\
5455
./module_hamilt_lcao/module_hcontainer:\
5556
./module_hamilt_lcao/hamilt_lcaodft:\
@@ -295,6 +296,7 @@ OBJS_HAMILT=hamilt_pw.o\
295296
hamilt_sdft_pw.o\
296297
operator.o\
297298
operator_pw.o\
299+
op_exx_pw.o\
298300
ekinetic_pw.o\
299301
ekinetic_op.o\
300302
hpsi_norm_op.o\
@@ -306,6 +308,7 @@ OBJS_HAMILT=hamilt_pw.o\
306308
meta_op.o\
307309
velocity_pw.o\
308310
radial_proj.o\
311+
exx_helper.o\
309312

310313
OBJS_HAMILT_OF=kedf_tf.o\
311314
kedf_vw.o\
@@ -671,6 +674,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
671674
sto_stress_pw.o\
672675
stress_func_cc.o\
673676
stress_func_ewa.o\
677+
stress_func_exx.o\
674678
stress_func_gga.o\
675679
stress_func_mgga.o\
676680
stress_func_har.o\

source/module_elecstate/elecstate.h

-4
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,8 @@ class ElecState
131131
bool vnew_exist = false;
132132
void cal_converged();
133133
void cal_energies(const int type);
134-
#ifdef __EXX
135-
#ifdef __LCAO
136134
void set_exx(const double& Eexx);
137135
void set_exx(const std::complex<double>& Eexx);
138-
#endif //__LCAO
139-
#endif //__EXX
140136

141137
double get_hartree_energy();
142138
double get_etot_efield();

source/module_elecstate/elecstate_exx.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
namespace elecstate
44
{
55

6-
#ifdef __EXX
7-
#ifdef __LCAO
86
/// @brief calculation if converged
97
/// @date Peize Lin add 2016-12-03
108
void ElecState::set_exx(const double& Eexx)
@@ -17,7 +15,5 @@ void ElecState::set_exx(const double& Eexx)
1715
}
1816
return;
1917
}
20-
#endif //__LCAO
21-
#endif //__EXX
2218

2319
}

source/module_elecstate/potentials/potential_new.h

+6
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ class Potential : public PotBase
170170
{
171171
return this->v_effective_fixed.data();
172172
}
173+
const ModulePW::PW_Basis *get_rho_basis() const
174+
{
175+
return this->rho_basis_;
176+
}
177+
// What about adding a function to get the wfc?
178+
// This is useful for the calculation of the exx energy
173179

174180

175181
/// @brief get the value of vloc at G=0;

source/module_esolver/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ add_library(
2828
esolver
2929
OBJECT
3030
${objects}
31+
../module_hamilt_pw/hamilt_pwdft/module_exx_helper/exx_helper.cpp
32+
../module_hamilt_pw/hamilt_pwdft/module_exx_helper/exx_helper.h
3133
)
3234

3335
if(ENABLE_COVERAGE)

source/module_esolver/esolver_ks.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "module_base/timer.h"
44
#include "module_cell/cal_atoms_info.h"
5+
#include "module_hamilt_general/module_xc/xc_functional.h"
56
#include "module_io/cube_io.h"
67
#include "module_io/json_output/init_info.h"
78
#include "module_io/json_output/output_info.h"
@@ -24,6 +25,8 @@
2425
#include "module_cell/module_paw/paw_cell.h"
2526
#endif
2627

28+
#include "esolver_ks_pw.h"
29+
2730
namespace ModuleESolver
2831
{
2932

source/module_esolver/esolver_ks_pw.cpp

+77
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,26 @@ void ESolver_KS_PW<T, Device>::before_all_runners(UnitCell& ucell, const Input_p
225225
this->pelec->wg,
226226
this->pelec->skip_weights);
227227
}
228+
229+
230+
// 10) initialize exx pw
231+
if (PARAM.inp.calculation == "scf"
232+
|| PARAM.inp.calculation == "relax"
233+
|| PARAM.inp.calculation == "cell-relax"
234+
|| PARAM.inp.calculation == "md")
235+
{
236+
if (GlobalC::exx_info.info_global.cal_exx && GlobalC::exx_info.info_global.separate_loop == true)
237+
{
238+
XC_Functional::set_xc_first_loop(ucell);
239+
exx_helper.set_firstiter();
240+
}
241+
242+
if (GlobalC::exx_info.info_global.cal_exx)
243+
{
244+
exx_helper.set_wg(&this->pelec->wg);
245+
}
246+
}
247+
228248
}
229249

230250
template <typename T, typename Device>
@@ -258,6 +278,19 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
258278
// allocate HamiltPW
259279
this->allocate_hamilt(ucell);
260280

281+
if (PARAM.inp.calculation == "scf"
282+
|| PARAM.inp.calculation == "relax"
283+
|| PARAM.inp.calculation == "cell-relax"
284+
|| PARAM.inp.calculation == "md")
285+
{
286+
if (GlobalC::exx_info.info_global.cal_exx && PARAM.inp.basis_type == "pw")
287+
{
288+
auto hamilt_pw = reinterpret_cast<hamilt::HamiltPW<T, Device>*>(this->p_hamilt);
289+
hamilt_pw->set_exx_helper(exx_helper);
290+
}
291+
292+
}
293+
261294
//----------------------------------------------------------
262295
//! calculate the total local pseudopotential in real space
263296
//----------------------------------------------------------
@@ -333,6 +366,18 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
333366
this->already_initpsi = true;
334367
}
335368

369+
if (PARAM.inp.calculation == "scf"
370+
|| PARAM.inp.calculation == "relax"
371+
|| PARAM.inp.calculation == "cell-relax"
372+
|| PARAM.inp.calculation == "md")
373+
{
374+
if (GlobalC::exx_info.info_global.cal_exx && PARAM.inp.basis_type == "pw")
375+
{
376+
exx_helper.set_psi(kspw_psi);
377+
}
378+
379+
}
380+
336381
ModuleBase::timer::tick("ESolver_KS_PW", "before_scf");
337382
}
338383

@@ -504,6 +549,11 @@ void ESolver_KS_PW<T, Device>::update_pot(UnitCell& ucell, const int istep, cons
504549
template <typename T, typename Device>
505550
void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& iter, bool& conv_esolver)
506551
{
552+
if (GlobalC::exx_info.info_global.cal_exx && !exx_helper.op_exx->first_iter)
553+
{
554+
this->pelec->set_exx(exx_helper.cal_exx_energy(kspw_psi));
555+
}
556+
507557
// deband is calculated from "output" charge density calculated
508558
// in sum_band
509559
// need 'rho(out)' and 'vr (v_h(in) and v_xc(in))'
@@ -522,6 +572,33 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
522572
this->ppcell.cal_effective_D(veff, this->pw_rhod, ucell);
523573
}
524574

575+
if (GlobalC::exx_info.info_global.cal_exx)
576+
{
577+
if (GlobalC::exx_info.info_global.separate_loop)
578+
{
579+
if (conv_esolver)
580+
{
581+
exx_helper.set_psi(this->kspw_psi);
582+
583+
conv_esolver = exx_helper.exx_after_converge(iter);
584+
585+
if (!conv_esolver)
586+
{
587+
std::cout << " Setting Psi for EXX PW Inner Loop" << std::endl;
588+
exx_helper.op_exx->first_iter = false;
589+
XC_Functional::set_xc_type(ucell.atoms[0].ncpp.xc_func);
590+
update_pot(ucell, istep, iter, conv_esolver);
591+
}
592+
}
593+
}
594+
else
595+
{
596+
// std::cout << "setting psi for each iter" << std::endl;
597+
exx_helper.set_psi(this->kspw_psi);
598+
}
599+
600+
}
601+
525602
// 3) Print out electronic wavefunctions in pw basis
526603
if (PARAM.inp.out_wfc_pw == 1 || PARAM.inp.out_wfc_pw == 2)
527604
{

source/module_esolver/esolver_ks_pw.h

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "./esolver_ks.h"
44
#include "module_hamilt_pw/hamilt_pwdft/operator_pw/velocity_pw.h"
55
#include "module_psi/psi_init.h"
6+
#include "module_hamilt_pw/hamilt_pwdft/module_exx_helper/exx_helper.h"
7+
#include "module_hamilt_pw/hamilt_pwdft/global.h"
68

79
#include <memory>
810
#include <module_base/macros.h>
@@ -31,6 +33,8 @@ class ESolver_KS_PW : public ESolver_KS<T, Device>
3133

3234
void after_all_runners(UnitCell& ucell) override;
3335

36+
Exx_Helper<T, Device> exx_helper;
37+
3438
protected:
3539
virtual void before_scf(UnitCell& ucell, const int istep) override;
3640

source/module_hamilt_general/module_xc/xc_functional.cpp

+15-6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ method. */
4040
else if (ucell.atoms[0].ncpp.xc_func == "SCAN0") {
4141
XC_Functional::set_xc_type("scan");
4242
}
43+
else if (ucell.atoms[0].ncpp.xc_func == "B3LYP") {
44+
XC_Functional::set_xc_type("blyp");
45+
}
4346
}
4447

4548
// The setting values of functional id according to the index in LIBXC
@@ -244,6 +247,12 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
244247
func_type = 2;
245248
use_libxc = true;
246249
}
250+
else if (xc_func == "B3LYP")
251+
{
252+
func_id.push_back(XC_HYB_GGA_XC_B3LYP);
253+
func_type = 4;
254+
use_libxc = true;
255+
}
247256
#endif
248257
else
249258
{
@@ -268,19 +277,19 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
268277
std::cerr << "\n OPTX untested please test,";
269278
}
270279

271-
if((func_type == 4 || func_type == 5) && PARAM.inp.basis_type == "pw")
272-
{
273-
ModuleBase::WARNING_QUIT("set_xc_type","hybrid functional not realized for planewave yet");
274-
}
280+
// if((func_type == 4 || func_type == 5) && PARAM.inp.basis_type == "pw")
281+
// {
282+
// ModuleBase::WARNING_QUIT("set_xc_type","hybrid functional not realized for planewave yet");
283+
// }
275284
if((func_type == 3 || func_type == 5) && PARAM.inp.nspin==4)
276285
{
277286
ModuleBase::WARNING_QUIT("set_xc_type","meta-GGA has not been implemented for nspin = 4 yet");
278287
}
279288

280289
#ifndef __EXX
281-
if(func_type == 4 || func_type == 5)
290+
if((func_type == 4 || func_type == 5) && PARAM.inp.basis_type == "lcao")
282291
{
283-
ModuleBase::WARNING_QUIT("set_xc_type","compile with libri to use hybrid functional");
292+
ModuleBase::WARNING_QUIT("set_xc_type","compile with libri to use hybrid functional in lcao basis");
284293
}
285294
#endif
286295

source/module_hamilt_general/operator.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum class calculation_type
1818
pw_veff,
1919
pw_meta,
2020
pw_onsite,
21+
pw_exx,
2122
lcao_overlap,
2223
lcao_fixed,
2324
lcao_gint,
@@ -41,7 +42,6 @@ class Operator
4142

4243
// this is the core function for Operator
4344
// do H|psi> from input |psi> ,
44-
4545
/// as default, different operators donate hPsi independently
4646
/// run this->act function for the first operator and run all act() for other nodes in chain table
4747
/// if this procedure is not suitable for your operator, just override this function.
@@ -90,6 +90,11 @@ class Operator
9090
return this->act_type;
9191
}
9292

93+
calculation_type get_cal_type() const
94+
{
95+
return this->cal_type;
96+
}
97+
9398
protected:
9499
int ik = 0;
95100
int act_type = 1; ///< determine which act() interface would be called in hPsi()

source/module_hamilt_lcao/module_tddft/propagator.h

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ ct::Tensor create_identity_matrix(const int n, ct::DeviceType device = ct::Devic
8484
data_ptr[i * n + i] = init_value<T>();
8585
}
8686
}
87+
#if ((defined __CUDA))
8788
else if (device == ct::DeviceType::GpuDevice)
8889
{
8990
// For GPU, we need to use a kernel to set the diagonal elements
@@ -94,6 +95,7 @@ ct::Tensor create_identity_matrix(const int n, ct::DeviceType device = ct::Devic
9495
ct::kernels::set_memory<T, ct::DEVICE_GPU>()(data_ptr + i * n + i, value, 1);
9596
}
9697
}
98+
#endif
9799

98100
return tensor;
99101
}

0 commit comments

Comments
 (0)