[]Trait lumol::energy::PairPotential

pub trait PairPotential: Potential + BoxClonePair {
    fn tail_energy(&self, cutoff: f64) -> f64;
fn tail_virial(&self, cutoff: f64) -> f64; fn virial(&self, r: &Vector3D) -> Matrix3 { ... } }

Marker trait for potentials that can be used for non-bonded two body interactions.

Example

use lumol_core::energy::{Potential, PairPotential};

// A no-op potential
#[derive(Clone)]
struct Null;

impl Potential for Null {
    fn energy(&self, x: f64) -> f64 {0.0}
    fn force(&self, x: f64) -> f64 {0.0}
}

// By implementing this trait, we can use the Null potential for pair
// interactions
impl PairPotential for Null {
    fn tail_energy(&self, cutoff: f64) -> f64 {
        return 0.0;
    }

    fn tail_virial(&self, cutoff: f64) -> f64 {
        return 0.0;
    }
}

Required Methods

Compute the tail correction to the energy for the given cutoff.

Calling V(r) the Potential::energy(r) function corresponding to this potential, this function should return the integral from cutoff to infinity of r^2 V(r): \int_{cutoff}^\infty r^2 V(r) dr.

If this integral does not converge for the current potential, this function should then return 0 to disable tail corrections.

Compute the tail correction to the virial for the given cutoff.

Calling f(r) the Potential::force(r) function corresponding to this potential, this function should return the integral from cutoff to infinity of f(r) r^3: \int_{cutoff}^\infty r^3 f(r) dr.

If this integral does not converge for the current potential, this function should then return 0.0 to disable tail corrections.

Provided Methods

Compute the virial contribution corresponding to the distance r between the particles.

Implementors

impl PairPotential for BornMayerHuggins

impl PairPotential for Buckingham

impl PairPotential for Gaussian

impl PairPotential for Harmonic

impl PairPotential for LennardJones

impl PairPotential for Mie

impl PairPotential for Morse

impl PairPotential for NullPotential

impl PairPotential for TableComputation