Skip to content

Commit 9286a44

Browse files
committed
fix a bug
1 parent 4799d5f commit 9286a44

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

source/module_hamilt_lcao/module_deepks/deepks_force.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void DeePKS_domain::cal_f_delta(const std::vector<std::vector<TK>>& dm,
3333

3434
#pragma omp parallel
3535
{
36-
ModuleBase::matrix svnl_dalpha_local(svnl_dalpha.nr, svnl_dalpha.nc);
3736
ModuleBase::matrix f_delta_local(f_delta.nr, f_delta.nc);
37+
ModuleBase::matrix svnl_dalpha_local(svnl_dalpha.nr, svnl_dalpha.nc);
3838
#pragma omp for schedule(dynamic)
3939
for (int iat = 0; iat < ucell.nat; iat++)
4040
{
@@ -299,13 +299,16 @@ void DeePKS_domain::cal_f_delta(const std::vector<std::vector<TK>>& dm,
299299
} // ad2
300300
} // ad1
301301
} // iat
302-
for (int ipol = 0; ipol < 3; ipol++)
302+
if(isstress)
303303
{
304-
for (int jpol = ipol; jpol < 3; jpol++)
304+
for (int ipol = 0; ipol < 3; ipol++)
305305
{
306-
#pragma omp atomic
307-
svnl_dalpha(ipol, jpol)
308-
+= svnl_dalpha_local(ipol, jpol);
306+
for (int jpol = ipol; jpol < 3; jpol++)
307+
{
308+
#pragma omp atomic
309+
svnl_dalpha(ipol, jpol)
310+
+= svnl_dalpha_local(ipol, jpol);
311+
}
309312
}
310313
}
311314
for (int iat = 0; iat < ucell.nat; iat++)

0 commit comments

Comments
 (0)