pub fn virial(&self, r: &Vector3D) -> Matrix3 {
        if r.norm() >= self.cutoff {
            Matrix3::zero()
        } else {
            self.potential.virial(r)
        }
    }
/// Get the virial contribution for this pair interaction at the distance
/// `r`.
///
/// # Examples
///
/// ```
/// use lumol_core::energy::PairInteraction;
/// use lumol_core::energy::Harmonic;
/// # use lumol_core::types::Vector3D;
///
/// let potential = Box::new(Harmonic{x0: 0.5, k: 4.2});
/// let interaction = PairInteraction::shifted(potential, 2.0);
///
/// let r = Vector3D::new(1.0, 0.0, 0.3);
/// let force = interaction.force(r.norm()) * r / r.norm();
/// assert_eq!(interaction.virial(&r), r.tensorial(&force));
/// ```
Get the virial contribution for this pair interaction at the distance
`r`.
Get the virial contribution for this pair interaction at the distance ` r ` .
pub fn virial(&self, r: &Vector3D) -> Matrix3 {
        if r.norm() >= self.cutoff {
            Matrix3::zero()
        } else {
            self.potential.virial(r)
        }
    }
pub fn virial ( & self , r : & Vector3D ) -> Matrix3 { if r . norm ( ) >= self . cutoff { Matrix3 :: zero ( ) } else { self . potential . virial ( r ) } }
Get the virial contribution for this pair interaction at the distance
`r`.
Get the virial contribution for this pair interaction at the distance ` r ` .
&self
r
&Vector3D
examples
```
use lumol_core::energy::PairInteraction;
use lumol_core::energy::Harmonic.
` ` ` use lumol_core :: energy :: PairInteraction ; use lumol_core :: energy :: Harmonic .
use lumol_core::types::vector3d;
let potential = Box::new(Harmonic{x0: 0.5, k: 4.2});
let interaction = PairInteraction::shifted(potential, 2.0).

let r = Vector3D::new(1.0, 0.0, 0.3);
let force = interaction.force(r.norm()) * r / r.norm();
assert_eq!(interaction.virial(&r), r.tensorial(&force));
```
let potential = Box :: new ( Harmonic { x0 : 0 . 5 k : 4 . 2 } ) ; let interaction = PairInteraction :: shifted ( potential 2 . 0 ) . let r = Vector3D :: new ( 1 . 0 0 . 0 0 . 3 ) ; let force = interaction . force ( r . norm () ) * r / r . norm () ; assert_eq! ( interaction . virial ( &r ) r . tensorial ( &force )) ; ` ` `