Skip to content

Commit 846b1d1

Browse files
committed
change ucell in pwdft/VL_grad_pw.cpp
1 parent 9ec397f commit 846b1d1

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

source/module_hamilt_pw/hamilt_pwdft/VNL_grad_pw.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ void pseudopot_cell_vnl::initgradq_vnl(const UnitCell &cell)
5858

5959
}
6060

61-
void pseudopot_cell_vnl::getgradq_vnl(const int ik)
61+
void pseudopot_cell_vnl::getgradq_vnl(const UnitCell& ucell,
62+
const int ik)
6263
{
6364
if(PARAM.inp.test_pp) ModuleBase::TITLE("pseudopot_cell_vnl","getvnl");
6465
ModuleBase::timer::tick("pp_cell_vnl","getvnl");
@@ -91,11 +92,11 @@ void pseudopot_cell_vnl::getgradq_vnl(const int ik)
9192
ModuleBase::YlmReal::grad_Ylm_Real(x1, npw, gk, ylm, dylm[0], dylm[1], dylm[2]);
9293

9394
int jkb = 0;
94-
for(int it = 0;it < GlobalC::ucell.ntype;it++)
95+
for(int it = 0;it < ucell.ntype;it++)
9596
{
9697
// calculate beta in G-space using an interpolation table
97-
const int nbeta = GlobalC::ucell.atoms[it].ncpp.nbeta;
98-
const int nh = GlobalC::ucell.atoms[it].ncpp.nh;
98+
const int nbeta = ucell.atoms[it].ncpp.nbeta;
99+
const int nh = ucell.atoms[it].ncpp.nh;
99100
int nb0 = -1;
100101
for( int ih = 0; ih < nh; ++ih)
101102
{
@@ -104,7 +105,7 @@ void pseudopot_cell_vnl::getgradq_vnl(const int ik)
104105
{
105106
for (int ig = 0;ig < npw;++ig)
106107
{
107-
const double gnorm = gk[ig].norm() * GlobalC::ucell.tpiba;
108+
const double gnorm = gk[ig].norm() * ucell.tpiba;
108109
vq [ig] = ModuleBase::PolyInt::Polynomial_Interpolation(
109110
this->tab, it, nb, PARAM.globalv.nqx, PARAM.globalv.dq, gnorm );
110111
dvq[ig] =ModuleBase::PolyInt::Polynomial_Interpolation(
@@ -146,7 +147,7 @@ void pseudopot_cell_vnl::getgradq_vnl(const int ik)
146147

147148
// vkb1 contains all betas including angular part for type nt
148149
// now add the structure factor and factor (-i)^l
149-
for (int ia=0; ia<GlobalC::ucell.atoms[it].na; ia++)
150+
for (int ia=0; ia<ucell.atoms[it].na; ia++)
150151
{
151152
std::complex<double> *sk = this->psf->get_sk(ik, it, ia, this->wfcpw);
152153

@@ -161,7 +162,7 @@ void pseudopot_cell_vnl::getgradq_vnl(const int ik)
161162
{
162163
std::complex<double> skig = sk[ig];
163164
pvkb[ig] = tmpvkb(ih, ig) * skig * pref;
164-
// std::complex<double> dskig = ModuleBase::NEG_IMAG_UNIT * (GlobalC::ucell.atoms[it].tau[ia][id] * this->wfcpw->lat0) * skig;
165+
// std::complex<double> dskig = ModuleBase::NEG_IMAG_UNIT * (ucell.atoms[it].tau[ia][id] * this->wfcpw->lat0) * skig;
165166
// pgvkb[ig] = tmpgradvkb(id, ih, ig) * skig * pref + tmpvkb(ih, ig) * dskig * pref;
166167
// The second term will be eliminate when doing <psi|beta>Dij<beta|psi> or we can say (\nabla_q+\nabla_q')S(q'-q) = 0
167168
pgvkb[ig] = tmpgradvkb(id, ih, ig) * skig * pref;

source/module_hamilt_pw/hamilt_pwdft/VNL_in_pw.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class pseudopot_cell_vnl : public pseudopot_cell_vl
4848

4949
void initgradq_vnl(const UnitCell& cell);
5050

51-
void getgradq_vnl(const int ik);
51+
void getgradq_vnl(const UnitCell& ucell,
52+
const int ik);
5253

5354
//===============================================================
5455
// MEMBER VARIABLES :

source/module_hamilt_pw/hamilt_pwdft/operator_pw/velocity_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void Velocity::init(const int ik_in)
3232
// Calculate nonlocal pseudopotential vkb
3333
if(this->ppcell->nkb > 0 && this->nonlocal)
3434
{
35-
this->ppcell->getgradq_vnl(ik_in);
35+
this->ppcell->getgradq_vnl(*this->ucell,ik_in);
3636
}
3737

3838
}

0 commit comments

Comments
 (0)