Skip to content

Commit c725001

Browse files
committed
fix bug
1 parent 663aa3b commit c725001

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

source/module_io/read_input.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "module_base/global_function.h"
1414
#include "module_base/tool_quit.h"
1515
#include "module_base/tool_title.h"
16+
#include "module_base/module_device/device.h"
1617
namespace ModuleIO
1718
{
1819

@@ -142,9 +143,15 @@ void ReadInput::read_parameters(Parameter& param, const std::string& filename_in
142143
bcastfunc(param);
143144
}
144145

145-
// 5. set the globalv parameters, some parameters in different processes are different. e.g. rank
146+
// 5. set the globalv parameters, some parameters in different processes are different. e.g. rank
146147
this->set_globalv(param.inp, param.sys);
147148

149+
// 6. check kpar, it must be after bcastfunc and kpar and bndpar are synchronized
150+
if (param.inp.device == "gpu" && param.inp.basis_type == "pw")
151+
{
152+
param.input.kpar = base_device::information::get_device_kpar(param.inp.kpar, param.inp.bndpar);
153+
}
154+
148155
if (this->check_mode)
149156
{
150157
std::cout << "----------------------------------------------------------" << std::endl;

source/module_io/read_input_item_system.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,8 @@ void ReadInput::item_system()
234234
"will be distributed among";
235235
read_sync_int(input.kpar);
236236
item.reset_value = [](const Input_Item& item, Parameter& para) {
237-
if (para.inp.device == "gpu" && para.inp.basis_type == "pw")
238-
{
239-
para.input.kpar = base_device::information::get_device_kpar(para.inp.kpar, para.inp.bndpar);
240-
}
241237
#ifdef __LCAO
242-
else if (para.inp.basis_type == "lcao")
238+
if (para.inp.basis_type == "lcao")
243239
{
244240
para.sys.kpar_lcao = para.inp.kpar;
245241
para.input.kpar = 1;

source/module_io/read_set_globalv.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "module_base/global_variable.h"
2-
#include "module_base/module_device/device.h"
32
#include "module_base/tool_quit.h"
43
#include "module_parameter/parameter.h"
54
#include "read_input.h"
@@ -117,6 +116,8 @@ void ReadInput::set_globalv(const Input_para& inp, System_para& sys)
117116
default:
118117
break;
119118
}
119+
sys.nqx = static_cast<int>((sqrt(inp.ecutwfc) / sys.dq + 4.0) * inp.cell_factor);
120+
sys.nqxq = static_cast<int>((sqrt(inp.ecutrho) / sys.dq + 4.0) * inp.cell_factor);
120121
/// set ncx,ncy,ncz
121122
sys.ncx = inp.nx;
122123
sys.ncy = inp.ny;

0 commit comments

Comments
 (0)