pub trait UpdateNetForceAndVirial<E> {
// Required method
fn update_net_force_and_virial(&mut self, interaction_model: &E);
}Expand description
Compute the net force and virial given by an interaction model and apply it to each body in the microstate.
Given an interaction model that implements NetBodyForceAndVirial,
UpdateNetForceAndVirial sets the NetForce and NetVirial
properties of each body in the microstate to the one computed by the
interaction model.
§Example
use hoomd_interaction::{
PairwiseCutoff, Rigid, pairwise::Isotropic, univariate::LennardJones,
};
use hoomd_md::UpdateNetForceAndVirial;
use hoomd_microstate::{
Body, Microstate,
property::{DynamicPoint, Point},
};
use hoomd_vector::Cartesian;
let mut microstate = Microstate::builder()
.bodies([
Body::single_site(DynamicPoint::default(), Point::default()),
Body::single_site(
DynamicPoint {
position: Cartesian::<2>::from([2.0, 0.0]),
..Default::default()
},
Point::default(),
),
])
.try_build()?;
let lennard_jones = LennardJones::<12, 6>::default();
let pairwise_cutoff = PairwiseCutoff(Isotropic {
interaction: lennard_jones,
r_cut: 2.5,
});
let rigid = Rigid(pairwise_cutoff);
microstate.update_net_force_and_virial(&rigid);Required Methods§
Sourcefn update_net_force_and_virial(&mut self, interaction_model: &E)
fn update_net_force_and_virial(&mut self, interaction_model: &E)
Compute and set the net force and virial on each body.