Skip to content

Commit

Permalink
XAS: Fix instability in MO occupation on i386
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jan 31, 2021
1 parent 7930cd5 commit 5a03381
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/qs_mo_occupation.F
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ SUBROUTINE set_mo_occupation_1(mo_set, smear, eval_deriv, xas_env, tot_zeff_corr
occ_estate = 0.0_dp
IF (PRESENT(xas_env)) THEN
CALL get_xas_env(xas_env=xas_env, xas_nelectron=xas_nelectron, occ_estate=occ_estate, xas_estate=xas_estate)
nomo = INT(xas_nelectron + 1 - occ_estate)
IF (MOD(xas_nelectron + 1 - occ_estate, 1.0_dp) > EPSILON(0.0_dp)) nomo = nomo + 1
nomo = CEILING(xas_nelectron + 1.0 - occ_estate - EPSILON(0.0_dp))

mo_set%occupation_numbers(1:nomo) = mo_set%maxocc
IF (xas_estate > 0) mo_set%occupation_numbers(xas_estate) = occ_estate
el_count = SUM(mo_set%occupation_numbers(1:nomo))
IF (el_count > xas_nelectron) mo_set%occupation_numbers(nomo) = mo_set%occupation_numbers(nomo) - (el_count - xas_nelectron)
IF (el_count > xas_nelectron) &
mo_set%occupation_numbers(nomo) = mo_set%occupation_numbers(nomo) - (el_count - xas_nelectron)
el_count = SUM(mo_set%occupation_numbers(1:nomo))
is_large = ABS(el_count - xas_nelectron) > xas_nelectron*EPSILON(el_count)
CPASSERT(.NOT. is_large)
Expand Down

0 comments on commit 5a03381

Please sign in to comment.