Skip to content

Commit 6d0650b

Browse files
committed
change ucell in the charge
1 parent 7fab21a commit 6d0650b

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

source/module_elecstate/magnetism.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ void Magnetism::compute_magnetization(const double& omega,
6969
Parallel_Reduce::reduce_pool(this->tot_magnetization_nc, 3);
7070
Parallel_Reduce::reduce_pool(this->abs_magnetization);
7171
#endif
72-
for(int i=0;i<3;i++)this->tot_magnetization_nc[i] *= elecstate::get_ucell_omega() / nxyz;
73-
this->abs_magnetization *= elecstate::get_ucell_omega() / nxyz;
72+
for(int i=0;i<3;i++)this->tot_magnetization_nc[i] *= omega/ nxyz;
73+
this->abs_magnetization *= omega/ nxyz;
7474
GlobalV::ofs_running<<"total magnetism (Bohr mag/cell)"<<'\t'<<this->tot_magnetization_nc[0]<<'\t'<<this->tot_magnetization_nc[1]<<'\t'<<this->tot_magnetization_nc[2]<<'\n';
7575
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,"absolute magnetism (Bohr mag/cell)",this->abs_magnetization);
7676
}

source/module_elecstate/module_charge/charge.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ double Charge::sum_rho() const
218218
}
219219

220220
// multiply the sum of charge density by a factor
221-
sum_rho *= elecstate::get_ucell_omega() / static_cast<double>(this->rhopw->nxyz);
221+
sum_rho *= *this->omega / static_cast<double>(this->rhopw->nxyz);
222222

223223
#ifdef __MPI
224224
Parallel_Reduce::reduce_pool(sum_rho);
@@ -722,7 +722,7 @@ double Charge::cal_rho2ne(const double* rho_in) const
722722
#ifdef __MPI
723723
Parallel_Reduce::reduce_pool(ne);
724724
#endif
725-
ne = ne * elecstate::get_ucell_omega() / (double)this->rhopw->nxyz;
725+
ne = ne * *this->omega / (double)this->rhopw->nxyz;
726726

727727
return ne;
728728
}

source/module_elecstate/module_charge/charge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class Charge
149149

150150
void destroy(); // free arrays liuyu 2023-03-12
151151

152+
double* omega = nullptr; // omega for non-linear core correction
152153
bool allocate_rho;
153154

154155
bool allocate_rho_final_scf; // LiuXh add 20180606

source/module_elecstate/module_charge/charge_init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
2929
const void* wfcpw)
3030
{
3131
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "init_chg", PARAM.inp.init_chg);
32-
32+
this->omega = &ucell.omega;
3333
std::cout << " START CHARGE : " << PARAM.inp.init_chg << std::endl;
3434
bool read_error = false;
3535
if (PARAM.inp.init_chg == "file" || PARAM.inp.init_chg == "auto")

source/module_esolver/esolver_ks.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ void ESolver_KS<T, Device>::iter_finish(UnitCell& ucell, const int istep, int& i
548548
}
549549

550550
// compute magnetization, only for LSDA(spin==2)
551-
ucell.magnet.compute_magnetization(this->pelec->charge->nrxx,
551+
ucell.magnet.compute_magnetization(ucell.omega,
552+
this->pelec->charge->nrxx,
552553
this->pelec->charge->nxyz,
553554
this->pelec->charge->rho,
554-
this->pelec->nelec_spin.data(),
555-
ucell.omega);
555+
this->pelec->nelec_spin.data());
556556

557557
if (GlobalV::MY_STOGROUP == 0)
558558
{

0 commit comments

Comments
 (0)