[]Trait lumol::energy::Potential

pub trait Potential: Send + Sync {
    fn energy(&self, x: f64) -> f64;
fn force(&self, x: f64) -> f64; }

A potential for force and energy computations.

A potential is defined with two functions that takes a single scalar variable and return the corresponding energy or norm of the force. The scalar variable will be the distance for pair potentials, the angle for angles or dihedral angles potentials, etc.

Example

use lumol_core::energy::Potential;

/// An hard sphere potential
#[derive(Clone)]
struct HardSphere {
    /// Sphere radius
    pub r: f64
}

impl Potential for HardSphere {
    fn energy(&self, x: f64) -> f64 {
        if x < self.r {
            f64::INFINITY
        } else {
            0.0
        }
    }

    fn force(&self, x: f64) -> f64 {
        0.0
    }
}

Required Methods

Get the energy corresponding to the variable x

Get the force norm corresponding to the variable x

Implementors

impl Potential for BornMayerHuggins

impl Potential for Buckingham

impl Potential for CosineHarmonic

impl Potential for Gaussian

impl Potential for Harmonic

impl Potential for LennardJones

impl Potential for Mie

impl Potential for Morse

impl Potential for NullPotential

impl Potential for Torsion

impl<P> Potential for P where
    P: 'static + Computation + Clone