Skip to content

Commit

Permalink
fix: ignore numpy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
anyangml committed Feb 15, 2024
1 parent e122700 commit 0e1182e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions deepmd/dpmodel/atomic_model/linear_atomic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,16 @@ def _compute_weight(
),
axis=-1,
) # handle masked nnei.
sigma = numerator / denominator
with np.errstate(divide="ignore", invalid="ignore"):
sigma = numerator / denominator
u = (sigma - self.sw_rmin) / (self.sw_rmax - self.sw_rmin)
coef = np.zeros_like(u)
left_mask = sigma < self.sw_rmin
mid_mask = (self.sw_rmin <= sigma) & (sigma < self.sw_rmax)
right_mask = sigma >= self.sw_rmax
coef[left_mask] = 1
smooth = -6 * u**5 + 15 * u**4 - 10 * u**3 + 1
with np.errstate(invalid="ignore"):
smooth = -6 * u**5 + 15 * u**4 - 10 * u**3 + 1
coef[mid_mask] = smooth[mid_mask]
coef[right_mask] = 0
self.zbl_weight = coef
Expand Down

0 comments on commit 0e1182e

Please sign in to comment.