Skip to main content

PairPotential

Trait PairPotential 

Source
pub trait PairPotential {
    // Required methods
    fn energy(&self, r: Fix128) -> Result<Fix128, PairPotentialError>;
    fn force(&self, r: Fix128) -> Result<Fix128, PairPotentialError>;

    // Provided method
    fn force_on_first(&self, d: Vec3Fix) -> Result<Vec3Fix, PairPotentialError> { ... }
}
Expand description

A central pair potential U(r) and its radial force F(r) = −dU/dr.

Required Methods§

Source

fn energy(&self, r: Fix128) -> Result<Fix128, PairPotentialError>

Potential energy U(r) at distance r > 0.

Source

fn force(&self, r: Fix128) -> Result<Fix128, PairPotentialError>

Radial force F(r) = −dU/dr at r > 0 (positive = repulsive).

Provided Methods§

Source

fn force_on_first(&self, d: Vec3Fix) -> Result<Vec3Fix, PairPotentialError>

Force on the first particle of a pair separated by d = x_i − x_j: F(|d|) d / |d|. The second particle receives the negative.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§