Skip to main content

UpdateNetForceAndVirial

Trait UpdateNetForceAndVirial 

Source
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§

Source

fn update_net_force_and_virial(&mut self, interaction_model: &E)

Compute and set the net force and virial on each body.

Implementations on Foreign Types§

Source§

impl<V, B, S, X, C, E> UpdateNetForceAndVirial<E> for Microstate<B, S, X, C>
where V: Default + Vector + Outer + Send, V::Tensor: Copy + Send, B: NetForce<NetForce = V> + NetVirial<NetVirial = V::Tensor> + Sync, S: Sync, X: Sync, C: Sync, E: NetBodyForceAndVirial<B, S, X, C, Force = V> + Sync,

Source§

fn update_net_force_and_virial(&mut self, interaction_model: &E)

Implementors§