pub trait UpdateNetForceVirialAndTorque<E> {
// Required method
fn update_net_force_virial_and_torque(&mut self, interaction_model: &E);
}Expand description
Compute the net force, virial, and torque given by an interaction model and apply them to each body in the microstate.
Given an interaction model that implements NetBodyForceVirialAndTorque,
UpdateNetForceVirialAndTorque sets the NetForce, NetVirial and
NetTorque properties of each body in the microstate to the ones computed
by the interaction model.
§Example
use hoomd_interaction::{
PairwiseCutoff, Rigid, pairwise::Isotropic, univariate::LennardJones,
};
use hoomd_md::UpdateNetForceVirialAndTorque;
use hoomd_microstate::{
Body, Microstate,
property::{DynamicOrientedPoint, Point},
};
use hoomd_vector::{Angle, Cartesian};
let mut microstate: Microstate<
DynamicOrientedPoint<Cartesian<2>, Angle>,
Point<Cartesian<2>>,
_,
_,
> = Microstate::builder()
.bodies([
Body::single_site(
DynamicOrientedPoint {
position: Cartesian::<2>::from([0.0, -1.0]),
..Default::default()
},
Point::new([0.0, 1.0].into()),
),
Body::single_site(
DynamicOrientedPoint {
position: Cartesian::<2>::from([2.0, -2.0]),
..Default::default()
},
Point::new([0.0, 2.0].into()),
),
])
.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_virial_and_torque(&rigid);Required Methods§
Sourcefn update_net_force_virial_and_torque(&mut self, interaction_model: &E)
fn update_net_force_virial_and_torque(&mut self, interaction_model: &E)
Compute and set the net force, virial, and torque on each body.