/// The repulsive part of the potential.
The repulsive part of the potential.
The repulsive part of the potential .
fn repulsive_part(params: &Params, distsq: f64, r: V3, ni: V3, nj: V3) -> (f64, V3, V3, V3) {
    debug_assert_eq!(distsq, r.sqnorm());
//    debug_assert_close!(1.0, ni.sqnorm());  // untrue during numerical differentiation
//    debug_assert_close!(1.0, nj.sqnorm());  // untrue during numerical differentiation
    // calculate f(rho_ij) for ij and ji
    let (fij, fij_d_r, fij_d_ni) = crespi_f(params, distsq, r, ni);
    let (fji, fji_d_r, fji_d_nj) = crespi_f(params, distsq, r, nj);
    let value = params.C + fij + fji;
    let d_r = fij_d_r + fji_d_r;
    let d_ni = fij_d_ni;
    let d_nj = fji_d_nj;
    dbg!("VR: {:.9}", value);
    (value, d_r, d_ni, d_nj)
}
fn repulsive_part ( params : & Params , distsq : f64 , r : V3 , ni : V3 , nj : V3 ) -> ( f64 , V3 , V3 , V3 ) { debug_assert_eq ! ( distsq r sqnorm ( ) ) ; //    debug_assert_close!(1.0, ni.sqnorm());  // untrue during numerical differentiation //    debug_assert_close!(1.0, nj.sqnorm());  // untrue during numerical differentiation // calculate f(rho_ij) for ij and ji let ( fij , fij_d_r , fij_d_ni ) = crespi_f ( params , distsq , r , ni ) ; let ( fji , fji_d_r , fji_d_nj ) = crespi_f ( params , distsq , r , nj ) ; let value = params . C + fij + fji ; let d_r = fij_d_r + fji_d_r ; let d_ni = fij_d_ni ; let d_nj = fji_d_nj ; dbg ! ( " " value ) ; ( value , d_r , d_ni , d_nj ) }
The repulsive part of the potential.
The repulsive part of the potential .
params
&Params
distsq
f64
r
V3
ni
V3
nj
V3