fn crespi_f(params: &Params, r: V3) -> (f64, V3, M33) {
    // first we need the transverse distances (aka rho^2)
    let (rhosq, rhosq_d_r, rhosq_dd_r_r) = rho_squared(r);

    // then we calculate f itself
    let (f, f_d_rhosq, f_dd_rhosq_rhosq) = crespi_fp(params, rhosq);

    let value = f;
    let d_r = f_d_rhosq * rhosq_d_r;
    let dd_r_r = f_d_rhosq * rhosq_dd_r_r + f_dd_rhosq_rhosq * outer(rhosq_d_r, rhosq_d_r);

    (value, d_r, dd_r_r)
}
/// The repulsive part of the potential f(rho), but calculates rho from input distance vector
/// r, and unit normal n
The repulsive part of the potential f(rho), but calculates rho from input distance vector
r, and unit normal n
The repulsive part of the potential f ( rho ) but calculates rho from input distance vector r and unit normal n
fn crespi_f(params: &Params, r: V3) -> (f64, V3, M33) {
    // first we need the transverse distances (aka rho^2)
    let (rhosq, rhosq_d_r, rhosq_dd_r_r) = rho_squared(r);
    // then we calculate f itself
    let (f, f_d_rhosq, f_dd_rhosq_rhosq) = crespi_fp(params, rhosq);
    let value = f;
    let d_r = f_d_rhosq * rhosq_d_r;
    let dd_r_r = f_d_rhosq * rhosq_dd_r_r + f_dd_rhosq_rhosq * outer(rhosq_d_r, rhosq_d_r);
    (value, d_r, dd_r_r)
}
fn crespi_f ( params : & Params , r : V3 ) -> ( f64 , V3 , M33 ) { // first we need the transverse distances (aka rho^2) let ( rhosq , rhosq_d_r , rhosq_dd_r_r ) = rho_squared ( r ) ; // then we calculate f itself let ( f , f_d_rhosq , f_dd_rhosq_rhosq ) = crespi_fp ( params , rhosq ) ; let value = f ; let d_r = f_d_rhosq * rhosq_d_r ; let dd_r_r = f_d_rhosq * rhosq_dd_r_r + f_dd_rhosq_rhosq * outer ( rhosq_d_r , rhosq_d_r ) ; ( value , d_r , dd_r_r ) }
The repulsive part of the potential f(rho), but calculates rho from input distance vector
r, and unit normal n
The repulsive part of the potential f ( rho ) but calculates rho from input distance vector r and unit normal n
params
&Params
r
V3
params
&Params
r
V3