Skip to main content

DeltaEnergyRemove

Trait DeltaEnergyRemove 

Source
pub trait DeltaEnergyRemove<B, S, X, C> {
    // Required method
    fn delta_energy_remove(
        &self,
        initial_microstate: &Microstate<B, S, X, C>,
        body_index: usize,
    ) -> f64;
}
Expand description

Compute the change in energy when a single body is removed.

Some trial moves remove a single body at a time and use a Hamiltonian that implements DeltaEnergyRemove to efficiently compute the change in energy.

The generic type names are:

See the Implementors section below for examples.

§Derive macro

Use the DeltaEnergyRemove derive macro to automatically implement the DeltaEnergyRemove trait on a type. The derived implementation sums the result of delta_energy_remove over all fields in the struct (in the order in which fields are named in the struct definition). The sum short circuits and returns f64::INFINITY when any one field returns infinity.

use hoomd_interaction::{
    DeltaEnergyRemove, External, PairwiseCutoff, external::Linear,
    pairwise::Isotropic, univariate::Boxcar,
};
use hoomd_vector::Cartesian;

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

Required Methods§

Source

fn delta_energy_remove( &self, initial_microstate: &Microstate<B, S, X, C>, body_index: usize, ) -> f64

Compute the change in energy.

initial_microstate describes the initial configuration and body_index is the index of the body to remove. The final configuration includes all bodies in the initial microstate except the body previously at body_index.

Returns:

\Delta E = E_\mathrm{final} - E_\mathrm{initial}

Implementors§

Source§

impl<B, S, X, C> DeltaEnergyRemove<B, S, X, C> for Zero

Source§

impl<B, S, X, C, E> DeltaEnergyRemove<B, S, X, C> for External<E>
where E: SiteEnergy<S>,

Source§

impl<P, B, S, X, C, E> DeltaEnergyRemove<B, S, X, C> for PairwiseCutoff<E>
where E: SitePairEnergy<S> + MaximumInteractionRange, S: Position<Position = P>, X: PointsNearBall<P, SiteKey>,