Skip to main content

NetSiteForceVirialAndTorque

Trait NetSiteForceVirialAndTorque 

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

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§

Source

type Force: Wedge + Outer

The type of the result force.

Required Methods§

Source

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

Implementors§

Source§

impl<V, B, S, X, C> NetSiteForceVirialAndTorque<B, S, X, C> for Zero
where V: Default + Wedge + Outer, V::Bivector: Default, S: Position<Position = V>, V::Tensor: Default,

Source§

type Force = V

Source§

impl<V, B, S, X, C, E> NetSiteForceVirialAndTorque<B, S, X, C> for External<E>
where V: Wedge + Outer, S: Position<Position = V>, E: SiteForceVirialAndTorque<S, Force = V>,

Source§

type Force = V

Source§

impl<V, B, S, X, C, E> NetSiteForceVirialAndTorque<B, S, X, C> for PairwiseCutoff<E>

Source§

type Force = V