Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -502,20 +502,20 @@ OBJS_SYMMETRY=symm_other.o\

OBJS_XC=xc_functional.o\
xc_functional_op.o\
xc_functional_vxc.o\
xc_functional_gradcorr.o\
xc_functional_wrapper_xc.o\
xc_functional_wrapper_gcxc.o\
xc_functional_libxc.o\
xc_functional_libxc_tools.o\
xc_functional_libxc_vxc.o\
xc_functional_libxc_wrapper_xc.o\
xc_functional_libxc_wrapper_gcxc.o\
xc_functional_libxc_wrapper_tauxc.o\
xc_funct_exch_lda.o\
xc_funct_corr_lda.o\
xc_funct_exch_gga.o\
xc_funct_corr_gga.o\
xc_pot.o\
xc_grad.o\
xc_lda_wrap.o\
xc_gga_wrap.o\
libxc_setup.o\
libxc_tools.o\
libxc_pot.o\
libxc_lda_wrap.o\
libxc_gga_wrap.o\
libxc_mgga_wrap.o\
xc_lda_exch.o\
xc_lda_corr.o\
xc_gga_exch.o\
xc_gga_corr.o\
xc_funct_hcth.o\
exx_info.o\

Expand Down
2 changes: 1 addition & 1 deletion source/source_estate/module_pot/pot_xc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "source_hamilt/module_xc/xc_functional.h"

#ifdef USE_LIBXC
#include "source_hamilt/module_xc/xc_functional_libxc.h"
#include "source_hamilt/module_xc/libxc.h"
#endif

namespace elecstate
Expand Down
36 changes: 18 additions & 18 deletions source/source_hamilt/module_surchem/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ AddTest(
TARGET MODULE_HAMILT_surchem_cal_vcav
LIBS parameter ${math_libs} planewave device base container
SOURCES cal_vcav_test.cpp ../cal_vcav.cpp ../surchem.cpp ../../../source_pw/module_pwdft/parallel_grid.cpp
../../module_xc/xc_functional_gradcorr.cpp ../../module_xc/xc_functional.cpp
../../module_xc/xc_functional_wrapper_xc.cpp ../../module_xc/xc_functional_wrapper_gcxc.cpp
../../module_xc/xc_functional_libxc.cpp
../../module_xc/xc_functional_libxc_vxc.cpp
../../module_xc/xc_functional_libxc_wrapper_xc.cpp
../../module_xc/xc_functional_libxc_wrapper_gcxc.cpp
../../module_xc/xc_functional_libxc_wrapper_tauxc.cpp
../../module_xc/xc_funct_corr_gga.cpp ../../module_xc/xc_funct_corr_lda.cpp ../../module_xc/xc_funct_exch_gga.cpp
../../module_xc/xc_funct_exch_lda.cpp ../../module_xc/xc_funct_hcth.cpp
../../module_xc/xc_grad.cpp ../../module_xc/xc_functional.cpp
../../module_xc/xc_lda_wrap.cpp ../../module_xc/xc_gga_wrap.cpp
../../module_xc/libxc_setup.cpp
../../module_xc/libxc_pot.cpp
../../module_xc/libxc_lda_wrap.cpp
../../module_xc/libxc_gga_wrap.cpp
../../module_xc/libxc_mgga_wrap.cpp
../../module_xc/xc_gga_corr.cpp ../../module_xc/xc_lda_corr.cpp ../../module_xc/xc_gga_exch.cpp
../../module_xc/xc_lda_exch.cpp ../../module_xc/xc_hcth.cpp
)

AddTest(
TARGET MODULE_HAMILT_surchem_cal_vel
LIBS parameter ${math_libs} planewave device base container
SOURCES cal_vel_test.cpp ../cal_vel.cpp ../surchem.cpp ../cal_epsilon.cpp ../minimize_cg.cpp ../../../source_pw/module_pwdft/parallel_grid.cpp
../../module_xc/xc_functional_gradcorr.cpp ../../module_xc/xc_functional.cpp
../../module_xc/xc_functional_wrapper_xc.cpp ../../module_xc/xc_functional_wrapper_gcxc.cpp
../../module_xc/xc_functional_libxc.cpp
../../module_xc/xc_functional_libxc_vxc.cpp
../../module_xc/xc_functional_libxc_wrapper_xc.cpp
../../module_xc/xc_functional_libxc_wrapper_gcxc.cpp
../../module_xc/xc_functional_libxc_wrapper_tauxc.cpp
../../module_xc/xc_funct_corr_gga.cpp ../../module_xc/xc_funct_corr_lda.cpp ../../module_xc/xc_funct_exch_gga.cpp
../../module_xc/xc_funct_exch_lda.cpp ../../module_xc/xc_funct_hcth.cpp
../../module_xc/xc_grad.cpp ../../module_xc/xc_functional.cpp
../../module_xc/xc_lda_wrap.cpp ../../module_xc/xc_gga_wrap.cpp
../../module_xc/libxc_setup.cpp
../../module_xc/libxc_pot.cpp
../../module_xc/libxc_lda_wrap.cpp
../../module_xc/libxc_gga_wrap.cpp
../../module_xc/libxc_mgga_wrap.cpp
../../module_xc/xc_gga_corr.cpp ../../module_xc/xc_lda_corr.cpp ../../module_xc/xc_gga_exch.cpp
../../module_xc/xc_lda_exch.cpp ../../module_xc/xc_hcth.cpp
)
30 changes: 15 additions & 15 deletions source/source_hamilt/module_xc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ add_library(
xc_
OBJECT
xc_functional.cpp
xc_functional_vxc.cpp
xc_functional_gradcorr.cpp
xc_functional_wrapper_xc.cpp
xc_functional_wrapper_gcxc.cpp
xc_funct_exch_lda.cpp
xc_funct_corr_lda.cpp
xc_funct_exch_gga.cpp
xc_funct_corr_gga.cpp
xc_funct_hcth.cpp
xc_functional_libxc.cpp
xc_functional_libxc_tools.cpp
xc_functional_libxc_vxc.cpp
xc_functional_libxc_wrapper_xc.cpp
xc_functional_libxc_wrapper_gcxc.cpp
xc_functional_libxc_wrapper_tauxc.cpp
xc_pot.cpp
xc_grad.cpp
xc_lda_wrap.cpp
xc_gga_wrap.cpp
xc_lda_exch.cpp
xc_lda_corr.cpp
xc_gga_exch.cpp
xc_gga_corr.cpp
xc_hcth.cpp
libxc_setup.cpp
libxc_tools.cpp
libxc_pot.cpp
libxc_lda_wrap.cpp
libxc_gga_wrap.cpp
libxc_mgga_wrap.cpp
exx_info.cpp
)

Expand Down
39 changes: 25 additions & 14 deletions source/source_hamilt/module_xc/exx_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ struct Exx_Info
{
bool cal_exx = false;

std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param;
std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string, std::string>>> coulomb_param;

// Fock:
// "alpha": "0"
// "singularity_correction": "limits" / "spencer" / "revised_spencer" / "massidda" / "carrier"
// "lambda": "0.3"
// Fock:
// "alpha": "0"
// "singularity_correction": "limits" / "spencer" / "revised_spencer" / "massidda" / "carrier"
// "lambda": "0.3"
// "Rcut"
// Erfc:
// "alpha": "0"
// "omega": "0.11"
// "singularity_correction": "limits" / "spencer" / "revised_spencer"
// Erfc:
// "alpha": "0"
// "omega": "0.11"
// "singularity_correction": "limits" / "spencer" / "revised_spencer"
// "Rcut"

Conv_Coulomb_Pot_K::Ccp_Type ccp_type;
Expand All @@ -36,21 +36,32 @@ struct Exx_Info
};
Exx_Info_Global info_global;

// WARNING: Lifetime dependency
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Good addition. This lifetime dependency warning is valuable — the dangling-reference risk with const& members is a subtle trap, and documenting it here will prevent future bugs if Exx_Info is ever copied or moved.

// Exx_Info_Lip and Exx_Info_RI hold const references to members of Exx_Info_Global.
// Their lifetimes MUST NOT exceed the Exx_Info_Global they were initialized from.
// Currently this is safe because Exx_Info owns both info_global and info_lip/info_ri,
// and GlobalC::exx_info is a global variable with program-lifetime scope.
// However, if Exx_Info is ever copied or moved, these references will become dangling.
// Do NOT add copy/move constructors to Exx_Info without addressing this.
struct Exx_Info_Lip
{
const Conv_Coulomb_Pot_K::Ccp_Type& ccp_type;
const double& hse_omega;
const Conv_Coulomb_Pot_K::Ccp_Type& ccp_type; // reference to info_global.ccp_type
const double& hse_omega; // reference to info_global.hse_omega
double lambda = 0.3;

Exx_Info_Lip(const Exx_Info::Exx_Info_Global& info_global)
:ccp_type(info_global.ccp_type),
hse_omega(info_global.hse_omega) {}
: ccp_type(info_global.ccp_type),
hse_omega(info_global.hse_omega) {}
};
Exx_Info_Lip info_lip;

struct Exx_Info_RI
{
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param;
// reference to info_global.coulomb_param
// Note: coulomb_param is populated AFTER Exx_Info construction (in input_conv.cpp),
// so this reference is valid but initially points to an empty map.
// The data is filled later into info_global, and this reference sees it via aliasing.
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string, std::string>>> &coulomb_param;
Comment thread
mohanchen marked this conversation as resolved.

bool real_number = false;
bool coul_moment = false;
Expand Down
Loading
Loading