ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
RPA_LRI.hpp
Go to the documentation of this file.
1//=======================
2// AUTHOR : Rong Shi
3// DATE : 2022-12-09
4//=======================
5
6#ifndef RPA_LRI_HPP
7#define RPA_LRI_HPP
8#include <cstring>
9#include <fstream>
10#include <iostream>
11#include <vector>
13
14#include "RPA_LRI.h"
16
17template <typename T, typename Tdata>
18void RPA_LRI<T, Tdata>::init(const MPI_Comm& mpi_comm_in, const K_Vectors& kv_in, const std::vector<double>& orb_cutoff)
19{
20 ModuleBase::TITLE("RPA_LRI", "init");
21 ModuleBase::timer::tick("RPA_LRI", "init");
22 this->mpi_comm = mpi_comm_in;
23 this->orb_cutoff_ = orb_cutoff;
24 this->lcaos = exx_lri_rpa.lcaos;
25 this->abfs = exx_lri_rpa.abfs;
26 this->p_kv = &kv_in;
27
28 // this->cv = std::move(exx_lri_rpa.cv);
29 // exx_lri_rpa.cv = exx_lri_rpa.cv;
30}
31
32template <typename T, typename Tdata>
34{
35 std::vector<TA> atoms(ucell.nat);
36 for (int iat = 0; iat < ucell.nat; ++iat)
37 {
38 atoms[iat] = iat;
39 }
40 const std::array<Tcell, Ndim> period = {p_kv->nmp[0], p_kv->nmp[1], p_kv->nmp[2]};
41
42 const std::array<Tcell, Ndim> period_Vs = LRI_CV_Tools::cal_latvec_range<Tcell>(1 + this->info.ccp_rmesh_times, ucell,orb_cutoff_);
43 const std::pair<std::vector<TA>, std::vector<std::vector<std::pair<TA, std::array<Tcell, Ndim>>>>> list_As_Vs
44 = RI::Distribute_Equally::distribute_atoms(this->mpi_comm, atoms, period_Vs, 2, false);
45
46 std::map<TA, std::map<TAC, RI::Tensor<Tdata>>> Vs = exx_lri_rpa.exx_objs[Conv_Coulomb_Pot_K::Coulomb_Method::Center2].cv.cal_Vs(ucell,
47 list_As_Vs.first,
48 list_As_Vs.second[0],
49 {
50 {"writable_Vws", true}
51 });
52 this->Vs_period = RI::RI_Tools::cal_period(Vs, period);
53
54 const std::array<Tcell, Ndim> period_Cs = LRI_CV_Tools::cal_latvec_range<Tcell>(2, ucell,orb_cutoff_);
55 const std::pair<std::vector<TA>, std::vector<std::vector<std::pair<TA, std::array<Tcell, Ndim>>>>> list_As_Cs
56 = RI::Distribute_Equally::distribute_atoms_periods(this->mpi_comm, atoms, period_Cs, 2, false);
57
58 std::pair<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>,
59 std::map<TA, std::map<TAC, std::array<RI::Tensor<Tdata>, 3>>>>
60 Cs_dCs = exx_lri_rpa.exx_objs[Conv_Coulomb_Pot_K::Coulomb_Method::Center2].cv.cal_Cs_dCs(ucell,
61 list_As_Cs.first,
62 list_As_Cs.second[0],
63 {
64 {"cal_dC", false},
65 {"writable_Cws", true },
66 {"writable_dCws", true },
67 {"writable_Vws", false},
68 {"writable_dVws", false}
69 });
70 std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>& Cs = std::get<0>(Cs_dCs);
71 this->Cs_period = RI::RI_Tools::cal_period(Cs, period);
72 this->Cs_period = exx_lri_rpa.exx_lri.post_2D.set_tensors_map2(this->Cs_period);
73}
74
75template <typename T, typename Tdata>
77 const MPI_Comm& mpi_comm_in,
78 const UnitCell& ucell,
79 const K_Vectors& kv,
80 const LCAO_Orbitals& orb)
81{
82 Mix_DMk_2D mix_DMk_2D;
83 bool exx_spacegroup_symmetry = (PARAM.inp.nspin < 4 && ModuleSymmetry::Symmetry::symm_flag == 1);
84 if (exx_spacegroup_symmetry)
85 {mix_DMk_2D.set_nks(kv.get_nkstot_full() * (PARAM.inp.nspin == 2 ? 2 : 1), PARAM.globalv.gamma_only_local);}
86 else
87 {mix_DMk_2D.set_nks(kv.get_nks(), PARAM.globalv.gamma_only_local);}
88
89 mix_DMk_2D.set_mixing(nullptr);
91 if (exx_spacegroup_symmetry)
92 {
93 const std::array<Tcell, Ndim> period = RI_Util::get_Born_vonKarmen_period(kv);
94 const auto& Rs = RI_Util::get_Born_von_Karmen_cells(period);
95 symrot.find_irreducible_sector(ucell.symm, ucell.atoms, ucell.st,
96 Rs, period, ucell.lat);
97 // set Lmax of the rotation matrices to max(l_ao, l_abf), to support rotation under ABF
98 symrot.set_abfs_Lmax(GlobalC::exx_info.info_ri.abfs_Lmax);
99 symrot.cal_Ms(kv, ucell, *dm.get_paraV_pointer());
100 // output Ts (symrot_R.txt) and Ms (symrot_k.txt)
101 ModuleSymmetry::print_symrot_info_R(symrot, ucell.symm, ucell.lmax, Rs);
102 ModuleSymmetry::print_symrot_info_k(symrot, kv, ucell);
103 mix_DMk_2D.mix(symrot.restore_dm(kv, dm.get_DMK_vector(), *dm.get_paraV_pointer()), true);
104 }
105 else { mix_DMk_2D.mix(dm.get_DMK_vector(), true); }
106
107 const std::vector<std::map<TA, std::map<TAC, RI::Tensor<Tdata>>>>
109 ? RI_2D_Comm::split_m2D_ktoR<Tdata>(ucell,kv, mix_DMk_2D.get_DMk_gamma_out(), *dm.get_paraV_pointer(), PARAM.inp.nspin)
110 : RI_2D_Comm::split_m2D_ktoR<Tdata>(ucell,kv, mix_DMk_2D.get_DMk_k_out(), *dm.get_paraV_pointer(), PARAM.inp.nspin, exx_spacegroup_symmetry);
111
112 // set parameters for bare Coulomb potential
118 {"alpha", "1"},
119 {"singularity_correction", "spencer"} }};
120
121
122 exx_lri_rpa.init(mpi_comm_in, ucell, kv, orb);
123 exx_lri_rpa.cal_exx_ions(ucell,PARAM.inp.out_ri_cv);
124
125 if (exx_spacegroup_symmetry && PARAM.inp.exx_symmetry_realspace) {
126 exx_lri_rpa.cal_exx_elec(Ds, ucell,*dm.get_paraV_pointer(), &symrot);
127 } else {
128 exx_lri_rpa.cal_exx_elec(Ds, ucell,*dm.get_paraV_pointer());
129 }
130}
131
132template <typename T, typename Tdata>
134 const Parallel_Orbitals& parav,
135 const psi::Psi<T>& psi,
136 const elecstate::ElecState* pelec)
137{
138 ModuleBase::TITLE("DFT_RPA_interface", "out_for_RPA");
139 this->out_bands(pelec);
140 this->out_eigen_vector(parav, psi);
141 this->out_struc(ucell);
142
143 this->cal_rpa_cv(ucell);
144 std::cout << "rpa_pca_threshold: " << this->info.pca_threshold << std::endl;
145 std::cout << "rpa_ccp_rmesh_times: " << this->info.ccp_rmesh_times << std::endl;
146 std::cout << "rpa_lcao_exx(Ha): " << std::fixed << std::setprecision(15) << exx_lri_rpa.Eexx / 2.0 << std::endl;
147 this->out_Cs(ucell);
148 this->out_coulomb_k(ucell);
149
150 std::cout << "etxc(Ha): " << std::fixed << std::setprecision(15) << pelec->f_en.etxc / 2.0 << std::endl;
151 std::cout << "etot(Ha): " << std::fixed << std::setprecision(15) << pelec->f_en.etot / 2.0 << std::endl;
152 std::cout << "Etot_without_rpa(Ha): " << std::fixed << std::setprecision(15)
153 << (pelec->f_en.etot - pelec->f_en.etxc + exx_lri_rpa.Eexx) / 2.0 << std::endl;
154
155 return;
156}
157
158template <typename T, typename Tdata>
160{
161
162 ModuleBase::TITLE("DFT_RPA_interface", "out_eigen_vector");
163
164 const int nks_tot = PARAM.inp.nspin == 2 ? p_kv->get_nks() / 2 : p_kv->get_nks();
165 const int npsin_tmp = PARAM.inp.nspin == 2 ? 2 : 1;
166 const std::complex<double> zero(0.0, 0.0);
167
168 for (int ik = 0; ik < nks_tot; ik++)
169 {
170 std::stringstream ss;
171 ss << "KS_eigenvector_" << ik << ".dat";
172
173 std::ofstream ofs;
174 if (GlobalV::MY_RANK == 0)
175 {
176 ofs.open(ss.str().c_str(), std::ios::out);
177 }
178 std::vector<ModuleBase::ComplexMatrix> is_wfc_ib_iw(npsin_tmp);
179 for (int is = 0; is < npsin_tmp; is++)
180 {
181 is_wfc_ib_iw[is].create(PARAM.inp.nbands, PARAM.globalv.nlocal);
182 for (int ib_global = 0; ib_global < PARAM.inp.nbands; ++ib_global)
183 {
184 std::vector<std::complex<double>> wfc_iks(PARAM.globalv.nlocal, zero);
185
186 const int ib_local = parav.global2local_col(ib_global);
187
188 if (ib_local >= 0)
189 {
190 for (int ir = 0; ir < psi.get_nbasis(); ir++)
191 {
192 wfc_iks[parav.local2global_row(ir)] = psi(ik + nks_tot * is, ib_local, ir);
193 }
194 }
195
196 std::vector<std::complex<double>> tmp = wfc_iks;
197#ifdef __MPI
198 MPI_Allreduce(&tmp[0], &wfc_iks[0], PARAM.globalv.nlocal, MPI_DOUBLE_COMPLEX, MPI_SUM, MPI_COMM_WORLD);
199#endif
200 for (int iw = 0; iw < PARAM.globalv.nlocal; iw++)
201 {
202 is_wfc_ib_iw[is](ib_global, iw) = wfc_iks[iw];
203 }
204 } // ib
205 } // is
206 ofs << ik + 1 << std::endl;
207 for (int iw = 0; iw < PARAM.globalv.nlocal; iw++)
208 {
209 for (int ib = 0; ib < PARAM.inp.nbands; ib++)
210 {
211 for (int is = 0; is < npsin_tmp; is++)
212 {
213 ofs << std::setw(21) << std::fixed << std::setprecision(15) << is_wfc_ib_iw[is](ib, iw).real()
214 << std::setw(21) << std::fixed << std::setprecision(15) << is_wfc_ib_iw[is](ib, iw).imag()
215 << std::endl;
216 }
217 }
218 }
219 ofs.close();
220 } // ik
221 return;
222}
223
224template <typename T, typename Tdata>
226{
227 if (GlobalV::MY_RANK != 0)
228 {
229 return;
230 }
231 ModuleBase::TITLE("DFT_RPA_interface", "out_struc");
232 double TWOPI_Bohr2A = ModuleBase::TWO_PI * ModuleBase::BOHR_TO_A;
233 const int nks_tot = PARAM.inp.nspin == 2 ? (int)p_kv->get_nkstot() / 2 : p_kv->get_nkstot();
234 const int nks_tot_full = p_kv->get_nkstot_full();
235 const int natom = ucell.nat;
237 ModuleBase::Matrix3 G_RPA = ucell.G * TWOPI_Bohr2A;
238 std::stringstream ss;
239 ss << "stru_out";
240 std::ofstream ofs;
241 ofs.open(ss.str().c_str(), std::ios::out);
242 ofs << std::fixed << std::setprecision(9) << lat.e11 << std::setw(15) << lat.e12 << std::setw(15) << lat.e13 << std::endl;
243 ofs << lat.e21 << std::setw(15) << lat.e22 << std::setw(15) << lat.e23 << std::endl;
244 ofs << lat.e31 << std::setw(15) << lat.e32 << std::setw(15) << lat.e33 << std::endl;
245
246 ofs << G_RPA.e11 << std::setw(15) << G_RPA.e12 << std::setw(15) << G_RPA.e13 << std::endl;
247 ofs << G_RPA.e21 << std::setw(15) << G_RPA.e22 << std::setw(15) << G_RPA.e23 << std::endl;
248 ofs << G_RPA.e31 << std::setw(15) << G_RPA.e32 << std::setw(15) << G_RPA.e33 << std::endl;
249
250 ofs << natom << std::endl;
251 for(int iat=0; iat < natom; ++iat) {
252 int it = ucell.iat2it[iat];
253 ModuleBase::Vector3<double> atom_pos = ucell.atoms[ it ].tau[ ucell.iat2ia[iat] ]/ ModuleBase::BOHR_TO_A;
254 ofs << atom_pos.x << std::setw(15) << atom_pos.y << std::setw(15) << atom_pos.z << std::setw(15) << (it + 1) << std::endl;
255 }
256
257 ofs << p_kv->nmp[0] << std::setw(6) << p_kv->nmp[1] << std::setw(6) << p_kv->nmp[2] << std::setw(6) << std::endl;
258
259 for (int ik = 0; ik != nks_tot; ik++)
260 {
261 ofs << std::setw(15) << p_kv->kvec_c[ik].x * TWOPI_Bohr2A << std::setw(15)
262 << p_kv->kvec_c[ik].y * TWOPI_Bohr2A << std::setw(15) << p_kv->kvec_c[ik].z * TWOPI_Bohr2A << std::endl;
263 }
264
265 for (int ik = 0; ik != nks_tot_full; ++ik){
266 ofs << (p_kv->ibz_index[ik] + 1) << std::endl;
267 }
268
269 ofs.close();
270 return;
271}
272
273template <typename T, typename Tdata>
275{
276 ModuleBase::TITLE("DFT_RPA_interface", "out_bands");
277 if (GlobalV::MY_RANK != 0)
278 {
279 return;
280 }
281 const int nks_tot = PARAM.inp.nspin == 2 ? (int)p_kv->get_nks() / 2 : p_kv->get_nks();
282 const int nspin_tmp = PARAM.inp.nspin == 2 ? 2 : 1;
283 std::stringstream ss;
284 ss << "band_out";
285 std::ofstream ofs;
286 ofs.open(ss.str().c_str(), std::ios::out);
287 ofs << nks_tot << std::endl;
288 ofs << PARAM.inp.nspin << std::endl;
289 ofs << PARAM.inp.nbands << std::endl;
290 ofs << PARAM.globalv.nlocal << std::endl;
291 ofs << (pelec->eferm.ef / 2.0) << std::endl;
292
293 for (int ik = 0; ik != nks_tot; ik++)
294 {
295 for (int is = 0; is != nspin_tmp; is++)
296 {
297 ofs << std::setw(6) << ik + 1 << std::setw(6) << is + 1 << std::endl;
298 for (int ib = 0; ib != PARAM.inp.nbands; ib++)
299 {
300 ofs << std::setw(5) << ib + 1 << " " << std::setw(8) << pelec->wg(ik + is * nks_tot, ib) * nks_tot
301 << std::setw(18) << std::fixed << std::setprecision(8) << pelec->ekb(ik + is * nks_tot, ib) / 2.0
302 << std::setw(18) << std::fixed << std::setprecision(8)
303 << pelec->ekb(ik + is * nks_tot, ib) * ModuleBase::Ry_to_eV << std::endl;
304 }
305 }
306 }
307 ofs.close();
308 return;
309}
310
311template <typename T, typename Tdata>
313{
314 std::stringstream ss;
315 ss << "Cs_data_" << GlobalV::MY_RANK << ".txt";
316 std::ofstream ofs;
317 ofs.open(ss.str().c_str(), std::ios::out);
318 ofs << ucell.nat << " " << 0 << std::endl;
319 for (auto& Ip: this->Cs_period)
320 {
321 size_t I = Ip.first;
322 size_t i_num = ucell.atoms[ucell.iat2it[I]].nw;
323 for (auto& JPp: Ip.second)
324 {
325 size_t J = JPp.first.first;
326 auto R = JPp.first.second;
327 auto& tmp_Cs = JPp.second;
328 size_t j_num = ucell.atoms[ucell.iat2it[J]].nw;
329
330 ofs << I + 1 << " " << J + 1 << " " << R[0] << " " << R[1] << " " << R[2] << " " << i_num
331 << std::endl;
332 ofs << j_num << " " << tmp_Cs.shape[0] << std::endl;
333 for (int i = 0; i != i_num; i++)
334 {
335 for (int j = 0; j != j_num; j++)
336 {
337 for (int mu = 0; mu != tmp_Cs.shape[0]; mu++)
338 {
339 ofs << std::setw(15) << std::fixed << std::setprecision(9) << tmp_Cs(mu, i, j) << std::endl;
340 }
341 }
342 }
343 }
344 }
345 ofs.close();
346 return;
347}
348
349template <typename T, typename Tdata>
351{
352 int all_mu = 0;
353 vector<int> mu_shift(ucell.nat);
354 for (int I = 0; I != ucell.nat; I++)
355 {
356 mu_shift[I] = all_mu;
357 all_mu += exx_lri_rpa.exx_objs[Conv_Coulomb_Pot_K::Coulomb_Method::Center2].cv.get_index_abfs_size(ucell.iat2it[I]);
358 }
359 const int nks_tot = PARAM.inp.nspin == 2 ? (int)p_kv->get_nks() / 2 : p_kv->get_nks();
360 std::stringstream ss;
361 ss << "coulomb_mat_" << GlobalV::MY_RANK << ".txt";
362
363 std::ofstream ofs;
364 ofs.open(ss.str().c_str(), std::ios::out);
365
366 ofs << nks_tot << std::endl;
367 for (auto& Ip: this->Vs_period)
368 {
369 auto I = Ip.first;
370 size_t mu_num = exx_lri_rpa.exx_objs[Conv_Coulomb_Pot_K::Coulomb_Method::Center2].cv.get_index_abfs_size(ucell.iat2it[I]);
371
372 for (int ik = 0; ik != nks_tot; ik++)
373 {
374 std::map<size_t, RI::Tensor<std::complex<double>>> Vq_k_IJ;
375 for (auto& JPp: Ip.second)
376 {
377 auto J = JPp.first.first;
378
379 auto R = JPp.first.second;
380 if (J < I)
381 {
382 continue;
383 }
384 RI::Tensor<std::complex<double>> tmp_VR = RI::Global_Func::convert<std::complex<double>>(JPp.second);
385
386 const double arg = 1 * (p_kv->kvec_c[ik] * (RI_Util::array3_to_Vector3(R) * ucell.latvec))
387 * ModuleBase::TWO_PI; // latvec
388 const std::complex<double> kphase = std::complex<double>(cos(arg), sin(arg));
389 if (Vq_k_IJ[J].empty())
390 {
391 Vq_k_IJ[J] = RI::Tensor<std::complex<double>>({tmp_VR.shape[0], tmp_VR.shape[1]});
392 }
393 Vq_k_IJ[J] = Vq_k_IJ[J] + tmp_VR * kphase;
394 }
395 for (auto& vq_Jp: Vq_k_IJ)
396 {
397 auto iJ = vq_Jp.first;
398 auto& vq_J = vq_Jp.second;
399 size_t nu_num = exx_lri_rpa.exx_objs[Conv_Coulomb_Pot_K::Coulomb_Method::Center2].cv.get_index_abfs_size(ucell.iat2it[iJ]);
400 ofs << all_mu << " " << mu_shift[I] + 1 << " " << mu_shift[I] + mu_num << " " << mu_shift[iJ] + 1
401 << " " << mu_shift[iJ] + nu_num << std::endl;
402 ofs << ik + 1 << " " << std::fixed << std::setprecision(12) << p_kv->wk[ik] / 2.0 * PARAM.inp.nspin << std::endl;
403 for (int i = 0; i != vq_J.data->size(); i++)
404 {
405 ofs << std::setw(21) << (*vq_J.data)[i].real()
406 << std::setw(21) << (*vq_J.data)[i].imag() << std::endl;
407 }
408 }
409 }
410 }
411 ofs.close();
412}
413
414// template<typename Tdata>
415// void RPA_LRI<T, Tdata>::init(const MPI_Comm &mpi_comm_in)
416// {
417// if(this->info == this->exx.info)
418// {
419// this->lcaos = this->exx.lcaos;
420// this->abfs = this->exx.abfs;
421// this->abfs_ccp = this->exx.abfs_ccp;
422
423// exx_lri_rpa.cv = std::move(this->exx.cv);
424// }
425// else
426// {
427// this->lcaos = ...
428// this->abfs = ...
429// this->abfs_ccp = ...
430
431// exx_lri_rpa.cv.set_orbitals(
432// this->lcaos, this->abfs, this->abfs_ccp,
433// this->info.kmesh_times, this->info.ccp_rmesh_times );
434// }
435
436// // for( size_t T=0; T!=this->abfs.size(); ++T )
437// // GlobalC::exx_info.info_ri.abfs_Lmax = std::max(
438// GlobalC::exx_info.info_ri.abfs_Lmax, static_cast<int>(this->abfs[T].size())-1
439// );
440
441// }
442
443// template<typename Tdata>
444// void RPA_LRI<T, Tdata>::cal_rpa_ions()
445// {
446// // this->rpa_lri.set_parallel(this->mpi_comm, atoms_pos, latvec, period);
447
448// if(this->info == this->exx.info)
449// exx_lri_rpa.cv.Vws = std::move(this->exx.cv.Vws);
450
451// const std::array<Tcell,Ndim> period_Vs =
452// LRI_CV_Tools::cal_latvec_range<Tcell>(1+this->info.ccp_rmesh_times); const
453// std::pair<std::vector<TA>,
454// std::vector<std::vector<std::pair<TA,std::array<Tcell,Ndim>>>>> list_As_Vs
455// = RI::Distribute_Equally::distribute_atoms(this->mpi_comm, atoms, period_Vs,
456// 2, false);
457
458// std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>
459// Vs = exx_lri_rpa.cv.cal_Vs(
460// list_As_Vs.first, list_As_Vs.second[0],
461// {{"writable_Vws",true}});
462
463// // Vs[iat0][{iat1,cell1}] 按 (iat0,iat1) 分进程,每个进程有所有 cell1
464// Vqs = FFT(Vs);
465// out_Vs(Vqs);
466
467// if(this->info == this->exx.info)
468// exx_lri_rpa.cv.Cws = std::move(this->exx.cv.Cws);
469
470// const std::array<Tcell,Ndim> period_Cs =
471// LRI_CV_Tools::cal_latvec_range<Tcell>(2); const std::pair<std::vector<TA>,
472// std::vector<std::vector<std::pair<TA,std::array<Tcell,Ndim>>>>> list_As_Cs
473// = RI::Distribute_Equally::distribute_atoms_periods(this->mpi_comm, atoms,
474// period_Cs, 2, false);
475
476// std::pair<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,
477// std::array<std::map<TA,std::map<TAC,RI::Tensor<Tdata>>>,3>> Cs_dCs =
478// exx_lri_rpa.cv.cal_Cs_dCs( list_As_Cs.first, list_As_Cs.second[0],
479// {{"cal_dC",false},
480// {"writable_Cws",true}, {"writable_dCws",true},
481// {"writable_Vws",false},
482// {"writable_dVws",false}}); std::map<TA,std::map<TAC,RI::Tensor<Tdata>>> &Cs
483// = std::get<0>(Cs_dCs);
484
485// out_Cs(Cs);
486
487// // rpa_lri.set_Cs(Cs);
488// }
489
490#endif
Exx_LRI< double > exx_lri_rpa(GlobalC::exx_info.info_ri)
int nw
Definition atom_spec.h:23
std::vector< ModuleBase::Vector3< double > > tau
Definition atom_spec.h:36
Definition klist.h:13
int get_nkstot_full() const
Definition klist.h:78
int get_nks() const
Definition klist.h:68
Definition ORB_read.h:19
Definition Mix_DMk_2D.h:17
std::vector< const std::vector< std::complex< double > > * > get_DMk_k_out() const
Returns the complex density matrix.
Definition Mix_DMk_2D.cpp:66
Mix_DMk_2D & set_mixing(Base_Mixing::Mixing *mixing_in)
Sets the mixing mode.
Definition Mix_DMk_2D.cpp:20
void mix(const std::vector< std::vector< double > > &dm, const bool flag_restart)
Mixes the double density matrix.
Definition Mix_DMk_2D.cpp:44
std::vector< const std::vector< double > * > get_DMk_gamma_out() const
Returns the double density matrix.
Definition Mix_DMk_2D.cpp:59
Mix_DMk_2D & set_nks(const int nks, const bool gamma_only_in)
Sets the number of k-points and gamma_only flag.
Definition Mix_DMk_2D.cpp:9
3x3 matrix and related mathamatical operations
Definition matrix3.h:19
double e13
Definition matrix3.h:26
double e31
Definition matrix3.h:26
double e11
element e_ij: i_row, j_column
Definition matrix3.h:26
double e33
Definition matrix3.h:26
double e32
Definition matrix3.h:26
double e21
Definition matrix3.h:26
double e12
Definition matrix3.h:26
double e23
Definition matrix3.h:26
double e22
Definition matrix3.h:26
3 elements vector
Definition vector3.h:22
T x
Definition vector3.h:24
T y
Definition vector3.h:25
T z
Definition vector3.h:26
static void tick(const std::string &class_name_in, const std::string &name_in)
Use twice at a time: the first time, set start_flag to false; the second time, calculate the time dur...
Definition timer.cpp:57
Definition symmetry_rotation.h:16
void set_abfs_Lmax(const int l)
Definition symmetry_rotation.h:44
std::vector< std::vector< std::complex< double > > > restore_dm(const K_Vectors &kv, const std::vector< std::vector< std::complex< double > > > &dm_k_ibz, const Parallel_2D &pv) const
Definition symmetry_rotation.cpp:80
void cal_Ms(const K_Vectors &kv, const UnitCell &ucell, const Parallel_2D &pv)
functions to contruct rotation matrix in AO-representation
Definition symmetry_rotation.cpp:21
void find_irreducible_sector(const Symmetry &symm, const Atom *atoms, const Statistics &st, const std::vector< TC > &Rs, const TC &period, const Lattice &lat)
Definition symmetry_rotation.h:39
static int symm_flag
Definition symmetry.h:30
int local2global_row(const int ilr) const
get the global index of a local index (row)
Definition parallel_2d.h:57
int global2local_col(const int igc) const
get the local index of a global index (col)
Definition parallel_2d.h:51
Definition parallel_orbitals.h:9
const Input_para & inp
Definition parameter.h:26
const System_para & globalv
Definition parameter.h:30
void cal_postSCF_exx(const elecstate::DensityMatrix< T, Tdata > &dm, const MPI_Comm &mpi_comm_in, const UnitCell &ucell, const K_Vectors &kv, const LCAO_Orbitals &orb)
Definition RPA_LRI.hpp:76
void out_coulomb_k(const UnitCell &ucell)
Definition RPA_LRI.hpp:350
void out_Cs(const UnitCell &ucell)
Definition RPA_LRI.hpp:312
void out_bands(const elecstate::ElecState *pelec)
Definition RPA_LRI.hpp:274
void out_struc(const UnitCell &ucell)
Definition RPA_LRI.hpp:225
void out_for_RPA(const UnitCell &ucell, const Parallel_Orbitals &parav, const psi::Psi< T > &psi, const elecstate::ElecState *pelec)
Definition RPA_LRI.hpp:133
void cal_rpa_cv(const UnitCell &ucell)
Definition RPA_LRI.hpp:33
void out_eigen_vector(const Parallel_Orbitals &parav, const psi::Psi< T > &psi)
Definition RPA_LRI.hpp:159
void init(const MPI_Comm &mpi_comm_in, const K_Vectors &kv_in, const std::vector< double > &orb_cutoff)
Definition RPA_LRI.hpp:18
Definition unitcell.h:16
int *& iat2it
Definition unitcell.h:47
Atom * atoms
Definition unitcell.h:18
ModuleBase::Matrix3 & latvec
Definition unitcell.h:35
Lattice lat
Definition unitcell.h:25
int lmax
Definition unitcell.h:185
ModuleSymmetry::Symmetry symm
Definition unitcell.h:55
int & nat
Definition unitcell.h:46
int *& iat2ia
Definition unitcell.h:48
Statistics st
Definition unitcell.h:44
ModuleBase::Matrix3 & G
Definition unitcell.h:39
Definition density_matrix.h:36
const std::vector< std::vector< TK > > & get_DMK_vector() const
get pointer vector of DMK
Definition density_matrix.h:161
const Parallel_Orbitals * get_paraV_pointer() const
get pointer of paraV
Definition density_matrix.h:173
Definition elecstate.h:15
fenergy f_en
energies contribute to the total free energy
Definition elecstate.h:157
ModuleBase::matrix wg
occupation weight for each k-point and band
Definition elecstate.h:167
efermi eferm
fermi energies
Definition elecstate.h:158
ModuleBase::matrix ekb
band energy at each k point, each band.
Definition elecstate.h:166
Definition psi.h:37
Exx_Info exx_info
Definition test_xc.cpp:29
int MY_RANK
global index of process
Definition global_variable.cpp:21
const double TWO_PI
Definition constants.h:21
const double BOHR_TO_A
Definition constants.h:55
const double Ry_to_eV
Definition constants.h:81
void TITLE(const std::string &class_name, const std::string &function_name, const bool disable)
Definition tool_title.cpp:18
void print_symrot_info_k(const ModuleSymmetry::Symmetry_rotation &symrot, const K_Vectors &kv, const UnitCell &ucell)
Definition symmetry_rotation_output.cpp:54
void print_symrot_info_R(const Symmetry_rotation &symrot, const Symmetry &symm, const int lmax_ao, const std::vector< TC > &Rs)
Definition symmetry_rotation_output.cpp:14
std::array< int, 3 > get_Born_vonKarmen_period(const K_Vectors &kv)
Definition RI_Util.hpp:16
std::vector< std::array< Tcell, Ndim > > get_Born_von_Karmen_cells(const std::array< Tcell, Ndim > &Born_von_Karman_period)
Definition RI_Util.hpp:34
ModuleBase::Vector3< Tcell > array3_to_Vector3(const std::array< Tcell, 3 > &v)
Definition RI_Util.h:38
Definition exx_lip.h:23
Parameter PARAM
Definition parameter.cpp:3
std::map< Conv_Coulomb_Pot_K::Coulomb_Type, std::vector< std::map< std::string, std::string > > > coulomb_param
Definition exx_info.h:17
double hybrid_alpha
Definition exx_info.h:31
Conv_Coulomb_Pot_K::Ccp_Type ccp_type
Definition exx_info.h:30
double ccp_rmesh_times
Definition exx_info.h:67
Exx_Info_Global info_global
Definition exx_info.h:38
Exx_Info_RI info_ri
Definition exx_info.h:78
bool exx_symmetry_realspace
whether to reduce the real-space sector in when using symmetry=1 in EXX calculation
Definition input_parameter.h:548
double rpa_ccp_rmesh_times
Definition input_parameter.h:549
int nspin
LDA ; LSDA ; non-linear spin.
Definition input_parameter.h:84
bool out_ri_cv
Whether to output the coefficient tensor C and ABFs-representation Coulomb matrix V.
Definition input_parameter.h:551
int nbands
number of bands
Definition input_parameter.h:75
int nlocal
total number of local basis.
Definition system_parameter.h:23
bool gamma_only_local
Definition system_parameter.h:38
double ef
Fermi energy.
Definition fp_energy.h:64
double etot
the total free energy
Definition fp_energy.h:18
double etxc
E_xc[n(r)] exchange and correlation energy.
Definition fp_energy.h:24
const std::map< std::string, std::vector< double > > zero
Definition vdwd3_autoset_xcparam.cpp:323