Skip to content

Commit 59ac548

Browse files
committed
Update functions used in deepks/test.
1 parent e403672 commit 59ac548

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
#include "module_hamilt_general/module_surchem/surchem.h" //sunml add 2022-08-10
1313
#include "module_hamilt_general/module_vdw/vdw.h"
1414
#include "module_parameter/parameter.h"
15-
#ifdef __DEEPKS
1615
#include "module_elecstate/elecstate_lcao.h"
16+
#ifdef __DEEPKS
1717
#include "module_hamilt_lcao/module_deepks/LCAO_deepks.h" //caoyu add for deepks 2021-06-03
1818
#include "module_hamilt_lcao/module_deepks/LCAO_deepks_io.h" // mohan add 2024-07-22
1919
#endif
20-
#include "module_elecstate/elecstate_lcao.h"
2120
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/dftu_lcao.h"
2221
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/dspin_lcao.h"
2322
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/nonlocal_new.h"

source/module_hamilt_lcao/module_deepks/test/LCAO_deepks_test.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ void test_deepks::check_psialpha()
3131
}
3232
ld.init(ORB, ucell.nat, ucell.ntype, ParaO, na);
3333

34+
ld.allocate_psialpha(PARAM.input.cal_force, ucell, ORB, Test_Deepks::GridD);
35+
3436
ld.build_psialpha(PARAM.input.cal_force, ucell, ORB, Test_Deepks::GridD, overlap_orb_alpha_);
3537

3638
ld.check_psialpha(PARAM.input.cal_force, ucell, ORB, Test_Deepks::GridD);
@@ -200,7 +202,7 @@ void test_deepks::check_edelta()
200202
this->ld.load_model("model.ptg");
201203
if (PARAM.sys.gamma_only_local)
202204
{
203-
this->ld.allocate_V_delta(ucell.nat);
205+
this->ld.allocate_V_delta(ucell.nat, 1); // 1 for gamma-only
204206
}
205207
else
206208
{
@@ -239,14 +241,16 @@ void test_deepks::check_f_delta()
239241
{
240242
ModuleBase::matrix svnl_dalpha;
241243
svnl_dalpha.create(3, 3);
244+
const int cal_stress = 1;
242245
if (PARAM.sys.gamma_only_local)
243246
{
244247
const int nks = 1;
245-
ld.cal_f_delta_gamma(dm_new, ucell, ORB, Test_Deepks::GridD, nks, kv.kvec_d, 1, svnl_dalpha);
248+
ld.cal_f_delta(dm_new, ucell, ORB, Test_Deepks::GridD, nks, kv.kvec_d, cal_stress, svnl_dalpha);
246249
}
247250
else
248251
{
249-
ld.cal_f_delta_k(dm_k_new, ucell, ORB, Test_Deepks::GridD, kv.get_nkstot(), kv.kvec_d, 1, svnl_dalpha);
252+
const int nks = kv.get_nkstot();
253+
ld.cal_f_delta(dm_k_new, ucell, ORB, Test_Deepks::GridD, nks, kv.kvec_d, cal_stress, svnl_dalpha);
250254
}
251255
ld.check_f_delta(ucell.nat, svnl_dalpha);
252256

0 commit comments

Comments
 (0)