From 56a9a13b63dafe6d3040f64522b2774f599133a2 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 3 Aug 2023 10:05:25 +0000 Subject: [PATCH 1/3] Fix: bx = 0 if nx is set mannualy in INPUT --- source/module_io/input.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index 0331473c74f..0f61e3beefc 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -2712,17 +2712,9 @@ void Input::Default_2(void) // jiyy add 2019-08-04 ModuleBase::GlobalFunc::AUTO_SET("lcao_ecut", ecutwfc); } - // if calculation is get_wf, function source/module_basis/module_pw/pw_basis_k_big.h/distribute_r() - // will calculate nbx/nby/nbz by divide nx/ny/nz by bx/by/bz, so bx/by/bz should not be 0 - if (calculation == "get_wf") - { - if (!bx) - bx = 1; - if (!by) - by = 1; - if (!bz) - bz = 1; - } + if (!bx) bx = 1; + if (!by) by = 1; + if (!bz) bz = 1; } if (basis_type == "pw" || basis_type == "lcao_in_pw") From 8abb4e51f5fbf6d2e3020c73e0c8cdc110bf593e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 3 Aug 2023 10:12:27 +0000 Subject: [PATCH 2/3] add a line of comment --- source/module_io/input.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index 0f61e3beefc..cbebc129efd 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -2712,6 +2712,7 @@ void Input::Default_2(void) // jiyy add 2019-08-04 ModuleBase::GlobalFunc::AUTO_SET("lcao_ecut", ecutwfc); } + // set bx, by, bz if (!bx) bx = 1; if (!by) by = 1; if (!bz) bz = 1; From 150aa3bb924c62e4ecc9db740b15735b20f95bcb Mon Sep 17 00:00:00 2001 From: root Date: Thu, 3 Aug 2023 10:24:06 +0000 Subject: [PATCH 3/3] add autoset bx/by/bz when set nx/ny/nz manually --- source/module_basis/module_pw/pw_basis_big.h | 30 ++++++++++++++++++++ source/module_io/input.cpp | 15 +++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/source/module_basis/module_pw/pw_basis_big.h b/source/module_basis/module_pw/pw_basis_big.h index 8716ddbdb32..51d0158ccab 100644 --- a/source/module_basis/module_pw/pw_basis_big.h +++ b/source/module_basis/module_pw/pw_basis_big.h @@ -283,6 +283,36 @@ class PW_Basis_Big: public PW_Basis this->nx = nx_in; this->ny = ny_in; this->nz = nz_in; + // autoset bx/by/bz if not set in INPUT + if (!this->bz) + { + this->autoset_big_cell_size(this->bz, nz, this->poolnproc); + } + if (!this->bx) + { + // if cz == cx, autoset bx==bz for keeping same symmetry + if (nx == nz) + { + this->bx = this->bz; + } + else + { + this->autoset_big_cell_size(this->bx, nx); + } + } + if (!this->by) + { + // if cz == cy, autoset by==bz for keeping same symmetry + if (ny == nz) + { + this->by = this->bz; + } + else + { + this->autoset_big_cell_size(this->by, ny); + } + } + this->bxyz = this->bx * this->by * this->bz; if(this->nx%this->bx != 0) this->nx += (this->bx - this->nx % this->bx); if(this->ny%this->by != 0) this->ny += (this->by - this->ny % this->by); if(this->nz%this->bz != 0) this->nz += (this->bz - this->nz % this->bz); diff --git a/source/module_io/input.cpp b/source/module_io/input.cpp index cbebc129efd..0331473c74f 100644 --- a/source/module_io/input.cpp +++ b/source/module_io/input.cpp @@ -2712,10 +2712,17 @@ void Input::Default_2(void) // jiyy add 2019-08-04 ModuleBase::GlobalFunc::AUTO_SET("lcao_ecut", ecutwfc); } - // set bx, by, bz - if (!bx) bx = 1; - if (!by) by = 1; - if (!bz) bz = 1; + // if calculation is get_wf, function source/module_basis/module_pw/pw_basis_k_big.h/distribute_r() + // will calculate nbx/nby/nbz by divide nx/ny/nz by bx/by/bz, so bx/by/bz should not be 0 + if (calculation == "get_wf") + { + if (!bx) + bx = 1; + if (!by) + by = 1; + if (!bz) + bz = 1; + } } if (basis_type == "pw" || basis_type == "lcao_in_pw")