27 const std::vector<double>& orb_cutoff,
31 std::vector<std::map<
int, std::map<
TAC, RI::Tensor<double>>>>* Hexxd =
nullptr,
32 std::vector<std::map<
int, std::map<
TAC, RI::Tensor<std::complex<double>>>>>* Hexxc =
nullptr
37 const int& nbands = wg.
nc;
38 const int& nspin0 = (nspin == 2) ? 2 : 1;
48 if (std::is_same<TK, double>::value)
54 auto all_band_energy = [&wg](
const int ik,
const std::vector<double>& e_orb)->
double
57 for (
int i = 0; i < e_orb.size(); ++i) { e += e_orb[i] * wg(ik, i); }
61 auto all_k_all_band_energy = [&wg, &
all_band_energy](
const std::vector<std::vector<double>>& e_orb)->
double
64 for (
int ik = 0; ik < e_orb.size(); ++ik)
76 if_gamma_fix(kinetic_R_ao);
79 &kinetic_R_ao, &ucell, orb_cutoff, &gd, two_center_bundle.kinetic_orb.get());
81 kinetic_op.contributeHR();
83 std::vector<std::vector<double>> e_orb_kinetic;
85 for (
int ik = 0;ik < kv.
get_nks();++ik)
90 cVc(kinetic_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
99 elecstate::Potential pot_local(&rhod_basis, &rho_basis, &ucell, &vloc, &sf, &solvent, &etxc, &vtxc);
104 if_gamma_fix(v_pp_local_R_ao);
105 std::vector<std::vector<double>> e_orb_pp_local;
118 for (
int ik = 0;ik < kv.
get_nks();++ik)
123 cVc(v_pp_local_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
133 if_gamma_fix(v_pp_nonlocal_R_ao);
134 std::vector<std::vector<double>> e_orb_pp_nonlocal;
136 &v_pp_nonlocal_R_ao, &ucell, orb_cutoff, &gd, two_center_bundle.overlap_orb_beta.get());
137 v_pp_nonlocal_op.contributeHR();
138 for (
int ik = 0;ik < kv.
get_nks();++ik)
143 cVc(v_pp_nonlocal_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
145 write_orb_energy(kv, nspin0, nbands, e_orb_pp_nonlocal,
"vpp_nonlocal",
"");
151 elecstate::Potential pot_hartree(&rhod_basis, &rho_basis, &ucell, &vloc, &sf, &solvent, &etxc, &vtxc);
155 for (
int is = 0; is < nspin0; ++is)
157 v_hartree_R_ao[is].set_zero();
158 if_gamma_fix(v_hartree_R_ao[is]);
161 std::vector<hamilt::Veff<hamilt::OperatorLCAO<TK, TR>>*> v_hartree_op(nspin0);
162 for (
int is = 0; is < nspin0; ++is)
165 &v_hartree_k_ao, kv.
kvec_d, &pot_hartree, &v_hartree_R_ao[is], &ucell, orb_cutoff, &gd, nspin);
168 std::vector<std::vector<double>> e_orb_hartree;
169 for (
int ik = 0;ik < kv.
get_nks();++ik)
175 cVc(v_hartree_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
177 for (
auto&
op : v_hartree_op) {
delete op; }
184 write_Vxc<TK, TR>(nspin,
void write_eband_terms(const int nspin, const int nbasis, const int drank, const Parallel_Orbitals *pv, const psi::Psi< TK > &psi, const UnitCell &ucell, Structure_Factor &sf, surchem &solvent, const ModulePW::PW_Basis &rho_basis, const ModulePW::PW_Basis &rhod_basis, const ModuleBase::matrix &vloc, const Charge &chg, const K_Vectors &kv, const ModuleBase::matrix &wg, Grid_Driver &gd, const std::vector< double > &orb_cutoff, const TwoCenterBundle &two_center_bundle)
Definition write_eband_terms.hpp:12