Skip to content

Commit f46d3eb

Browse files
authored
Merge branch 'develop' into modularize_6
2 parents 20820d2 + 867adf7 commit f46d3eb

File tree

14 files changed

+138
-139
lines changed

14 files changed

+138
-139
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 110 additions & 112 deletions
Large diffs are not rendered by default.

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_hamilt_lcao/module_deepks/deepks_check.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void DeePKS_domain::check_tensor(const torch::Tensor& tensor, const std::string&
4949
ofs.close();
5050
}
5151

52+
template void DeePKS_domain::check_tensor<int>(const torch::Tensor& tensor, const std::string& filename, const int rank);
5253
template void DeePKS_domain::check_tensor<double>(const torch::Tensor& tensor, const std::string& filename, const int rank);
5354
template void DeePKS_domain::check_tensor<std::complex<double>>(const torch::Tensor& tensor, const std::string& filename, const int rank);
5455

source/module_hamilt_lcao/module_deepks/deepks_vdpre.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ void DeePKS_domain::cal_v_delta_precalc(const int nlocal,
4848

4949
torch::Tensor v_delta_pdm
5050
= torch::zeros({nks, nlocal, nlocal, inlmax, (2 * lmaxd + 1), (2 * lmaxd + 1)}, torch::dtype(dtype));
51-
auto accessor
52-
= v_delta_pdm.accessor<std::conditional_t<std::is_same<TK, double>::value, double, c10::complex<double>>, 6>();
51+
auto accessor = v_delta_pdm.accessor<TK_tensor, 6>();
5352

5453
DeePKS_domain::iterate_ad2(
5554
ucell,
@@ -108,7 +107,7 @@ void DeePKS_domain::cal_v_delta_precalc(const int nlocal,
108107
= (kvec_d[ik] * ModuleBase::Vector3<double>(dR1 - dR2)) * ModuleBase::TWO_PI;
109108
kphase = std::complex<double>(cos(arg), sin(arg));
110109
}
111-
TK_tensor* kpase_ptr = reinterpret_cast<TK_tensor*>(&kphase);
110+
TK* kpase_ptr = reinterpret_cast<TK*>(&kphase);
112111
for (int L0 = 0; L0 <= orb.Alpha[0].getLmax(); ++L0)
113112
{
114113
for (int N0 = 0; N0 < orb.Alpha[0].getNchi(L0); ++N0)
@@ -119,9 +118,10 @@ void DeePKS_domain::cal_v_delta_precalc(const int nlocal,
119118
{
120119
for (int m2 = 0; m2 < nm; ++m2) // nm = 1 for s, 3 for p, 5 for d
121120
{
122-
TK_tensor tmp = overlap_1->get_value(iw1, ib + m1)
121+
TK tmp = overlap_1->get_value(iw1, ib + m1)
123122
* overlap_2->get_value(iw2, ib + m2) * *kpase_ptr;
124-
accessor[ik][iw1_all][iw2_all][inl][m1][m2] += tmp;
123+
TK_tensor tmp_tensor = TK_tensor(tmp);
124+
accessor[ik][iw1_all][iw2_all][inl][m1][m2] += tmp_tensor;
125125
}
126126
}
127127
ib += nm;
@@ -193,8 +193,7 @@ void DeePKS_domain::prepare_phialpha(const int nlocal,
193193
int nlmax = inlmax / nat;
194194
int mmax = 2 * lmaxd + 1;
195195
phialpha_out = torch::zeros({nat, nlmax, nks, nlocal, mmax}, dtype);
196-
auto accessor
197-
= phialpha_out.accessor<std::conditional_t<std::is_same<TK, double>::value, double, c10::complex<double>>, 5>();
196+
auto accessor = phialpha_out.accessor<TK_tensor, 5>();
198197

199198
DeePKS_domain::iterate_ad1(
200199
ucell,

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)

0 commit comments

Comments
 (0)