pub struct LatticeStateDefault<const D: usize> { /* private fields */ }Expand description
Represent a simulation state at a set time.
It has the default pure gauge hamiltonian
Implementations§
Source§impl<const D: usize> LatticeStateDefault<D>
impl<const D: usize> LatticeStateDefault<D>
Sourcepub fn new_cold(
size: Real,
beta: Real,
number_of_points: usize,
) -> Result<Self, StateInitializationError>
pub fn new_cold( size: Real, beta: Real, number_of_points: usize, ) -> Result<Self, StateInitializationError>
Create a cold configuration. i.e. all the links are set to the unit matrix.
With the lattice of size size and dimension number_of_points ( see LatticeCyclic::new )
and beta parameter beta.
§Errors
Returns StateInitializationError::LatticeInitializationError if the parameter is invalid
for LatticeCyclic.
Or propagate the error form Self::new.
Sourcepub fn new_determinist(
size: Real,
beta: Real,
number_of_points: usize,
rng: &mut impl Rng,
) -> Result<Self, StateInitializationError>
pub fn new_determinist( size: Real, beta: Real, number_of_points: usize, rng: &mut impl Rng, ) -> Result<Self, StateInitializationError>
Create a “hot” configuration, i.e. the link matrices are chosen randomly.
With the lattice of size size and dimension number_of_points ( see LatticeCyclic::new )
and beta parameter beta.
The creation is determinists meaning that it is reproducible:
§Errors
Returns StateInitializationError::LatticeInitializationError if the parameter is invalid for LatticeCyclic.
Or propagate the error form Self::new.
§Example
This example demonstrate how to reproduce the same configuration
use rand::{rngs::StdRng, SeedableRng};
let mut rng_1 = StdRng::seed_from_u64(0);
let mut rng_2 = StdRng::seed_from_u64(0);
// They have the same seed and should generate the same numbers
assert_eq!(
LatticeStateDefault::<4>::new_determinist(1_f64, 1_f64, 4, &mut rng_1).unwrap(),
LatticeStateDefault::<4>::new_determinist(1_f64, 1_f64, 4, &mut rng_2).unwrap()
);Sourcepub fn normalize_link_matrices(&mut self)
pub fn normalize_link_matrices(&mut self)
Correct the numerical drift, reprojecting all the link matrices to SU(3).
see LinkMatrix::normalize.
§Example
use lattice_qcd_rs::error::ImplementationError;
use lattice_qcd_rs::prelude::*;
use rand::SeedableRng;
let mut rng = rand::rngs::StdRng::seed_from_u64(0); // change with your seed
let size = 1_f64;
let number_of_pts = 3;
let beta = 1_f64;
let mut simulation =
LatticeStateDefault::<4>::new_determinist(size, beta, number_of_pts, &mut rng)?;
let spread_parameter = 0.1_f64;
let mut mc = MetropolisHastingsSweep::new(1, spread_parameter, rng)
.ok_or(ImplementationError::OptionWithUnexpectedNone)?;
for _ in 0..2 {
for _ in 0..10 {
simulation = simulation.monte_carlo_step(&mut mc)?;
}
// the more we advance te more the link matrices
// will deviate form SU(3), so we reproject to SU(3)
// every 10 steps.
simulation.normalize_link_matrices();
}Sourcepub fn link_mut(
&mut self,
link: &LatticeLinkCanonical<D>,
) -> Option<&mut CMatrix3>
pub fn link_mut( &mut self, link: &LatticeLinkCanonical<D>, ) -> Option<&mut CMatrix3>
Get a mutable reference to the link matrix at link
Sourcepub fn link_matrix_owned(self) -> LinkMatrix
pub fn link_matrix_owned(self) -> LinkMatrix
Absorbs self anf return the link_matrix as owned
Trait Implementations§
Source§impl<const D: usize> Clone for LatticeStateDefault<D>
impl<const D: usize> Clone for LatticeStateDefault<D>
Source§fn clone(&self) -> LatticeStateDefault<D>
fn clone(&self) -> LatticeStateDefault<D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const D: usize> Debug for LatticeStateDefault<D>
impl<const D: usize> Debug for LatticeStateDefault<D>
Source§impl<'de, const D: usize> Deserialize<'de> for LatticeStateDefault<D>
impl<'de, const D: usize> Deserialize<'de> for LatticeStateDefault<D>
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 D: usize> LatticeState<D> for LatticeStateDefault<D>
impl<const D: usize> LatticeState<D> for LatticeStateDefault<D>
Source§fn link_matrix(&self) -> &LinkMatrix
fn link_matrix(&self) -> &LinkMatrix
The link matrices of this state.
Source§fn set_link_matrix(&mut self, link_matrix: LinkMatrix)
fn set_link_matrix(&mut self, link_matrix: LinkMatrix)
§Panic
Panic if the length of link_matrix is different from lattice.get_number_of_canonical_links_space()
Source§fn hamiltonian_links(&self) -> Real
fn hamiltonian_links(&self) -> Real
Source§fn lattice(&self) -> &LatticeCyclic<D>
fn lattice(&self) -> &LatticeCyclic<D>
Source§impl<const D: usize> LatticeStateNew<D> for LatticeStateDefault<D>
impl<const D: usize> LatticeStateNew<D> for LatticeStateDefault<D>
Source§type Error = StateInitializationError
type Error = StateInitializationError
Source§fn new(
lattice: LatticeCyclic<D>,
beta: Real,
link_matrix: LinkMatrix,
) -> Result<Self, Self::Error>
fn new( lattice: LatticeCyclic<D>, beta: Real, link_matrix: LinkMatrix, ) -> Result<Self, Self::Error>
Source§impl<Rng, const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for HeatBathSweep<Rng>where
Rng: Rng,
impl<Rng, const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for HeatBathSweep<Rng>where
Rng: Rng,
Source§fn next_element(
&mut self,
state: LatticeStateDefault<D>,
) -> Result<LatticeStateDefault<D>, Self::Error>
fn next_element( &mut self, state: LatticeStateDefault<D>, ) -> Result<LatticeStateDefault<D>, Self::Error>
Source§impl<Rng, const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for MetropolisHastingsDeltaDiagnostic<Rng>where
Rng: Rng,
impl<Rng, const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for MetropolisHastingsDeltaDiagnostic<Rng>where
Rng: Rng,
Source§fn next_element(
&mut self,
state: LatticeStateDefault<D>,
) -> Result<LatticeStateDefault<D>, Self::Error>
fn next_element( &mut self, state: LatticeStateDefault<D>, ) -> Result<LatticeStateDefault<D>, Self::Error>
Source§impl<Rng, const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for MetropolisHastingsSweep<Rng>where
Rng: Rng,
impl<Rng, const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for MetropolisHastingsSweep<Rng>where
Rng: Rng,
Source§fn next_element(
&mut self,
state: LatticeStateDefault<D>,
) -> Result<LatticeStateDefault<D>, Self::Error>
fn next_element( &mut self, state: LatticeStateDefault<D>, ) -> Result<LatticeStateDefault<D>, Self::Error>
Source§impl<const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for OverrelaxationSweepReverse
impl<const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for OverrelaxationSweepReverse
Source§fn next_element(
&mut self,
state: LatticeStateDefault<D>,
) -> Result<LatticeStateDefault<D>, Self::Error>
fn next_element( &mut self, state: LatticeStateDefault<D>, ) -> Result<LatticeStateDefault<D>, Self::Error>
Source§impl<const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for OverrelaxationSweepRotation
impl<const D: usize> MonteCarlo<LatticeStateDefault<D>, D> for OverrelaxationSweepRotation
Source§fn next_element(
&mut self,
state: LatticeStateDefault<D>,
) -> Result<LatticeStateDefault<D>, Self::Error>
fn next_element( &mut self, state: LatticeStateDefault<D>, ) -> Result<LatticeStateDefault<D>, Self::Error>
Source§impl<const D: usize> PartialEq for LatticeStateDefault<D>
impl<const D: usize> PartialEq for LatticeStateDefault<D>
Source§impl<const D: usize> Serialize for LatticeStateDefault<D>
impl<const D: usize> Serialize for LatticeStateDefault<D>
impl<const D: usize> StructuralPartialEq for LatticeStateDefault<D>
Auto Trait Implementations§
impl<const D: usize> Freeze for LatticeStateDefault<D>
impl<const D: usize> RefUnwindSafe for LatticeStateDefault<D>
impl<const D: usize> Send for LatticeStateDefault<D>
impl<const D: usize> Sync for LatticeStateDefault<D>
impl<const D: usize> Unpin for LatticeStateDefault<D>
impl<const D: usize> UnwindSafe for LatticeStateDefault<D>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.