pub struct NoséHooverChain<const N: usize> { /* private fields */ }Expand description
Chain of Nosé-Hoover thermostats.
NoséHooverChain adds new degrees of freedom ($\eta_i$)
to a molecular dynamics simulation in such a way that the existing
degrees of freedom sample a constant temperature ensemble. Each
NoséHooverChain instance stores the $\eta_i$ and their momenta,
$\xi_i$, internally.
The dynamics of each $\eta_i, \xi_i$ are similar to that in
MartynaTuckermanTobiasKlein, but they are also chained together.
See Martyna et al. 1992 for details.
§Reference
§Example
use hoomd_md::thermostat::NoséHooverChain;
let thermostat = NoséHooverChain::<3>::zero(0.5.try_into()?);Implementations§
Source§impl<const N: usize> NoséHooverChain<N>
impl<const N: usize> NoséHooverChain<N>
Sourcepub fn zero(tau: PositiveReal) -> Self
pub fn zero(tau: PositiveReal) -> Self
Construct a new NoséHooverChain thermostat with the given time constant,
$\xi_i = 0$, and $\eta_i = 0$ .
This initial condition is likely to be very far from equilibrium which
will result in wild kinetic energy oscillations for the first hundred to
thousand time steps. Use thermalized to choose the initial position
and momentum from a thermal distribution.
§Example
use hoomd_md::thermostat::NoséHooverChain;
let thermostat = NoséHooverChain::<3>::zero(0.5.try_into()?);Sourcepub fn thermalized<M, R: Rng + ?Sized>(
rng: &mut R,
tau: PositiveReal,
macrostate: &M,
degrees_of_freedom: usize,
) -> Selfwhere
M: Temperature,
pub fn thermalized<M, R: Rng + ?Sized>(
rng: &mut R,
tau: PositiveReal,
macrostate: &M,
degrees_of_freedom: usize,
) -> Selfwhere
M: Temperature,
Construct a new NoséHooverChain thermostat with random $\xi_i$
values drawn from a thermal distribution.
§Panics
This method will panic when degrees_of_freedom is 0.
§Example
use hoomd_md::{TranslationalKineticEnergy, thermostat::NoséHooverChain};
use hoomd_microstate::{
Body, Microstate,
property::{DynamicPoint, Point},
};
use hoomd_simulation::macrostate::Isothermal;
use hoomd_vector::Cartesian;
let mut microstate = Microstate::builder()
.bodies([
Body::single_site(
DynamicPoint {
position: Cartesian::from([1.0, 2.0]),
..Default::default()
},
Point::default(),
),
Body::single_site(
DynamicPoint {
position: Cartesian::from([-2.0, 3.0]),
..Default::default()
},
Point::default(),
),
])
.try_build()?;
let macrostate = Isothermal { temperature: 1.5 };
let mut rng = microstate.counter().make_rng();
let translational_thermostat = NoséHooverChain::<3>::thermalized(
&mut rng,
0.5.try_into()?,
¯ostate,
microstate.translational_kinetic_energy().1,
);
microstate.increment_substep();Sourcepub fn energy(&self) -> f64
pub fn energy(&self) -> f64
The total energy of the thermostat.
§Example
use hoomd_md::thermostat::NoséHooverChain;
let thermostat = NoséHooverChain::<3>::zero(0.5.try_into()?);
let energy = thermostat.energy();Trait Implementations§
Source§impl<const N: usize> Clone for NoséHooverChain<N>
impl<const N: usize> Clone for NoséHooverChain<N>
Source§fn clone(&self) -> NoséHooverChain<N>
fn clone(&self) -> NoséHooverChain<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const N: usize> Debug for NoséHooverChain<N>
impl<const N: usize> Debug for NoséHooverChain<N>
Source§impl<'de, const N: usize> Deserialize<'de> for NoséHooverChain<N>
impl<'de, const N: usize> Deserialize<'de> for NoséHooverChain<N>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<const N: usize> PartialEq for NoséHooverChain<N>
impl<const N: usize> PartialEq for NoséHooverChain<N>
Source§impl<const N: usize> Serialize for NoséHooverChain<N>
impl<const N: usize> Serialize for NoséHooverChain<N>
Source§impl<const N: usize, M> Thermostat<M> for NoséHooverChain<N>where
M: Temperature,
impl<const N: usize, M> Thermostat<M> for NoséHooverChain<N>where
M: Temperature,
impl<const N: usize> StructuralPartialEq for NoséHooverChain<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for NoséHooverChain<N>
impl<const N: usize> RefUnwindSafe for NoséHooverChain<N>
impl<const N: usize> Send for NoséHooverChain<N>
impl<const N: usize> Sync for NoséHooverChain<N>
impl<const N: usize> Unpin for NoséHooverChain<N>
impl<const N: usize> UnsafeUnpin for NoséHooverChain<N>
impl<const N: usize> UnwindSafe for NoséHooverChain<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more