Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/bca.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::*;
use rand::RngExt;


#[cfg(feature = "cpr_rootfinder")]
const CPR_ROOTFINDER_LOWER_BOUND: f64 = 1e-4;

Expand All @@ -17,6 +18,8 @@ use rcpr::rootfinders::{
real_polynomial_roots,
Config
};
#[cfg(feature = "cpr_rootfinder")]
use rcpr::chebyshev::ErrorCalc;

/// Geometrical quantities of binary collision.
pub struct BinaryCollisionGeometry {
Expand Down Expand Up @@ -606,8 +609,6 @@ fn transform(x: f64, l: f64) -> f64 {
l/(x*PI/2.).tan().powi(2)
}



#[cfg(feature = "cpr_rootfinder")]
/// Computes the distance of closest approach of two particles with atomic numbers `Za`, `Zb` and masses `Ma`, `Mb` for an arbitrary interaction potential (e.g., Morse) for a given impact parameter and incident energy `E0` using the Chebyshev-Proxy Root-Finder method.
///
Expand Down Expand Up @@ -655,7 +656,8 @@ pub fn cpr_rootfinder(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, impact_parame
nmax,
complex_threshold,
far_from_zero,
interval_limit
interval_limit,
ErrorCalc::Relative,
);

let roots = find_roots(&g, vec![(lower_bound, upper_bound)], config)?;
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2175,8 +2175,8 @@ fn scattering_integrals(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64, n_g

#[cfg(feature = "python")]
#[pyfunction]
#[pyo3(signature = (Za, Zb, Ma, Mb, E0, p, d, alpha, r0, n0=2, nmax=64, epsilon=1e-6, complex_threshold=0.0, far_from_zero=1e22, interval_limit=1e-3, n_gl_points=100, interaction_potential="KR_C"))]
fn scattering_integral_morse(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64, d: f64, alpha: f64, r0: f64, n0: usize, nmax: usize, epsilon: f64, complex_threshold: f64, far_from_zero: f64, interval_limit: f64, n_gl_points: usize, interaction_potential: &str) -> PyResult<(f64, f64, f64)> {
#[pyo3(signature = (Za, Zb, Ma, Mb, E0, p, d, alpha, r0, n0=2, nmax=64, epsilon=1e-6, complex_threshold=0.0, far_from_zero=1e22, interval_limit=1e-3, n_gl_points=100))]
fn scattering_integral_morse(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64, d: f64, alpha: f64, r0: f64, n0: usize, nmax: usize, epsilon: f64, complex_threshold: f64, far_from_zero: f64, interval_limit: f64, n_gl_points: usize) -> PyResult<(f64, f64, f64)> {
let E0 = E0*EV;
let p = p*ANGSTROM;
let d = d*EV;
Expand All @@ -2199,7 +2199,6 @@ fn scattering_integral_morse(Za: f64, Zb: f64, Ma: f64, Mb: f64, E0: f64, p: f64
let theta_gm = bca::gauss_mehler(Za, Zb, Ma, Mb, E0, p, x0, screening_length, potential, n_gl_points);
let theta_gl = bca::gauss_legendre(Za, Zb, Ma, Mb, E0, p, x0, screening_length, potential);


Ok((x0, theta_gm, theta_gl))
}

Expand Down
Loading