Skip to content

Commit 9cd3350

Browse files
linpeizePeizeLinmohanchen
authored
1. change Exx_Info_Global::coulomb_param from unordered_map to map (Do not recommend using unordered_map, which has defects in C++11) (#6318)
* change INPUT exx_ for linear combination of coulomb_param * git revert a145293 * remove deprecated INPUT exx parameters * 1. change Exx_Info_Global::coulomb_param from unordered_map to map 2. move exx_symmetry_realspace from Exx_Info_Global to Exx_Info_RI * update read_input_ptest.cpp, read_input_item_test.cpp, integrate_tests/INPUT * add threshold in integrate test 002_NO_GO_AF --------- Co-authored-by: linpz <[email protected]> Co-authored-by: Mohan Chen <[email protected]>
1 parent 44ff32e commit 9cd3350

File tree

11 files changed

+21
-20
lines changed

11 files changed

+21
-20
lines changed

source/module_hamilt_general/module_xc/exx_info.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <vector>
88
#include <map>
9-
#include <unordered_map>
109
#include <string>
1110

1211
struct Exx_Info
@@ -15,7 +14,8 @@ struct Exx_Info
1514
{
1615
bool cal_exx = false;
1716

18-
std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param;
17+
std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param;
18+
1919
// Fock:
2020
// "alpha": "0"
2121
// "Rcut_type": "limits" / "spencer"
@@ -34,7 +34,6 @@ struct Exx_Info
3434

3535
bool separate_loop = true;
3636
size_t hybrid_step = 1;
37-
bool exx_symmetry_realspace = true;
3837
};
3938
Exx_Info_Global info_global;
4039

@@ -52,7 +51,8 @@ struct Exx_Info
5251

5352
struct Exx_Info_RI
5453
{
55-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param;
54+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param;
55+
5656

5757
bool real_number = false;
5858

@@ -66,6 +66,7 @@ struct Exx_Info
6666
double C_grad_R_threshold = 0;
6767
double V_grad_R_threshold = 0;
6868
double ccp_rmesh_times = 10;
69+
bool exx_symmetry_realspace = true;
6970
double kmesh_times = 4;
7071

7172
int abfs_Lmax = 0; // tmp

source/module_io/input_conv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ void Input_Conv::Convert()
446446
GlobalC::exx_info.info_global.separate_loop = PARAM.inp.exx_separate_loop;
447447
GlobalC::exx_info.info_global.hybrid_step = PARAM.inp.exx_hybrid_step;
448448
GlobalC::exx_info.info_global.mixing_beta_for_loop1 = PARAM.inp.exx_mixing_beta;
449-
GlobalC::exx_info.info_global.exx_symmetry_realspace = PARAM.inp.exx_symmetry_realspace;
450449

451450
GlobalC::exx_info.info_ri.real_number = std::stoi(PARAM.inp.exx_real_number);
452451
GlobalC::exx_info.info_ri.pca_threshold = PARAM.inp.exx_pca_threshold;
@@ -458,6 +457,7 @@ void Input_Conv::Convert()
458457
GlobalC::exx_info.info_ri.C_grad_R_threshold = PARAM.inp.exx_c_grad_r_threshold;
459458
GlobalC::exx_info.info_ri.V_grad_R_threshold = PARAM.inp.exx_v_grad_r_threshold;
460459
GlobalC::exx_info.info_ri.ccp_rmesh_times = std::stod(PARAM.inp.exx_ccp_rmesh_times);
460+
GlobalC::exx_info.info_ri.exx_symmetry_realspace = PARAM.inp.exx_symmetry_realspace;
461461

462462
#ifdef __EXX
463463
Exx_Abfs::Jle::Lmax = PARAM.inp.exx_opt_orb_lmax;

source/module_rdmft/rdmft_pot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void RDMFT<TK, TR>::cal_V_XC(const UnitCell& ucell)
262262
: RI_2D_Comm::split_m2D_ktoR<double>(ucell,*kv, DM_XC_pointer, *ParaV, nspin, this->exx_spacegroup_symmetry);
263263

264264
// provide the Ds_XC to Vxc_fromRI(V_exx_XC)
265-
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace)
265+
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_ri.exx_symmetry_realspace)
266266
{
267267
Vxc_fromRI_d->cal_exx_elec(Ds_XC_d, ucell,*ParaV, &this->symrot_exx);
268268
}
@@ -291,7 +291,7 @@ void RDMFT<TK, TR>::cal_V_XC(const UnitCell& ucell)
291291
: RI_2D_Comm::split_m2D_ktoR<std::complex<double>>(ucell,*kv, DM_XC_pointer, *ParaV, nspin, this->exx_spacegroup_symmetry);
292292

293293
// // provide the Ds_XC to Vxc_fromRI(V_exx_XC)
294-
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace)
294+
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_ri.exx_symmetry_realspace)
295295
{
296296
Vxc_fromRI_c->cal_exx_elec(Ds_XC_c, ucell,*ParaV, &this->symrot_exx);
297297
}

source/module_ri/Exx_LRI.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void Exx_LRI<Tdata>::init(const MPI_Comm &mpi_comm_in,
4848
{ this->abfs = Exx_Abfs::IO::construct_abfs( abfs_same_atom, orb, this->info.files_abfs, this->info.kmesh_times ); }
4949
Exx_Abfs::Construct_Orbs::print_orbs_size(ucell, this->abfs, GlobalV::ofs_running);
5050

51-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
51+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
52+
5253
coulomb_param_updated = RI_Util::update_coulomb_param(this->info.coulomb_param, ucell.omega, this->p_kv->get_nkstot_full());
5354
this->abfs_ccp = Conv_Coulomb_Pot_K::cal_orbs_ccp(this->abfs, coulomb_param_updated, this->info.ccp_rmesh_times);
5455

source/module_ri/Exx_LRI_interface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void Exx_LRI_Interface<T, Tdata>::exx_eachiterinit(const int istep,
254254
PARAM.inp.nspin,
255255
this->exx_spacegroup_symmetry);
256256

257-
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace)
257+
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_ri.exx_symmetry_realspace)
258258
{ this->cal_exx_elec(Ds, ucell,*dm_in.get_paraV_pointer(), &this->symrot_); }
259259
else
260260
{ this->cal_exx_elec(Ds, ucell,*dm_in.get_paraV_pointer()); }
@@ -445,7 +445,7 @@ bool Exx_LRI_Interface<T, Tdata>::exx_after_converge(
445445
? RI_2D_Comm::split_m2D_ktoR<Tdata>(ucell,*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_gamma_out(), *dm.get_paraV_pointer(), nspin)
446446
: RI_2D_Comm::split_m2D_ktoR<Tdata>(ucell,*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_k_out(), *dm.get_paraV_pointer(), nspin, this->exx_spacegroup_symmetry);
447447

448-
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace)
448+
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_ri.exx_symmetry_realspace)
449449
{ this->cal_exx_elec(Ds, ucell, *dm.get_paraV_pointer(), &this->symrot_); }
450450
else
451451
{ this->cal_exx_elec(Ds, ucell, *dm.get_paraV_pointer()); } // restore DM but not Hexx

source/module_ri/RI_Util.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <array>
1616
#include <vector>
1717
#include <map>
18-
#include <unordered_map>
1918
#include <string>
2019

2120
namespace RI_Util
@@ -63,9 +62,9 @@ namespace RI_Util
6362
return m_new;
6463
}
6564

66-
std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
65+
std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
6766
update_coulomb_param(
68-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
67+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
6968
const double volumn,
7069
const int nkstot);
7170
}

source/module_ri/RI_Util.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ namespace RI_Util
6767
}
6868
*/
6969

70-
inline std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
70+
inline std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
7171
update_coulomb_param(
72-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
72+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
7373
const double volumn,
7474
const int nkstot)
7575
{
76-
std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param_updated = coulomb_param;
76+
std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param_updated = coulomb_param;
7777
for(auto &param_list : coulomb_param_updated)
7878
{
7979
for(auto &param : param_list.second)

source/module_ri/conv_coulomb_pot_k.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace Conv_Coulomb_Pot_K
4444
template<>
4545
Numerical_Orbital_Lm cal_orbs_ccp<Numerical_Orbital_Lm>(
4646
const Numerical_Orbital_Lm &orbs,
47-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
47+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
4848
const double rmesh_times)
4949
{
5050
std::vector<double> psik2_ccp(orbs.get_psif().size(), 0.0);

source/module_ri/conv_coulomb_pot_k.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <vector>
55
#include <map>
6-
#include <unordered_map>
76
#include <string>
87

98
namespace Conv_Coulomb_Pot_K
@@ -17,7 +16,7 @@ namespace Conv_Coulomb_Pot_K
1716

1817
template<typename T> extern T cal_orbs_ccp(
1918
const T &orbs,
20-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
19+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
2120
const double rmesh_times);
2221

2322
//private:

source/module_ri/conv_coulomb_pot_k.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Conv_Coulomb_Pot_K
1111
template< typename T >
1212
std::vector<T> cal_orbs_ccp(
1313
const std::vector<T> & orbs,
14-
const std::unordered_map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
14+
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
1515
const double rmesh_times)
1616
{
1717
std::vector<T> orbs_ccp(orbs.size());

0 commit comments

Comments
 (0)