Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
c83e361
Use template to reconstruct parse_expression
1041176461 Jan 21, 2023
cdf3c0c
Feature: output R matrix at each MD step
1041176461 Jan 23, 2023
cff6e08
Modify'matrix_HS' to 'matrix' for R matrix output
1041176461 Jan 23, 2023
b9db1f1
Merge branch 'develop' into develop
1041176461 Jan 23, 2023
6c1a77b
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
1041176461 Jan 31, 2023
cc149a5
Merge branches 'develop' and 'develop' of https://github.com/10411764…
Feb 11, 2023
992ba96
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
Feb 11, 2023
0c753e2
Merge branch 'deepmodeling:develop' into develop
1041176461 Feb 12, 2023
3fd87f3
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
Feb 14, 2023
2a81795
Fix: modify index in parse_expression
1041176461 Feb 15, 2023
3523c57
Merge branch 'deepmodeling:develop' into develop
1041176461 Mar 27, 2023
afe397c
Fix: add regfree for parse_expression
May 10, 2023
d7775cf
Merge branch 'develop' into develop
1041176461 May 10, 2023
aad3e5a
Merge branch 'develop' into develop
Qianruipku May 10, 2023
4375864
Merge branch 'deepmodeling:develop' into develop
1041176461 May 21, 2023
d91a9e9
Doc: update phonopy doc
1041176461 Jun 5, 2023
238d73f
Merge branch 'deepmodeling:develop' into develop
1041176461 Jun 5, 2023
cdc685a
Doc: update phonopy doc
1041176461 Jun 5, 2023
47bc26b
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
1041176461 Jun 5, 2023
2ecdcca
Merge branch 'deepmodeling:develop' into develop
1041176461 Jun 24, 2023
53eeedf
Merge branch 'deepmodeling:develop' into develop
1041176461 Aug 30, 2023
b22769e
Merge branch 'deepmodeling:develop' into develop
1041176461 Sep 4, 2023
89d7394
Merge branch 'deepmodeling:develop' into develop
1041176461 Oct 30, 2023
d09f2d8
Merge branch 'deepmodeling:develop' into develop
1041176461 Apr 8, 2024
2673ecc
fix tdos plot for nspin=2
1041176461 Apr 8, 2024
3d2d8dd
optimize dosplot for nspin=2
1041176461 Apr 8, 2024
d919681
fix legend for dosplot
1041176461 Apr 8, 2024
76defcd
Merge branch 'develop' into develop
1041176461 Apr 8, 2024
560a60c
Merge branch 'deepmodeling:develop' into develop
1041176461 May 8, 2024
47d5cac
Merge branch 'deepmodeling:develop' into develop
1041176461 Jul 3, 2024
8e0c6d8
Merge branch 'deepmodeling:develop' into develop
1041176461 Oct 13, 2024
90e4750
Merge branch 'deepmodeling:develop' into develop
1041176461 Oct 19, 2024
d0bedae
Add files via upload
ESROAMER Nov 2, 2024
25a77b3
Update cal_edm_tddft.cpp
ESROAMER Nov 2, 2024
e21da57
Refactor: modify exx loop for relax/md
1041176461 Nov 2, 2024
74651ac
Update result.ref
ESROAMER Nov 2, 2024
b67c43c
Fix wrong parameters in integrate test
ESROAMER Nov 2, 2024
0cb9cbb
Update result.ref
ESROAMER Nov 2, 2024
2ba948c
Update result.ref
ESROAMER Nov 2, 2024
58cc693
Update result.ref
ESROAMER Nov 2, 2024
6513db5
Update result.ref
ESROAMER Nov 2, 2024
0fc246b
Update result.ref
ESROAMER Nov 2, 2024
0721fbb
Update result.ref
ESROAMER Nov 2, 2024
63e59b5
Update result.ref
ESROAMER Nov 2, 2024
22058e3
Update result.ref
ESROAMER Nov 2, 2024
ced029a
add exx when istep>0
maki49 Nov 2, 2024
7740356
Merge pull request #8 from maki49/new_loop
1041176461 Nov 3, 2024
d15217c
Merge pull request #7 from 1041176461/new_loop
1041176461 Nov 3, 2024
2755221
Merge branch 'develop' into develop
1041176461 Nov 4, 2024
9b7df7d
Update dos.py
1041176461 Nov 4, 2024
a8a9051
Update esolver_sdft_pw.cpp
1041176461 Nov 4, 2024
ba09ba9
Update lcao_before_scf.cpp
1041176461 Nov 4, 2024
f5734d4
Update Exx_LRI_interface.h
1041176461 Nov 4, 2024
cacaf93
Update Exx_LRI_interface.hpp
1041176461 Nov 4, 2024
894cb25
Fix: compile error
1041176461 Nov 4, 2024
7c54ec6
Fix: compile error
1041176461 Nov 4, 2024
8c7c0e6
Fix: change HSE relax/md result.ref for new framework
1041176461 Nov 5, 2024
3df2804
Merge branch 'pr/1041176461/9' into develop
1041176461 Nov 6, 2024
9a820d2
Fix: compile error
1041176461 Nov 6, 2024
ebfdadc
compatible with exx_iter_finish
1041176461 Nov 6, 2024
eca5f43
Merge branch 'deepmodeling:develop' into develop
ESROAMER Nov 7, 2024
bac726b
Add files via upload
ESROAMER Nov 7, 2024
6965e9e
Update esolver_ks_lcao_tddft.h
ESROAMER Nov 8, 2024
09aa1a1
Update esolver_ks_lcao_tddft.cpp
ESROAMER Nov 8, 2024
2373c13
Merge pull request #10 from ESROAMER/no_force
1041176461 Nov 8, 2024
0ca4e04
Merge branch 'deepmodeling-develop' into develop
1041176461 Nov 27, 2024
7e3e147
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
1041176461 Nov 27, 2024
289036b
Merge branch 'deepmodeling:develop' into develop
1041176461 Jan 6, 2025
db653b7
Fix: support negative value in parse_expression
1041176461 Jan 6, 2025
4b82a10
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Jan 6, 2025
7e0c98e
Merge branch 'deepmodeling:develop' into develop
1041176461 Jan 30, 2025
eb353a8
Fix: parse_expression for scientific notation
1041176461 Jan 30, 2025
c1235ac
Update input_conv.h
1041176461 Jan 30, 2025
477c87a
Merge branch 'deepmodeling:develop' into develop
1041176461 Feb 22, 2025
15d4fca
Merge branch 'deepmodeling:develop' into develop
1041176461 May 13, 2025
d7771a8
Merge branch 'deepmodeling:develop' into develop
1041176461 Jun 5, 2025
4ee5b2c
Merge branch 'deepmodeling:develop' into develop
1041176461 Jun 17, 2025
a6d828d
add complex erf function
1041176461 Jun 17, 2025
9cb6230
Merge branch 'develop' of https://github.com/deepmodeling/abacus-deve…
1041176461 Jul 1, 2025
8328df9
refactor ccp framework
1041176461 Jul 1, 2025
0ad01df
fix compile
1041176461 Jul 1, 2025
c2d6085
fix compile
1041176461 Jul 1, 2025
18cc44e
fix compile
1041176461 Jul 1, 2025
29517df
fix compile
1041176461 Jul 1, 2025
a40e993
fix compile
1041176461 Jul 1, 2025
f87ee41
fix compile
1041176461 Jul 1, 2025
9d5b757
fix compile
1041176461 Jul 1, 2025
4cfbc17
fix empty error
1041176461 Jul 2, 2025
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
13 changes: 5 additions & 8 deletions source/source_hamilt/module_xc/exx_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ struct Exx_Info

struct Exx_Info_RI
{
const 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_Method,
std::pair<bool,
std::map<Conv_Coulomb_Pot_K::Coulomb_Type,
std::vector<std::map<std::string,std::string>>>>> coulomb_settings;

bool real_number = false;

Expand All @@ -70,15 +72,10 @@ struct Exx_Info
double kmesh_times = 4;

int abfs_Lmax = 0; // tmp

Exx_Info_RI(const Exx_Info::Exx_Info_Global& info_global)
: coulomb_param(info_global.coulomb_param)
{
}
};
Exx_Info_RI info_ri;

Exx_Info() : info_lip(this->info_global), info_ri(this->info_global)
Exx_Info() : info_lip(this->info_global)
{
}
};
Expand Down
23 changes: 15 additions & 8 deletions source/source_io/input_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,15 @@ void Input_Conv::Convert()
{
if(PARAM.inp.basis_type == "lcao")
{
GlobalC::exx_info.info_global.coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Fock].resize(fock_alpha.size());
std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param;
coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Fock].resize(fock_alpha.size());
for(std::size_t i=0; i<fock_alpha.size(); ++i)
{
GlobalC::exx_info.info_global.coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Fock][i] = {{
coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Fock][i] = {{
{"alpha", ModuleBase::GlobalFunc::TO_STRING(fock_alpha[i])},
{"Rcut_type", "spencer"} }};
}
GlobalC::exx_info.info_ri.coulomb_settings[Conv_Coulomb_Pot_K::Coulomb_Method::Center2] = std::make_pair(true, coulomb_param);
}
else if(PARAM.inp.basis_type == "lcao_in_pw")
{
Expand Down Expand Up @@ -388,13 +390,18 @@ void Input_Conv::Convert()
if(!erfc_alpha.empty())
{
assert(erfc_alpha.size() == PARAM.inp.exx_erfc_omega.size());
GlobalC::exx_info.info_global.coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Erfc].resize(erfc_alpha.size());
for(std::size_t i=0; i<erfc_alpha.size(); ++i)
if(PARAM.inp.basis_type == "lcao")
{
GlobalC::exx_info.info_global.coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Erfc] = {{
{"alpha", ModuleBase::GlobalFunc::TO_STRING(erfc_alpha[i])},
{"omega", ModuleBase::GlobalFunc::TO_STRING(PARAM.inp.exx_erfc_omega[i])},
{"Rcut_type", "limits"} }};
std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param;
coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Erfc].resize(erfc_alpha.size());
for(std::size_t i=0; i<erfc_alpha.size(); ++i)
{
coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Erfc] = {{
{"alpha", ModuleBase::GlobalFunc::TO_STRING(erfc_alpha[i])},
{"omega", ModuleBase::GlobalFunc::TO_STRING(PARAM.inp.exx_erfc_omega[i])},
{"Rcut_type", "limits"} }};
}
GlobalC::exx_info.info_ri.coulomb_settings[Conv_Coulomb_Pot_K::Coulomb_Method::Center2] = std::make_pair(true, coulomb_param);
}
}
}
Expand Down
15 changes: 12 additions & 3 deletions source/source_lcao/module_ri/Exx_LRI.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
class OperatorLREXX;
}

template<typename Tdata>
class Exx_Obj
{
// match with Conv_Coulomb_Pot_K::Coulomb_Method
public:
LRI_CV<Tdata> cv;
std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs_ccp;
};

template<typename Tdata>
class Exx_LRI
{
Expand Down Expand Up @@ -85,9 +94,9 @@ class Exx_LRI

std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> lcaos;
std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs;
std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs_ccp;

LRI_CV<Tdata> cv;
//std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs_ccp;
std::map<Conv_Coulomb_Pot_K::Coulomb_Method, Exx_Obj<Tdata>> exx_objs;
//LRI_CV<Tdata> cv;
RI::Exx<TA,Tcell,Ndim,Tdata> exx_lri;

void post_process_Hexx( std::map<TA, std::map<TAC, RI::Tensor<Tdata>>> &Hexxs_io ) const;
Expand Down
97 changes: 63 additions & 34 deletions source/source_lcao/module_ri/Exx_LRI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,18 @@ void Exx_LRI<Tdata>::init(const MPI_Comm &mpi_comm_in,
{ this->abfs = Exx_Abfs::IO::construct_abfs( abfs_same_atom, orb, this->info.files_abfs, this->info.kmesh_times ); }
Exx_Abfs::Construct_Orbs::print_orbs_size(ucell, this->abfs, GlobalV::ofs_running);

const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>

coulomb_param_updated = RI_Util::update_coulomb_param(this->info.coulomb_param, ucell.omega, this->p_kv->get_nkstot_full());
this->abfs_ccp = Conv_Coulomb_Pot_K::cal_orbs_ccp(this->abfs, coulomb_param_updated, this->info.ccp_rmesh_times);

for( size_t T=0; T!=this->abfs.size(); ++T )
{ GlobalC::exx_info.info_ri.abfs_Lmax = std::max( GlobalC::exx_info.info_ri.abfs_Lmax, static_cast<int>(this->abfs[T].size())-1 ); }

this->cv.set_orbitals(
ucell,
orb,
this->lcaos, this->abfs, this->abfs_ccp,
this->info.kmesh_times, this->info.ccp_rmesh_times );
for(const auto &settings_list : this->info.coulomb_settings)
{
const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
coulomb_param_updated = RI_Util::update_coulomb_param(settings_list.second.second, ucell.omega, this->p_kv->get_nkstot_full());
this->exx_objs[settings_list.first].abfs_ccp = Conv_Coulomb_Pot_K::cal_orbs_ccp(this->abfs, coulomb_param_updated, this->info.ccp_rmesh_times);
this->exx_objs[settings_list.first].cv.set_orbitals(ucell, orb,
this->lcaos, this->abfs, this->exx_objs[settings_list.first].abfs_ccp,
this->info.kmesh_times, this->info.ccp_rmesh_times );
}

ModuleBase::timer::tick("Exx_LRI", "init");
}
Expand Down Expand Up @@ -96,26 +95,39 @@ void Exx_LRI<Tdata>::cal_exx_ions(const UnitCell& ucell,
const std::pair<std::vector<TA>, std::vector<std::vector<std::pair<TA,std::array<Tcell,Ndim>>>>>
list_As_Vs = RI::Distribute_Equally::distribute_atoms_periods(this->mpi_comm, atoms, period_Vs, 2, false);

std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>
Vs = this->cv.cal_Vs(ucell,
list_As_Vs.first, list_As_Vs.second[0],
{{"writable_Vws",true}});
this->cv.Vws = LRI_CV_Tools::get_CVws(ucell,Vs);
std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> Vs;
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, Ndim>>> dVs;
for(const auto &settings_list : this->info.coulomb_settings)
{
std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>
Vs_temp = this->exx_objs[settings_list.first].cv.cal_Vs(ucell,
list_As_Vs.first, list_As_Vs.second[0],
{{"writable_Vws",true}});
this->exx_objs[settings_list.first].cv.Vws = LRI_CV_Tools::get_CVws(ucell,Vs_temp);
Vs = Vs.empty() ? Vs_temp : LRI_CV_Tools::add(Vs, Vs_temp);

if(PARAM.inp.cal_force || PARAM.inp.cal_stress)
{
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, Ndim>>>
dVs_temp = this->exx_objs[settings_list.first].cv.cal_dVs(ucell,
list_As_Vs.first, list_As_Vs.second[0],
{{"writable_dVws",true}});
this->exx_objs[settings_list.first].cv.dVws = LRI_CV_Tools::get_dCVws(ucell,dVs_temp);
dVs = dVs.empty() ? dVs_temp : LRI_CV_Tools::add(dVs, dVs_temp);
}
}
if (write_cv && GlobalV::MY_RANK == 0)
{ LRI_CV_Tools::write_Vs_abf(Vs, PARAM.globalv.global_out_dir + "Vs"); }
this->exx_lri.set_Vs(std::move(Vs), this->info.V_threshold);

if(PARAM.inp.cal_force || PARAM.inp.cal_stress)
{
std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>
dVs = this->cv.cal_dVs(ucell,
list_As_Vs.first, list_As_Vs.second[0],
{{"writable_dVws",true}});
this->cv.dVws = LRI_CV_Tools::get_dCVws(ucell,dVs);
this->exx_lri.set_dVs(std::move(dVs), this->info.V_grad_threshold);
std::array<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>, Ndim>
dVs_order = LRI_CV_Tools::change_order(std::move(dVs));
this->exx_lri.set_dVs(std::move(dVs_order), this->info.V_grad_threshold);
if(PARAM.inp.cal_stress)
{
std::array<std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>,3> dVRs = LRI_CV_Tools::cal_dMRs(ucell,dVs);
std::array<std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>,3> dVRs = LRI_CV_Tools::cal_dMRs(ucell,dVs_order);
this->exx_lri.set_dVRs(std::move(dVRs), this->info.V_grad_R_threshold);
}
}
Expand All @@ -124,26 +136,43 @@ void Exx_LRI<Tdata>::cal_exx_ions(const UnitCell& ucell,
const std::pair<std::vector<TA>, std::vector<std::vector<std::pair<TA,std::array<Tcell,Ndim>>>>>
list_As_Cs = RI::Distribute_Equally::distribute_atoms_periods(this->mpi_comm, atoms, period_Cs, 2, false);

std::pair<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>, std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>>
Cs_dCs = this->cv.cal_Cs_dCs(
ucell,
list_As_Cs.first, list_As_Cs.second[0],
{{"cal_dC",PARAM.inp.cal_force||PARAM.inp.cal_stress},
{"writable_Cws",true}, {"writable_dCws",true}, {"writable_Vws",false}, {"writable_dVws",false}});
std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> &Cs = std::get<0>(Cs_dCs);
this->cv.Cws = LRI_CV_Tools::get_CVws(ucell,Cs);
std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> Cs;
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>> dCs;
for(const auto &settings_list : this->info.coulomb_settings)
{
if(settings_list.second.first)
{
std::pair<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>,
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>>>
Cs_dCs = this->exx_objs[settings_list.first].cv.cal_Cs_dCs(
ucell,
list_As_Cs.first, list_As_Cs.second[0],
{{"cal_dC",PARAM.inp.cal_force||PARAM.inp.cal_stress},
{"writable_Cws",true}, {"writable_dCws",true}, {"writable_Vws",false}, {"writable_dVws",false}});
std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> &Cs_temp = std::get<0>(Cs_dCs);
this->exx_objs[settings_list.first].cv.Cws = LRI_CV_Tools::get_CVws(ucell,Cs_temp);
Cs = Cs.empty() ? Cs_temp : LRI_CV_Tools::add(Cs, Cs_temp);

if(PARAM.inp.cal_force || PARAM.inp.cal_stress)
{
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>> &dCs_temp = std::get<1>(Cs_dCs);
this->exx_objs[settings_list.first].cv.dCws = LRI_CV_Tools::get_dCVws(ucell,dCs_temp);
dCs = dCs.empty() ? dCs_temp : LRI_CV_Tools::add(dCs, dCs_temp);
}
}
}
if (write_cv && GlobalV::MY_RANK == 0)
{ LRI_CV_Tools::write_Cs_ao(Cs, PARAM.globalv.global_out_dir + "Cs"); }
this->exx_lri.set_Cs(std::move(Cs), this->info.C_threshold);

if(PARAM.inp.cal_force || PARAM.inp.cal_stress)
{
std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3> &dCs = std::get<1>(Cs_dCs);
this->cv.dCws = LRI_CV_Tools::get_dCVws(ucell,dCs);
this->exx_lri.set_dCs(std::move(dCs), this->info.C_grad_threshold);
std::array<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>, Ndim>
dCs_order = LRI_CV_Tools::change_order(std::move(dCs));
this->exx_lri.set_dCs(std::move(dCs_order), this->info.C_grad_threshold);
if(PARAM.inp.cal_stress)
{
std::array<std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>,3> dCRs = LRI_CV_Tools::cal_dMRs(ucell,dCs);
std::array<std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>,3> dCRs = LRI_CV_Tools::cal_dMRs(ucell,dCs_order);
this->exx_lri.set_dCRs(std::move(dCRs), this->info.C_grad_R_threshold);
}
}
Expand Down
6 changes: 3 additions & 3 deletions source/source_lcao/module_ri/LRI_CV.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ class LRI_CV
const std::vector<TA> &list_A0,
const std::vector<TAC> &list_A1,
const std::map<std::string,bool> &flags); // "writable_Vws"
inline std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>
inline std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>>
cal_dVs(
const UnitCell &ucell,
const std::vector<TA> &list_A0,
const std::vector<TAC> &list_A1,
const std::map<std::string,bool> &flags); // "writable_dVws"
std::pair<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,
std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>>
std::pair<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>,
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>>>
cal_Cs_dCs(
const UnitCell &ucell,
const std::vector<TA> &list_A0,
Expand Down
29 changes: 15 additions & 14 deletions source/source_lcao/module_ri/LRI_CV.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,14 @@ auto LRI_CV<Tdata>::cal_dVs(
const std::vector<TA> &list_A0,
const std::vector<TAC> &list_A1,
const std::map<std::string,bool> &flags) // + "writable_dVws"
-> std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>
-> std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>>
{
ModuleBase::TITLE("LRI_CV","cal_dVs");
const T_func_DPcal_data<std::array<RI::Tensor<Tdata>,3>>
func_DPcal_dV = std::bind(
&LRI_CV<Tdata>::DPcal_dV, this,
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
return LRI_CV_Tools::change_order(
this->cal_datas(ucell,list_A0, list_A1, flags, this->ccp_rmesh_times, func_DPcal_dV));
return this->cal_datas(ucell,list_A0, list_A1, flags, this->ccp_rmesh_times, func_DPcal_dV);
}

template<typename Tdata>
Expand All @@ -163,7 +162,9 @@ auto LRI_CV<Tdata>::cal_Cs_dCs(
const std::vector<TA> &list_A0,
const std::vector<TAC> &list_A1,
const std::map<std::string,bool> &flags) // "cal_dC" + "writable_Cws", "writable_dCws", "writable_Vws", "writable_dVws"
-> std::pair<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>, std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>>
-> std::pair<
std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>,
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>>>
{
ModuleBase::TITLE("LRI_CV","cal_Cs_dCs");
const T_func_DPcal_data<std::pair<RI::Tensor<Tdata>, std::array<RI::Tensor<Tdata>,3>>>
Expand All @@ -173,16 +174,16 @@ auto LRI_CV<Tdata>::cal_Cs_dCs(
std::map<TA,std::map<TAC, std::pair<RI::Tensor<Tdata>, std::array<RI::Tensor<Tdata>,3>>>>
Cs_dCs_tmp = this->cal_datas(ucell,list_A0, list_A1, flags, std::min(1.0,this->ccp_rmesh_times), func_DPcal_C_dC);

std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> Cs;
std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3> dCs;
for(auto &Cs_dCs_A : Cs_dCs_tmp)
for(auto &Cs_dCs_B : Cs_dCs_A.second)
{
Cs[Cs_dCs_A.first][Cs_dCs_B.first] = std::move(std::get<0>(Cs_dCs_B.second));
if(flags.at("cal_dC"))
for(int ix=0; ix<3; ++ix)
dCs[ix][Cs_dCs_A.first][Cs_dCs_B.first] = std::move(std::get<1>(Cs_dCs_B.second)[ix]);
}
std::map<TA, std::map<TAC, RI::Tensor<Tdata>>> Cs;
std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>> dCs;
for (auto& Cs_dCs_A: Cs_dCs_tmp)
for (auto& Cs_dCs_B: Cs_dCs_A.second) {
Cs[Cs_dCs_A.first][Cs_dCs_B.first]
= std::move(std::get<0>(Cs_dCs_B.second));
if (flags.at("cal_dC"))
dCs[Cs_dCs_A.first][Cs_dCs_B.first]
= std::move(std::get<1>(Cs_dCs_B.second));
}
return std::make_pair(Cs, dCs);
}

Expand Down
Loading
Loading