Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fixing nan in PBE correlation functional
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhelal committed Apr 26, 2024
1 parent df2dc1b commit fcd63b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mess/xcfunctional.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def gga_correlation_pbe(
# avoid divide by zero when rho = 0 by replacing with 1.0
mask = jnp.abs(rho) > threshold
rho = jnp.where(mask, rho, 1.0)
A = beta / gamma * (jnp.exp(-ec_pw / (gamma * phi**3)) - 1) ** -1 # Eq 8
mask_ecpw = jnp.where(mask, ec_pw, 1.0)
A = beta / gamma * (jnp.exp(-mask_ecpw / (gamma * phi**3)) - 1) ** -1 # Eq 8
kf = (3 * np.pi**2 * rho) ** (1 / 3)
ks = jnp.sqrt(4 * kf / np.pi)
t = jnl.norm(grad_rho, axis=1) / (2 * phi * ks * rho)
Expand Down

0 comments on commit fcd63b3

Please sign in to comment.