pub trait NetSiteForceVirialAndTorque<B, S, X, C> {
type Force: Wedge + Outer;
// Required method
fn net_site_force_virial_and_torque(
&self,
microstate: &Microstate<B, S, X, C>,
site_index: usize,
) -> (Self::Force, <Self::Force as Outer>::Tensor, <Self::Force as Wedge>::Bivector);
}Expand description
Sum all the forces, virials, and torques that act on a given site in a microstate.
In molecular dynamics simulations, bodies move in response to the net force
and torque applied to all sites in the body. As an intermediate step in that
calculation, a type that describes a force interaction model must implement
NetSiteForceVirialAndTorque and compute the net force and torque on a given
site in the Microstate.
The generic type names are:
B: TheBody::propertiestype.S: TheSite::propertiestype.X: The spatial data structure type.C: Theboundarycondition type.
See the Implementors section below for examples.
§Derive macro
Use the NetSiteForceVirialAndTorque derive macro to
automatically implement the NetSiteForceVirialAndTorque trait on a type. The derived
implementation sums the result of net_site_force_and_torque over all fields in
the struct (in the order in which fields are named in the struct definition).
use hoomd_interaction::{
External, NetSiteForceVirialAndTorque, PairwiseCutoff,
external::ConstantForce, pairwise::Isotropic, univariate::LennardJones,
};
use hoomd_microstate::{Body, Microstate, property::Point};
use hoomd_vector::Cartesian;
#[derive(NetSiteForceVirialAndTorque)]
struct Hamiltonian {
linear: External<ConstantForce<Cartesian<2>>>,
pairwise_cutoff: PairwiseCutoff<Isotropic<LennardJones>>,
}Required Associated Types§
Required Methods§
Sourcefn net_site_force_virial_and_torque(
&self,
microstate: &Microstate<B, S, X, C>,
site_index: usize,
) -> (Self::Force, <Self::Force as Outer>::Tensor, <Self::Force as Wedge>::Bivector)
fn net_site_force_virial_and_torque( &self, microstate: &Microstate<B, S, X, C>, site_index: usize, ) -> (Self::Force, <Self::Force as Outer>::Tensor, <Self::Force as Wedge>::Bivector)
Compute the net force, virial, and torque on a given site.
microstate describes the configuration and site_index is the index
of the site to compute.
Returns:
TODO