[]Struct lumol::energy::TableComputation

pub struct TableComputation { /* fields omitted */ }

Computation of a potential using tabulated values.

This can be faster than direct computation for smooth potentials, but will uses more memory and be less precise than direct computation. Values are tabulated in the [0, max) range, and a cutoff is applied after max.

Methods

impl TableComputation

pub fn new(
    potential: Box<dyn PairPotential + 'static>,
    size: usize,
    max: f64
) -> TableComputation

Create a new TableComputation for potential, with size points and a maximum value of max.

Examples

use lumol_core::energy::TableComputation;
use lumol_core::energy::Harmonic;

let potential = Box::new(Harmonic{x0: 0.5, k: 4.2});
let table = TableComputation::new(potential, 1000, 2.0);

assert_eq!(table.energy(1.0), 0.525);
assert_eq!(table.energy(3.0), 0.0);

Trait Implementations

impl Computation for TableComputation

impl Clone for TableComputation

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PairPotential for TableComputation

fn virial(&self, r: &Vector3D) -> Matrix3

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

impl FromTomlWithData for TableComputation

type Data = Box<dyn PairPotential + 'static>

The type of the additional data needed.

Auto Trait Implementations

impl Send for TableComputation

impl Sync for TableComputation

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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