pub fn shifted(potential: Box<dyn PairPotential>, cutoff: f64) -> PairInteraction {
        let shift = potential.energy(cutoff);
        PairInteraction {
            potential: potential,
            cutoff: cutoff,
            restriction: PairRestriction::None,
            computation: PairComputation::Shifted(shift),
            tail: false,
        }
    }
/// Create a new `PairInteraction` with the given `cutoff`, using shifted
/// computation of the energy.
///
/// # Examples
///
/// ```
/// use lumol_core::energy::PairInteraction;
/// use lumol_core::energy::Harmonic;
///
/// let potential = Box::new(Harmonic{x0: 0.5, k: 4.2});
/// let interaction = PairInteraction::shifted(potential, 2.0);
///
/// assert_eq!(interaction.energy(1.0), -4.2);
///
/// // energy goes smoothly to zero at the cutoff
/// assert!(interaction.energy(1.999).abs() < 0.01);
/// // energy after the cutoff is zero
/// assert_eq!(interaction.energy(2.0), 0.0);
/// ```
Create a new `PairInteraction` with the given `cutoff`, using shifted
computation of the energy.
Create a new ` PairInteraction ` with the given ` cutoff ` using shifted computation of the energy .
pub fn shifted(potential: Box<dyn PairPotential>, cutoff: f64) -> PairInteraction {
        let shift = potential.energy(cutoff);
        PairInteraction {
            potential: potential,
            cutoff: cutoff,
            restriction: PairRestriction::None,
            computation: PairComputation::Shifted(shift),
            tail: false,
        }
    }
pub fn shifted ( potential : Box < dyn PairPotential > , cutoff : f64 ) -> PairInteraction { let shift = potential . energy ( cutoff ) ; PairInteraction { potential : potential , cutoff : cutoff , restriction : PairRestriction :: None , computation : PairComputation :: Shifted ( shift ) , tail : false , } }
Create a new `PairInteraction` with the given `cutoff`, using shifted
computation of the energy.
Create a new ` PairInteraction ` with the given ` cutoff ` using shifted computation of the energy .
potential
Box<dyn PairPotential>
cutoff
f64
examples
```
use lumol_core::energy::PairInteraction;
use lumol_core::energy::Harmonic.

let potential = Box::new(Harmonic{x0: 0.5, k: 4.2});
let interaction = PairInteraction::shifted(potential, 2.0).



energy goes smoothly to zero at the cutoff
assert!(interaction.energy(1.999).abs() < 0.01);
energy after the cutoff is zero
assert_eq!(interaction.energy(2.0), 0.0);
```
` ` ` use lumol_core :: energy :: PairInteraction ; use lumol_core :: energy :: Harmonic . let potential = Box :: new ( Harmonic { x0 : 0 . 5 k : 4 . 2 } ) ; let interaction = PairInteraction :: shifted ( potential 2 . 0 ) . energy goes smoothly to zero at the cutoff assert! ( interaction . energy ( 1 . 999 ) . abs () < 0 . 01 ) ; energy after the cutoff is zero assert_eq! ( interaction . energy ( 2 . 0 ) 0 . 0 ) ; ` ` `