Skip to main content

ThermalizeAngularMomentum

Trait ThermalizeAngularMomentum 

Source
pub trait ThermalizeAngularMomentum<B, S> {
    // Required method
    fn thermalize_angular_momentum_with_filter<F: Fn(&Tagged<Body<B, S>>) -> bool>(
        &mut self,
        temperature: f64,
        should_thermalize_body: F,
    );

    // Provided method
    fn thermalize_angular_momentum(&mut self, temperature: f64) { ... }
}
Expand description

Draw random angular momenta from a thermal distribution.

In the Maxwell–Boltzmann distribution, each component of the angular momentum $L_i$ (aligned to the principal axes) is normally distributed with mean 0 and variance $ \sigma^2 = I_i k T$:

   f(L_i) = \frac{1}{\sqrt{2 \pi I_i k T}} \exp{\left( -\frac{L_i^2}{2 I_i k T} \right)}

where $f$ is probability, $I_i$ is ith component of the diagonalized moment of inertia, $k$ is the Boltzmann constant, and $T$ is temperature.

§Example

use hoomd_md::ThermalizeAngularMomentum;
use hoomd_microstate::{
    Body, Microstate,
    property::{DynamicOrientedPoint, Point},
};
use hoomd_vector::{Angle, Cartesian};

let mut microstate = Microstate::builder()
    .bodies([
        Body::single_site(
            DynamicOrientedPoint {
                position: Cartesian::from([1.0, 2.0]),
                ..Default::default()
            },
            Point::default(),
        ),
        Body::single_site(
            DynamicOrientedPoint {
                position: Cartesian::from([-2.0, 3.0]),
                ..Default::default()
            },
            Point::default(),
        ),
    ])
    .try_build()?;

microstate.thermalize_angular_momentum(1.5);

Required Methods§

Source

fn thermalize_angular_momentum_with_filter<F: Fn(&Tagged<Body<B, S>>) -> bool>( &mut self, temperature: f64, should_thermalize_body: F, )

Assign thermally distributed random angular momenta to selected bodies in the microstate.

Provided Methods§

Source

fn thermalize_angular_momentum(&mut self, temperature: f64)

Assign thermally distributed random angular momenta to all bodies in the microstate.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<P, S, X, C> ThermalizeAngularMomentum<DynamicOrientedPoint<P, Angle>, S> for Microstate<DynamicOrientedPoint<P, Angle>, S, X, C>

Source§

fn thermalize_angular_momentum_with_filter<F: Fn(&Tagged<Body<DynamicOrientedPoint<P, Angle>, S>>) -> bool>( &mut self, temperature: f64, should_thermalize_body: F, )

Source§

impl<P, S, X, C> ThermalizeAngularMomentum<DynamicOrientedPoint<P, Versor>, S> for Microstate<DynamicOrientedPoint<P, Versor>, S, X, C>

Source§

fn thermalize_angular_momentum_with_filter<F: Fn(&Tagged<Body<DynamicOrientedPoint<P, Versor>, S>>) -> bool>( &mut self, temperature: f64, should_thermalize_body: F, )

Implementors§