Skip to content

Commit

Permalink
Fix: fix a bug introduced by PR#4541 (#4593)
Browse files Browse the repository at this point in the history
* fix a bug

* add a testing case

* [pre-commit.ci lite] apply automatic fixes

* reconstruct the test case

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
dzzz2001 and pre-commit-ci-lite[bot] authored Jul 7, 2024
1 parent 4d52af1 commit ebcf889
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/module_hamilt_lcao/module_gint/grid_technique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Grid_Technique::set_pbc_grid(
this->ucell = &ucell;
this->dr_uniform = dr_uniform;

this->nwmax = 0;
this->nwmax = ucell.nwmax;
this->ntype = ucell.ntype;

this->rcuts = rcuts;
Expand Down Expand Up @@ -263,14 +263,14 @@ void Grid_Technique::init_atoms_on_grid(const int& ny,
if (this->in_this_processor[iat])
{
++nat_local;
this->nwmax = std::max(this->nwmax, ucell.atoms[it].nw);
}
}

if (GlobalV::test_gridt)
if (GlobalV::test_gridt) {
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running,
"Total_atoms_on_grid",
total_atoms_on_grid);
}

int stop = 0;
if (total_atoms_on_grid == 0) {
Expand Down Expand Up @@ -514,8 +514,9 @@ void Grid_Technique::cal_trace_lo(const UnitCell& ucell) {
} else {
// global index of atomic orbitals
iw_all += ucell.atoms[it].nw;
if (GlobalV::NSPIN == 4)
if (GlobalV::NSPIN == 4) {
iw_all += ucell.atoms[it].nw;
}
}
++iat;
}
Expand Down
12 changes: 12 additions & 0 deletions tests/integrate/922_NO_FeBiTe/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
INPUT_PARAMETERS
suffix autotest
calculation scf
ks_solver genelpa
gamma_only 1
cal_stress 1
cal_force 1
stru_file STRU
basis_type lcao
dft_functional pbe
ecutwfc 10
scf_nmax 10
4 changes: 4 additions & 0 deletions tests/integrate/922_NO_FeBiTe/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
1 1 1 0 0 0
43 changes: 43 additions & 0 deletions tests/integrate/922_NO_FeBiTe/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ATOMIC_SPECIES
Fe 55.845 ../../PP_ORB/Fe_ONCV_PBE-1.0.upf
Bi 208.9804 ../../PP_ORB/Bi_ONCV_PBE-1.0.upf
Te 127.6 ../../PP_ORB/Te_ONCV_PBE-1.0.upf

NUMERICAL_ORBITAL
../../PP_ORB/Fe_gga_6au_100Ry_4s2p2d1f.orb
../../PP_ORB/Bi_gga_9au_100Ry_2s2p2d.orb
../../PP_ORB/Te_dojo_6au.orb

LATTICE_CONSTANT
1.8897261258369282

LATTICE_VECTORS
11.813251000 0.0000000000 0.0000000000
-5.906625000 9.7392690000 0.0000000000
0.0000000000 0.0000000000 58.248389000

ATOMIC_POSITIONS
Direct

Fe
0.0000000000
1
0.0000000000 0.0000000000 0.0000000000 1 1 1 mag 0.0

Bi
0.0000000000
3
0.0000000000 0.0000000000 0.5000000000 1 1 1 mag 0.0
0.5000000000 0.5000000000 0.0000000000 1 1 1 mag 0.0
0.0000000000 0.5000000000 0.0000000000 1 1 1 mag 0.0

Te
0.0000000000
6
0.0000000000 0.0000000000 0.7689960000 1 1 1 mag 0.0
0.0000000000 0.0000000000 0.2310040000 1 1 1 mag 0.0
0.7525440000 0.7523400000 0.0000000000 1 1 1 mag 0.0
0.2474560000 0.2476600000 0.0000000000 1 1 1 mag 0.0
0.0002040000 0.2476600000 0.0000000000 1 1 1 mag 0.0
0.9997960000 0.7523400000 0.0000000000 1 1 1 mag 0.0

5 changes: 5 additions & 0 deletions tests/integrate/922_NO_FeBiTe/result.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
etotref -22413.2663586479247897
etotperatomref -2241.3266358648
totalforceref 25.164814
totalstressref 88.320445
totaltimeref 2.06
1 change: 1 addition & 0 deletions tests/integrate/CASES_CPU.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,4 @@
920_OF_MD_LDA
920_OF_MD_LibxcPBE
921_OF_CR_LDA
922_NO_FeBiTe

0 comments on commit ebcf889

Please sign in to comment.