Struct lattice_qcd_rs::simulation::monte_carlo::hybrid_monte_carlo::HybridMonteCarloDiagnostic
source · pub struct HybridMonteCarloDiagnostic<State, Rng, I, const D: usize>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,{ /* private fields */ }
Expand description
Hybrid Monte Carlo algorithm ( HCM for short) with diagnostics.
The idea of HCM is to generate a random set on conjugate momenta to the link matrices.
This conjugated momenta is also refed as the “Electric” field
or e_field
with distribution N(0, 1 / beta). And to solve the equation of motion.
The new state is accepted with probability Exp( -H_old + H_new) where the Hamiltonian has an extra term Tr(E_i ^ 2).
The advantage is that the simulation can be done in a symplectic way i.e. it conserved the Hamiltonian.
Which means that the method has a high acceptance rate.
Example
See the the level module documentation.
Implementations§
source§impl<State, Rng, I, const D: usize> HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
sourcepub const fn integrator(&self) -> &I
pub const fn integrator(&self) -> &I
Get the integrator.
sourcepub fn integrator_mut(&mut self) -> &mut I
pub fn integrator_mut(&mut self) -> &mut I
Get a mut ref to the integrator.
sourcepub const fn number_of_steps(&self) -> usize
pub const fn number_of_steps(&self) -> usize
Get the number of steps.
sourcepub const fn new(
delta_t: Real,
number_of_steps: usize,
integrator: I,
rng: Rng
) -> Self
pub const fn new( delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng ) -> Self
gives the following parameter for the HCM :
- delta_t is the step size per integration of the equation of motion
- number_of_steps is the number of time
- integrator is the method to solve the equation of motion
- rng, a random number generator
sourcepub const fn prob_replace_last(&self) -> Real
pub const fn prob_replace_last(&self) -> Real
Get the last probably of acceptance of the random change.
sourcepub const fn has_replace_last(&self) -> bool
pub const fn has_replace_last(&self) -> bool
Get if last step has accepted the replacement.
Trait Implementations§
source§impl<State, Rng, I, const D: usize> AsMut<Rng> for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> AsMut<Rng> for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
source§impl<State, Rng, I, const D: usize> AsRef<Rng> for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> AsRef<Rng> for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
source§impl<State, Rng, I, const D: usize> Clone for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Clone,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Clone,
Rng: Rng + Clone,
impl<State, Rng, I, const D: usize> Clone for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Clone, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Clone, Rng: Rng + Clone,
source§fn clone(&self) -> HybridMonteCarloDiagnostic<State, Rng, I, D>
fn clone(&self) -> HybridMonteCarloDiagnostic<State, Rng, I, D>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<State, Rng, I, const D: usize> Debug for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Debug,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Debug,
Rng: Rng + Debug,
impl<State, Rng, I, const D: usize> Debug for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Debug, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Debug, Rng: Rng + Debug,
source§impl<'de, State, Rng, I, const D: usize> Deserialize<'de> for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Deserialize<'de>,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Deserialize<'de>,
Rng: Rng + Deserialize<'de>,
impl<'de, State, Rng, I, const D: usize> Deserialize<'de> for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Deserialize<'de>, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Deserialize<'de>, Rng: Rng + Deserialize<'de>,
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<State, Rng, I, const D: usize> MonteCarlo<State, D> for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>,
Rng: Rng,
impl<State, Rng, I, const D: usize> MonteCarlo<State, D> for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
§type Error = MultiIntegrationError<<I as SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>>::Error>
type Error = MultiIntegrationError<<I as SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>>::Error>
source§impl<State, Rng, I, const D: usize> PartialEq<HybridMonteCarloDiagnostic<State, Rng, I, D>> for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + PartialEq,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + PartialEq,
Rng: Rng + PartialEq,
impl<State, Rng, I, const D: usize> PartialEq<HybridMonteCarloDiagnostic<State, Rng, I, D>> for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + PartialEq, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + PartialEq, Rng: Rng + PartialEq,
source§fn eq(&self, other: &HybridMonteCarloDiagnostic<State, Rng, I, D>) -> bool
fn eq(&self, other: &HybridMonteCarloDiagnostic<State, Rng, I, D>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<State, Rng, I, const D: usize> Serialize for HybridMonteCarloDiagnostic<State, Rng, I, D>where
State: LatticeState<D> + Clone + ?Sized + Serialize,
LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>,
I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Serialize,
Rng: Rng + Serialize,
impl<State, Rng, I, const D: usize> Serialize for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized + Serialize, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D> + Serialize, Rng: Rng + Serialize,
impl<State, Rng, I, const D: usize> StructuralPartialEq for HybridMonteCarloDiagnostic<State, Rng, I, D>where State: LatticeState<D> + Clone + ?Sized, LatticeStateEFSyncDefault<State, D>: SimulationStateSynchronous<D>, I: SymplecticIntegrator<LatticeStateEFSyncDefault<State, D>, SimulationStateLeap<LatticeStateEFSyncDefault<State, D>, D>, D>, Rng: Rng,
Auto Trait Implementations§
impl<State, Rng, I, const D: usize> RefUnwindSafe for HybridMonteCarloDiagnostic<State, Rng, I, D>where I: RefUnwindSafe, Rng: RefUnwindSafe, State: RefUnwindSafe,
impl<State, Rng, I, const D: usize> Send for HybridMonteCarloDiagnostic<State, Rng, I, D>where I: Send, Rng: Send, State: Send,
impl<State, Rng, I, const D: usize> Sync for HybridMonteCarloDiagnostic<State, Rng, I, D>where I: Sync, Rng: Sync, State: Sync,
impl<State, Rng, I, const D: usize> Unpin for HybridMonteCarloDiagnostic<State, Rng, I, D>where I: Unpin, Rng: Unpin, State: Unpin,
impl<State, Rng, I, const D: usize> UnwindSafe for HybridMonteCarloDiagnostic<State, Rng, I, D>where I: UnwindSafe, Rng: UnwindSafe, State: UnwindSafe,
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.