pub trait ZeroCenterAngularMomentum<B, S> {
// Required method
fn zero_center_angular_momentum_with_filter<F: Fn(&Tagged<Body<B, S>>) -> bool>(
&mut self,
should_zero_body: F,
);
// Provided method
fn zero_center_angular_momentum(&mut self) { ... }
}Expand description
Remove angular motion about the system’s center of mass.
ZeroCenterAngularMomentum adjusts the translational momentum of every body in order to zero
out the total angular momentum of the system about the center of mass (ignoring
periodic boundary conditions).
§2D
In 2D, ZeroCenterAngularMomentum applies:
\vec{p}_{i,\mathrm{new}} = \vec{p}_{i,\mathrm{old}} - \left( [-r_{ci}^{y}, r_{ci}^{x}] \right) \frac{L_c}{I_c} m_iwhere $i$ is the index of each body in a system, $L_c$ is the
angular momentum about the center of mass, $I_c$ is the moment of
inertia about the center of mass, and $\vec{r}_{ci}$ is the position of body i
relative to the center of mass.
§3D
In 3D, ZeroCenterAngularMomentum applies:
\vec{p}_{i,\mathrm{new}} = \vec{p}_{i,\mathrm{old}} - \left( \vec{\omega}_c \times \vec{r}_{ci} \right) m_iwhere $i$ is the index of each body in a system,
$\vec{\omega}_c$ is angular velocity about the center of mass, and
$\vec{r}_{ci}$ is the position of body i relative to the center of mass.
$\vec{\omega}_c$ is obtained by solving the following linear system:
\mathbf{I}_c \vec{\omega}_c = \vec{L}_cwhere $\mathbf{I}_c$ is the moment of inertia about the center of mass,
and $\vec{L}_c$ is the angular momentum about the center of mass.
§Example
use hoomd_md::ZeroCenterAngularMomentum;
use hoomd_microstate::{
Body, Microstate,
property::{DynamicPoint, Point},
};
use hoomd_vector::Cartesian;
let mut microstate = Microstate::builder()
.bodies([
Body::single_site(
DynamicPoint {
position: Cartesian::from([1.0, 2.0]),
momentum: Cartesian::from([-2.0, 4.0]),
..Default::default()
},
Point::default(),
),
Body::single_site(
DynamicPoint {
position: Cartesian::from([-2.0, 3.0]),
momentum: Cartesian::from([3.0, -6.0]),
..Default::default()
},
Point::default(),
),
])
.try_build()?;
microstate.zero_center_angular_momentum();Required Methods§
Provided Methods§
Sourcefn zero_center_angular_momentum(&mut self)
fn zero_center_angular_momentum(&mut self)
Adjust each body’s angular translational momentum in order to zero the system’s overall angular momentum about the center of mass.
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.