Repository navigation
Expand file tree
/
Copy pathpot_local.cpp
More file actions
48 lines (36 loc) · 1.38 KB
/
Copy pathpot_local.cpp
File metadata and controls
48 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "pot_local.h"
#include "source_base/timer.h"
#include "source_base/tool_title.h"
#include <complex>
namespace elecstate
{
//==========================================================
// This routine computes the local potential in real space
//==========================================================
void PotLocal::cal_fixed_v(double *vl_pseudo) // store the local pseudopotential
{
ModuleBase::TITLE("PotLocal", "cal_fixed_v");
ModuleBase::timer::tick("PotLocal", "cal_fixed_v");
std::complex<double> *vg = new std::complex<double>[this->rho_basis_->npw];
ModuleBase::GlobalFunc::ZEROS(vg, this->rho_basis_->npw);
for (int it = 0; it < this->ntype_; it++)
{
for (int ig = 0; ig < this->rho_basis_->npw; ig++)
{
vg[ig] += this->vloc_[0](it, this->rho_basis_->ig2igg[ig]) * this->sf_[0](it, ig);
}
}
/// save the V_local at G=0
if(this->rho_basis_->npw > 0)
{
*vl_of_0_ = vg[0].real();
}
// recip2real should be a const function, but now it isn't
// a dangerous usage appears here, which should be fix in the future.
const_cast<ModulePW::PW_Basis *>(this->rho_basis_)->recip2real(vg, vl_pseudo);
delete[] vg;
// GlobalV::ofs_running <<" set local pseudopotential done." << std::endl;
ModuleBase::timer::tick("PotLocal", "cal_fixed_v");
return;
}
} // namespace elecstate