|
6 | 6 |
|
7 | 7 | import importlib |
8 | 8 | import numpy as np |
| 9 | +from ..constants import logish_eps |
9 | 10 | from ..utils.chemistry import process_solution_chemistry |
10 | 11 | from .. import constants |
11 | 12 | import warnings |
12 | 13 | from .material import material_property, cached_property |
13 | 14 | from dataclasses import make_dataclass |
14 | 15 |
|
15 | | -np_eps = np.finfo(float).eps |
16 | | - |
17 | 16 | Interaction = make_dataclass( |
18 | 17 | "Interaction", ["inds", "expts", "f_r", "m_jr", "f_rs", "m_jrs"] |
19 | 18 | ) |
@@ -106,26 +105,26 @@ def _non_ideal_interactions_subreg(p, n_endmembers, Wijk): |
106 | 105 | return Wint |
107 | 106 |
|
108 | 107 |
|
109 | | -def logish(x, eps=np_eps): |
| 108 | +def logish(x, eps=logish_eps): |
110 | 109 | """ |
111 | 110 | 2nd order series expansion of log(x) about eps: |
112 | 111 | log(eps) - sum_k=1^infty (f_eps)^k / k |
113 | 112 | Prevents infinities at x=0 |
114 | 113 | """ |
115 | | - f_eps = 1.0 - x / eps |
116 | | - mask = x > eps |
117 | | - ln = np.where(x <= eps, np.log(eps) - f_eps - f_eps * f_eps / 2.0, 0.0) |
| 114 | + f_eps = 1.0 - x / eps[0] |
| 115 | + mask = x > eps[0] |
| 116 | + ln = np.where(x <= eps[0], np.log(eps[0]) - f_eps - f_eps * f_eps / 2.0, 0.0) |
118 | 117 | ln[mask] = np.log(x[mask]) |
119 | 118 | return ln |
120 | 119 |
|
121 | 120 |
|
122 | | -def inverseish(x, eps=np_eps): |
| 121 | +def inverseish(x, eps=logish_eps): |
123 | 122 | """ |
124 | 123 | 1st order series expansion of 1/x about eps: 2/eps - x/eps/eps |
125 | 124 | Prevents infinities at x=0 |
126 | 125 | """ |
127 | | - mask = x > eps |
128 | | - oneoverx = np.where(x <= eps, 2.0 / eps - x / eps / eps, 0.0) |
| 126 | + mask = x > eps[0] |
| 127 | + oneoverx = np.where(x <= eps[0], 2.0 / eps[0] - x / eps[0] / eps[0], 0.0) |
129 | 128 | oneoverx[mask] = 1.0 / x[mask] |
130 | 129 | return oneoverx |
131 | 130 |
|
|
0 commit comments