Skip to content

Commit

Permalink
XC: Fix undefined array access (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
fstein93 committed Jan 10, 2021
1 parent 195e2a7 commit dc262fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/xc/xc_perdew_wang.F
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ SUBROUTINE perdew_wang_lda_calc(rho, e_0, e_rho, e_rho_rho, e_rho_rho_rho, npoin
!! order_ is positive as it must be in this case:
!! ec(:,2) needs ed(:,1) for example
CALL pw_lda_ed_loc(rho(k), ed, abs_order)
ed = scale*ed
ed(0:abs_order) = scale*ed(0:abs_order)

IF (order >= 0) THEN
e_0(k) = e_0(k) + rho(k)*ed(0)
Expand Down Expand Up @@ -395,8 +395,10 @@ SUBROUTINE perdew_wang_lsd_calc(rhoa, rhob, e_0, ea, eb, eaa, eab, ebb, eaaa, ea
rho = rhoa(k) + rhob(k)
IF (rho > eps_rho) THEN
ed = 0.0_dp
CALL pw_lsd_ed_loc(rhoa(k), rhob(k), ed, abs_order)
ed = ed*scale
IF (order >= 0) THEN
e_0(k) = e_0(k) + rho*ed(0)
END IF
Expand Down

0 comments on commit dc262fe

Please sign in to comment.