Skip to main content

MaximumInteractionRange

Trait MaximumInteractionRange 

Source
pub trait MaximumInteractionRange {
    // Required method
    fn maximum_interaction_range(&self) -> f64;
}
Expand description

Largest distance between two sites where the pairwise interaction may be non-zero.

PairwiseCutoff uses the provided maximum interaction range to efficiently compute only the needed interactions. All types that implement SitePair* traits must also implement MaximumInteractionRange.

§Derive macro

Use the MaximumInteractionRange derive macro to automatically implement the MaximumInteractionRange trait on a type.

When the type has a field named maximum_interaction_range, the derived implementation returns it. When there is no such field, the derived implementation takes the maximum of the maximum_interaction_range over all fields in the struct. The former case is intended for use with custom site pair potentials and the latter is intended for use with multi-term Hamiltonian types.

use hoomd_interaction::{
    External, MaximumInteractionRange, PairwiseCutoff, external::Linear,
};
use hoomd_vector::Cartesian;

#[derive(MaximumInteractionRange)]
struct SitePairInteraction {
    // ...
    maximum_interaction_range: f64,
}

#[derive(MaximumInteractionRange)]
struct Hamiltonian {
    linear: External<Linear<Cartesian<2>>>,
    pairwise_cutoff: PairwiseCutoff<SitePairInteraction>,
}

Required Methods§

Source

fn maximum_interaction_range(&self) -> f64

The largest distance between two sites where the pairwise interaction may be non-zero.

Implementors§