Skip to content

Commit 435a7b6

Browse files
committed
change ucell in module_io/to_wannier90_pw.cpp
1 parent 1b7aae8 commit 435a7b6

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep)
583583
PARAM.inp.out_wannier_wvfn_formatted,
584584
PARAM.inp.nnkpfile,
585585
PARAM.inp.wannier_spin);
586-
586+
wan.set_tpiba_omega(ucell.tpiba, ucell.omega);
587587
wan.calculate(this->pelec->ekb, this->pw_wfc, this->pw_big, this->kv, this->psi);
588588
std::cout << FmtCore::format(" >> Finish %s.\n * * * * * *\n", "Wannier functions calculation");
589589
}

source/module_io/to_wannier90_pw.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ void toWannier90_PW::calculate(
7373
out_unk(*psi, wfcpw, bigpw);
7474
}
7575

76+
}
77+
void toWannier90_PW::set_tpiba_omega(const double& tpiba, const double& omega)
78+
{
79+
this->tpiba = &tpiba;
80+
this->omega = &omega;
81+
7682
}
7783

7884
void toWannier90_PW::cal_Mmn(
@@ -946,9 +952,10 @@ void toWannier90_PW::get_trial_orbitals_lm_k(
946952
std::complex<double> *orbital_in_G_single
947953
)
948954
{
955+
const double tpiba = *this->tpiba;
949956
for (int ig = 0; ig < npw; ig++)
950957
{
951-
orbital_in_G_single[ig] = ModuleBase::PolyInt::Polynomial_Interpolation(radial_in_q_single, PARAM.globalv.nqx, PARAM.globalv.dq, gk[ig].norm() * GlobalC::ucell.tpiba);
958+
orbital_in_G_single[ig] = ModuleBase::PolyInt::Polynomial_Interpolation(radial_in_q_single, PARAM.globalv.nqx, PARAM.globalv.dq, gk[ig].norm() * tpiba);
952959
}
953960

954961
std::complex<double> lphase = pow(ModuleBase::NEG_IMAG_UNIT, orbital_L);
@@ -970,7 +977,7 @@ void toWannier90_PW::integral(
970977
double *table
971978
)
972979
{
973-
const double pref = ModuleBase::FOUR_PI / sqrt(GlobalC::ucell.omega);
980+
const double pref = ModuleBase::FOUR_PI / sqrt(*this->omega);
974981

975982
double *inner_part = new double[meshr];
976983
for (int ir = 0; ir < meshr; ir++)

source/module_io/to_wannier90_pw.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ class toWannier90_PW : public toWannier90
5959
const ModulePW::PW_Basis_K* wfcpw,
6060
const ModulePW::PW_Basis_Big* bigpw
6161
);
62-
62+
void set_tpiba_omega(const double& tpiba, const double& omega);
6363
protected:
6464
// Radial section of trial orbitals
6565
const int mesh_r = 333;
6666
const double dx = 0.025;
6767
const double x_min = -6.0;
68+
double const *tpiba;
69+
double const *omega;
6870

6971
void unkdotkb(
7072
const psi::Psi<std::complex<double>>& psi_pw,

0 commit comments

Comments
 (0)