29 const std::vector<double>& orb_cutoff,
33 std::vector<std::map<
int, std::map<
TAC, RI::Tensor<double>>>>* Hexxd =
nullptr,
34 std::vector<std::map<
int, std::map<
TAC, RI::Tensor<std::complex<double>>>>>* Hexxc =
nullptr
39 const int& nbands = wg.
nc;
40 const int& nspin0 = (nspin == 2) ? 2 : 1;
50 set_gint_pointer<TK>(gint_gamma, gint_k, gint);
54 if (std::is_same<TK, double>::value)
60 auto all_band_energy = [&wg](
const int ik,
const std::vector<double>& e_orb)->
double
63 for (
int i = 0; i < e_orb.size(); ++i) { e += e_orb[i] * wg(ik, i); }
67 auto all_k_all_band_energy = [&wg, &
all_band_energy](
const std::vector<std::vector<double>>& e_orb)->
double
70 for (
int ik = 0; ik < e_orb.size(); ++ik)
82 if_gamma_fix(kinetic_R_ao);
85 &kinetic_R_ao, &ucell, orb_cutoff, &gd, two_center_bundle.kinetic_orb.get());
87 kinetic_op.contributeHR();
89 std::vector<std::vector<double>> e_orb_kinetic;
91 for (
int ik = 0;ik < kv.
get_nks();++ik)
96 cVc(kinetic_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
105 elecstate::Potential pot_local(&rhod_basis, &rho_basis, &ucell, &vloc, &sf, &solvent, &etxc, &vtxc);
110 if_gamma_fix(v_pp_local_R_ao);
111 std::vector<std::vector<double>> e_orb_pp_local;
124 for (
int ik = 0;ik < kv.
get_nks();++ik)
129 cVc(v_pp_local_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
139 if_gamma_fix(v_pp_nonlocal_R_ao);
140 std::vector<std::vector<double>> e_orb_pp_nonlocal;
142 &v_pp_nonlocal_R_ao, &ucell, orb_cutoff, &gd, two_center_bundle.overlap_orb_beta.get());
143 v_pp_nonlocal_op.contributeHR();
144 for (
int ik = 0;ik < kv.
get_nks();++ik)
149 cVc(v_pp_nonlocal_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
151 write_orb_energy(kv, nspin0, nbands, e_orb_pp_nonlocal,
"vpp_nonlocal",
"");
157 elecstate::Potential pot_hartree(&rhod_basis, &rho_basis, &ucell, &vloc, &sf, &solvent, &etxc, &vtxc);
161 for (
int is = 0; is < nspin0; ++is)
163 v_hartree_R_ao[is].set_zero();
164 if_gamma_fix(v_hartree_R_ao[is]);
167 std::vector<hamilt::Veff<hamilt::OperatorLCAO<TK, TR>>*> v_hartree_op(nspin0);
168 for (
int is = 0; is < nspin0; ++is)
171 &v_hartree_k_ao, kv.
kvec_d, &pot_hartree, &v_hartree_R_ao[is], &ucell, orb_cutoff, &gd, nspin);
174 std::vector<std::vector<double>> e_orb_hartree;
175 for (
int ik = 0;ik < kv.
get_nks();++ik)
181 cVc(v_hartree_k_ao.
get_hk(), &
psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d));
183 for (
auto&
op : v_hartree_op) {
delete op; }
190 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, Gint_Gamma &gint_gamma, Gint_k &gint_k, 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