|
1 | 1 | import numpy as np |
| 2 | +import numba |
2 | 3 | import time |
3 | 4 |
|
4 | 5 | def PCA(number: int, mass: np.ndarray, r: np.ndarray, Df: float, kf: float, tolerance: float) -> tuple[bool, np.ndarray]: |
@@ -89,6 +90,7 @@ def PCA(number: int, mass: np.ndarray, r: np.ndarray, Df: float, kf: float, tole |
89 | 90 | m1 = m3 |
90 | 91 | rg1 = (np.exp(np.sum(np.log(r))/np.log(r).size))*(np.power(n1/kf, 1/Df)) |
91 | 92 | k = k + 1 |
| 93 | + # FIXME: this gets stuck for some reason (no apparent connection to the arcos issue) |
92 | 94 |
|
93 | 95 | data_new = np.zeros((number,4)) |
94 | 96 | for i in range(number): |
@@ -179,6 +181,7 @@ def gamma_calc(rg1: float,rg2: float,rg3: float,n1: int,n2: int,n3: int) -> tupl |
179 | 181 |
|
180 | 182 | return gamma_ok, gamma_pc |
181 | 183 |
|
| 184 | +@numba.njit() |
182 | 185 | def random_list_selection(gamma_ok: bool, gamma_pc: float,X: np.ndarray, Y: np.ndarray, Z: np.ndarray,R: np.ndarray, n1: int, x_cm: float, y_cm: float, z_cm: float) -> tuple[np.ndarray, float]: |
183 | 186 | candidates = np.zeros((n1)) |
184 | 187 | rmax = 0.0 |
@@ -226,6 +229,7 @@ def search_monomer_candidates(R: np.ndarray, M: np.ndarray, monomer_candidates: |
226 | 229 |
|
227 | 230 | candidates, rmax = random_list_selection(gamma_ok, gamma_pc, X,Y,Z,R,n1,x_cm,y_cm,z_cm) |
228 | 231 |
|
| 232 | + # FIXME: this fails once kf > 1.5 LMFAO |
229 | 233 | candidates[RS_1-k-1] = 1 |
230 | 234 | return candidates, rmax |
231 | 235 |
|
@@ -270,6 +274,10 @@ def sticking_process(x: float,y: float,z: float,r: float,r_k: float, x_cm: float |
270 | 274 | distance = np.sqrt(np.power(x2-x1,2) + np.power(y2-y1,2) + np.power(z2-z1,2)) |
271 | 275 |
|
272 | 276 | alpha = np.arccos((np.power(r1,2) + np.power(distance,2) - np.power(r2,2))/(2*r1*distance)) |
| 277 | + if abs((np.power(r1,2) + np.power(distance,2) - np.power(r2,2))/(2*r1*distance)) > 1: |
| 278 | + # FIXME: this should never happen! |
| 279 | + print(f"{(np.power(r1,2) + np.power(distance,2) - np.power(r2,2))/(2*r1*distance) = }") |
| 280 | + exit(-1) |
273 | 281 | r0 = r1*np.sin(alpha) |
274 | 282 |
|
275 | 283 | # AmBdC = (A+B)/C |
|
0 commit comments