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:
B: TheBody::propertiestype.S: TheSite::propertiestype.C: Theboundarycondition type.
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§
Sourcefn delta_energy_remove(
&self,
initial_microstate: &Microstate<B, S, X, C>,
body_index: usize,
) -> f64
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}