Skip to content

Commit

Permalink
Set cutoff limit to r = r_N, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
msricher committed Dec 17, 2024
1 parent 6b8966e commit f15d93e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ cython_debug/
.vscode/

# Raw data files
atomdb/datasets/*/raw/
atomdb/datasets/*/db/

# Generated documentation
docs/source/api/
Expand Down
10 changes: 5 additions & 5 deletions atomdb/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ def __init__(self, x, y, log=False):
self._log = log
self._obj = CubicSpline(
x,
# Clip y values to >=ε^2 if using log because they have to be above 0;
# having them be at least ε^2 seems to work based on my testing
np.log(y.clip(min=np.finfo(float).eps ** 2)) if log else y,
# Clip y values to >= ε if using log because they have to be above 0;
# having them be at least ε seems to work based on my testing
np.log(y.clip(min=np.finfo(float).eps)) if log else y,
axis=0,
bc_type="not-a-knot",
extrapolate=True,
Expand Down Expand Up @@ -198,8 +198,8 @@ def __call__(self, x, deriv=0):
y = self._obj(x, nu=deriv)
# Handle errors from the y = exp(log y) operation -- set NaN to zero
np.nan_to_num(y, nan=0., copy=False)
# Cutoff value: assume y(x) is zero where x >= 2 times final given point x_n
y[x > 2 * self._obj.x[-1]] = 0
# Cutoff value: assume y(x) is zero where x > final given point x_n
y[x > self._obj.x[-1]] = 0
return y


Expand Down

0 comments on commit f15d93e

Please sign in to comment.