Skip to content

Commit 6e9f01d

Browse files
authored
Merge branch 'develop' into ucell20
2 parents 28ce913 + 7d14803 commit 6e9f01d

File tree

5 files changed

+38
-25
lines changed

5 files changed

+38
-25
lines changed

source/module_cell/update_cell.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -439,31 +439,17 @@ void periodic_boundary_adjustment(Atom* atoms,
439439
Atom* atom = &atoms[it];
440440
for (int ia = 0; ia < atom->na; ia++) {
441441
// mohan update 2011-03-21
442-
if (atom->taud[ia].x < 0)
442+
for (int ik = 0; ik < 3; ik++)
443443
{
444-
atom->taud[ia].x += 1.0;
445-
}
446-
if (atom->taud[ia].y < 0)
447-
{
448-
atom->taud[ia].y += 1.0;
449-
}
450-
if (atom->taud[ia].z < 0)
451-
{
452-
atom->taud[ia].z += 1.0;
453-
}
454-
if (atom->taud[ia].x >= 1.0)
455-
{
456-
atom->taud[ia].x -= 1.0;
457-
}
458-
if (atom->taud[ia].y >= 1.0)
459-
{
460-
atom->taud[ia].y -= 1.0;
461-
}
462-
if (atom->taud[ia].z >= 1.0)
463-
{
464-
atom->taud[ia].z -= 1.0;
444+
if (atom->taud[ia][ik] < 0)
445+
{
446+
atom->taud[ia][ik] += 1.0;
447+
}
448+
if (atom->taud[ia][ik] >= 1.0)
449+
{
450+
atom->taud[ia][ik] -= 1.0;
451+
}
465452
}
466-
467453
if (atom->taud[ia].x < 0
468454
|| atom->taud[ia].y < 0
469455
|| atom->taud[ia].z < 0

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void ESolver_KS_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)
255255

256256
if (ucell.cell_parameter_updated)
257257
{
258-
this->ppcell.init_vnl(ucell, this->pw_rhod);
258+
this->ppcell.rescale_vnl(ucell.omega);
259259
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "NON-LOCAL POTENTIAL");
260260

261261
this->pw_wfc->initgrids(ucell.lat0, ucell.latvec, this->pw_wfc->nx, this->pw_wfc->ny, this->pw_wfc->nz);

source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void LCAO_Deepks_Interface<TK, TR>::out_deepks_labels(const double& etot,
6969

7070
if (PARAM.inp.deepks_bandgap)
7171
{
72-
const int nocc = PARAM.inp.nelec / 2;
72+
const int nocc = (PARAM.inp.nelec+1) / 2;
7373
std::vector<double> o_tot(nks);
7474
for (int iks = 0; iks < nks; ++iks)
7575
{

source/module_hamilt_pw/hamilt_pwdft/VNL_in_pw.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ void pseudopot_cell_vnl::init_vnl(UnitCell& cell, const ModulePW::PW_Basis* rho_
550550
ModuleBase::TITLE("pseudopot_cell_vnl", "init_vnl");
551551
ModuleBase::timer::tick("ppcell_vnl", "init_vnl");
552552

553+
this->omega_old = cell.omega;
554+
553555
// from init_us_1
554556
// a) For each non vanderbilt pseudopotential it computes the D and
555557
// the betar in the same form of the Vanderbilt pseudopotential.
@@ -1733,6 +1735,27 @@ void pseudopot_cell_vnl::newd_nc(const int& iat, UnitCell& cell)
17331735
}
17341736
}
17351737

1738+
// scale the non-local pseudopotential tables
1739+
void pseudopot_cell_vnl::rescale_vnl(const double& omega_in)
1740+
{
1741+
const double ratio = this->omega_old / omega_in;
1742+
const double sqrt_ratio = std::sqrt(ratio);
1743+
this->omega_old = omega_in;
1744+
1745+
for (int i = 0; i < this->tab.getSize(); i++)
1746+
{
1747+
this->tab.ptr[i] *= sqrt_ratio;
1748+
}
1749+
for (int i = 0; i < this->tab_at.getSize(); i++)
1750+
{
1751+
this->tab_at.ptr[i] *= sqrt_ratio;
1752+
}
1753+
for (int i = 0; i < this->qrad.getSize(); i++)
1754+
{
1755+
this->qrad.ptr[i] *= ratio;
1756+
}
1757+
}
1758+
17361759
template <>
17371760
float* pseudopot_cell_vnl::get_nhtol_data() const
17381761
{

source/module_hamilt_pw/hamilt_pwdft/VNL_in_pw.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class pseudopot_cell_vnl
3636

3737
void init_vnl(UnitCell& cell, const ModulePW::PW_Basis* rho_basis);
3838

39+
void rescale_vnl(const double& omega_in);
40+
3941
template <typename FPTYPE, typename Device>
4042
void getvnl(Device* ctx, const UnitCell& ucell, const int& ik, std::complex<FPTYPE>* vkb_in) const;
4143

@@ -200,6 +202,8 @@ class pseudopot_cell_vnl
200202

201203
Soc soc;
202204

205+
double omega_old = 0;
206+
203207
/**
204208
* @brief Compute interpolation table qrad
205209
*

0 commit comments

Comments
 (0)