Skip to content

Commit

Permalink
fix: modify velocity operator and case 101_PW_15_lowz (#1477)
Browse files Browse the repository at this point in the history
* fix: modify velocity operator

* fix: mpi cores can be larger than z-fft grids
fix case 101_PW_15_lowz's failing
change case 101_PW_15_lowz. It has larger total energy and will not be ignored by Autotest.sh
  • Loading branch information
Qianruipku committed Nov 7, 2022
1 parent 5a9b47a commit 548f8b9
Show file tree
Hide file tree
Showing 10 changed files with 2,016 additions and 2,011 deletions.
1 change: 1 addition & 0 deletions source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ OBJS_HAMILT=hamilt_pw.o\
nonlocal.o\
ekinetic_pw.o\
veff_pw.o\
veff.o\
nonlocal_pw.o\
meta_pw.o\
velocity_pw.o\
Expand Down
3 changes: 2 additions & 1 deletion source/module_hamilt/ks_pw/veff_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ Veff<OperatorPW<FPTYPE, Device>>::Veff(
// this->veff = veff_in;
// TODO: add an GPU veff array
this->veff = veff_in[0].c;
//note: "veff = nullptr" means that this core does not treat potential but still treats wf.
this->veff_col = veff_in[0].nc;
this->wfcpw = wfcpw_in;
resize_memory_op()(this->ctx, this->porter, this->wfcpw->nmaxgr);
if (this->npol != 1) {
resize_memory_op()(this->ctx, this->porter1, this->wfcpw->nmaxgr);
}
if (this->isk == nullptr || this->veff == nullptr || this->wfcpw == nullptr) {
if (this->isk == nullptr || this->wfcpw == nullptr) {
ModuleBase::WARNING_QUIT("VeffPW", "Constuctor of Operator::VeffPW is failed, please check your code!");
}
}
Expand Down
Binary file removed source/src_pw/ABACUS-PW.x
Binary file not shown.
7 changes: 5 additions & 2 deletions source/src_pw/VNL_grad_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ void pseudopot_cell_vnl::getgradq_vnl(const int ik)
if(ggnorm < 1e-8)
tmpgradvkb(id, ih, ig) = 0.0;
else
tmpgradvkb(id, ih, ig) = ylm(lm, ig) * dvq [ig] * gg[id] / ggnorm + dylm[id](lm, ig) * vq [ig];

tmpgradvkb(id, ih, ig) = ylm(lm, ig) * dvq [ig] * gg[id] / ggnorm
+ dylm[id](lm, ig)/GlobalC::wfcpw->tpiba * vq [ig];//note: dylm/d(tpiba * gx) = 1/tpiba * dylm/dgx
tmpvkb(ih, ig) = ylm(lm,ig) * vq[ig];
}
}
Expand All @@ -143,8 +145,9 @@ void pseudopot_cell_vnl::getgradq_vnl(const int ik)
for (int ig = 0;ig < npw;++ig)
{
std::complex<double> skig = sk[ig];
std::complex<double> dskig = ModuleBase::NEG_IMAG_UNIT * (GlobalC::ucell.atoms[it].tau[ia][id] * GlobalC::wfcpw->lat0) * skig;
pvkb[ig] = tmpvkb(ih, ig) * skig * pref;
pgvkb[ig] = tmpgradvkb(id, ih, ig) * skig * pref;
pgvkb[ig] = tmpgradvkb(id, ih, ig) * skig * pref + tmpvkb(ih, ig) * dskig * pref;;
}
} //end id
++jkb;
Expand Down
6 changes: 3 additions & 3 deletions tests/integrate/101_PW_15_lowz/INPUT
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ INPUT_PARAMETERS
suffix autotest
calculation scf
ntype 1
nbands 6
nbands 10
symmetry 1
pseudo_dir ../../PP_ORB
dft_functional scan
Expand All @@ -18,8 +18,8 @@ scf_nmax 2
basis_type pw

#Parameters (4.Smearing)
smearing_method gauss
smearing_sigma 0.002
smearing_method fd
smearing_sigma 0.1

#Parameters (5.Mixing)
mixing_type pulay
Expand Down
6 changes: 3 additions & 3 deletions tests/integrate/101_PW_15_lowz/result.ref
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
etotref -0.03063241935806423
etotperatomref -0.0153162097
totaltimeref
etotref -1.951262029865761
etotperatomref -0.9756310149
totaltimeref 0.27188
2,000 changes: 1,000 additions & 1,000 deletions tests/integrate/186_PW_NLKG_100/refOnsager.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/integrate/186_PW_NLKG_100/result.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
etotref -150.4802166062103
etotperatomref -150.4802166062
CompareH_Failed 0
totaltimeref 0.62690
totaltimeref 0.64951
2,000 changes: 1,000 additions & 1,000 deletions tests/integrate/186_PW_SNLKG_10D10S/refOnsager.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/integrate/186_PW_SNLKG_10D10S/result.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
etotref 0
etotperatomref 0.0000000000
CompareH_Failed 0
totaltimeref 2.3285
totaltimeref 2.4277

0 comments on commit 548f8b9

Please sign in to comment.