Skip to content

Commit 5e9daf8

Browse files
committed
LUT ZBL as well; in the TiO2 example I got a small but significant speedup (13%)
1 parent 34ecb17 commit 5e9daf8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/interactions.rs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,16 @@ static LINDHARD_SCREENING_LENGTH_TABLE: LazyLock<[f64; Z_MAX*Z_MAX]> = LazyLock:
294294
}
295295
)
296296
);
297+
static ZBL_SCREENING_LENGTH_TABLE: LazyLock<[f64; Z_MAX*Z_MAX]> = LazyLock::new(
298+
||
299+
std::array::from_fn(
300+
|i| {
301+
let Za = i / Z_MAX;
302+
let Zb = i % Z_MAX;
303+
zbl_screening_length(Za as u64, Zb as u64)
304+
}
305+
)
306+
);
297307

298308
pub fn zbl_screening_length(Za: u64, Zb: u64) -> f64{
299309
0.88534*A0/((Za as f64).powf(0.23) + (Zb as f64).powf(0.23))
@@ -307,6 +317,10 @@ pub fn lindhard_screening_length_lookup(Za: u64, Zb: u64) -> f64 {
307317
LINDHARD_SCREENING_LENGTH_TABLE[Za as usize * Z_MAX + Zb as usize]
308318
}
309319

320+
pub fn lindhard_screening_length_lookup(Za: u64, Zb: u64) -> f64{
321+
ZBL_SCREENING_LENGTH_TABLE[Za as usize * Z_MAX + Zb as usize]
322+
}
323+
310324
/// Coefficients of inverse-polynomial interaction potentials.
311325
/// Note: these go in order of decreasing orders of r, e.g., [r^n, r^n-1, r^n-2, ... r, 1].
312326
pub fn polynomial_coefficients(relative_energy: f64, impact_parameter: f64, interaction_potential: InteractionPotential) -> Vec<f64> {

0 commit comments

Comments
 (0)