pub trait SimulationStateLeapFrog<const D: usize>where
    Self: LatticeStateWithEField<D>,{
    // Provided methods
    fn simulate_to_synchronous<I, State>(
        &self,
        integrator: &I,
        delta_t: Real
    ) -> Result<State, I::Error>
       where Self: Sized,
             State: SimulationStateSynchronous<D> + ?Sized,
             I: SymplecticIntegrator<State, Self, D> + ?Sized { ... }
    fn simulate_leap<I, T>(
        &self,
        integrator: &I,
        delta_t: Real
    ) -> Result<Self, I::Error>
       where Self: Sized,
             I: SymplecticIntegrator<T, Self, D> + ?Sized,
             T: SimulationStateSynchronous<D> + ?Sized { ... }
    fn simulate_leap_n<I, T>(
        &self,
        integrator: &I,
        delta_t: Real,
        numbers_of_times: usize
    ) -> Result<Self, MultiIntegrationError<I::Error>>
       where Self: Sized,
             I: SymplecticIntegrator<T, Self, D> + ?Sized,
             T: SimulationStateSynchronous<D> + ?Sized { ... }
}
Expand description

LatticeStateWithEField who represent link matrices at time T and its conjugate momenta at time T + 1/2.

If you have a SimulationStateSynchronous look at the wrapper SimulationStateLeap.

Provided Methods§

source

fn simulate_to_synchronous<I, State>( &self, integrator: &I, delta_t: Real ) -> Result<State, I::Error>where Self: Sized, State: SimulationStateSynchronous<D> + ?Sized, I: SymplecticIntegrator<State, Self, D> + ?Sized,

Simulate the state to synchronous by finishing the half step.

Errors

Return an error if the integration could not be done.

Example

see SimulationStateLeapFrog::simulate_leap

source

fn simulate_leap<I, T>( &self, integrator: &I, delta_t: Real ) -> Result<Self, I::Error>where Self: Sized, I: SymplecticIntegrator<T, Self, D> + ?Sized, T: SimulationStateSynchronous<D> + ?Sized,

Does one simulation step using the leap frog algorithm.

Errors

Return an error if the integration could not be done.

Example
use lattice_qcd_rs::integrator::{SymplecticEulerRayon, SymplecticIntegrator};
use lattice_qcd_rs::simulation::{
   LatticeStateDefault, LatticeStateEFSyncDefault, LatticeStateWithEField, SimulationStateSynchronous, SimulationStateLeapFrog,
};
use rand::SeedableRng;

let mut rng = rand::rngs::StdRng::seed_from_u64(0); // change with your seed
let state = LatticeStateEFSyncDefault::new_random_e_state(
   LatticeStateDefault::<3>::new_determinist(1_f64, 2_f64, 4, &mut rng)?,
   &mut rng,
);
let h = state.hamiltonian_total();
let integrator = SymplecticEulerRayon::default();
let mut leap_frog = state.simulate_to_leapfrog(&integrator,0.000_001_f64)?;
drop(state);
for _ in 0..2 {
   // Realistically you would want more steps
   leap_frog = leap_frog.simulate_leap(&integrator, 0.000_001_f64)?;
}
let state = leap_frog.simulate_to_synchronous(&integrator, 0.000_001_f64)?;
let h2 = state.hamiltonian_total();

println!("The error on the Hamiltonian is {}", h - h2);
source

fn simulate_leap_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize ) -> Result<Self, MultiIntegrationError<I::Error>>where Self: Sized, I: SymplecticIntegrator<T, Self, D> + ?Sized, T: SimulationStateSynchronous<D> + ?Sized,

does numbers_of_times simulation set of size delta_t using the leap frog algorithm.

Errors

Return an error if the integration could not be done or MultiIntegrationError::ZeroIntegration is the number of step is zero.

Example

/// # Example

use lattice_qcd_rs::integrator::{SymplecticEulerRayon, SymplecticIntegrator};
use lattice_qcd_rs::simulation::{
   LatticeStateDefault, LatticeStateEFSyncDefault, LatticeStateWithEField, SimulationStateSynchronous, SimulationStateLeapFrog,
};
use rand::SeedableRng;

let mut rng = rand::rngs::StdRng::seed_from_u64(0); // change with your seed
let state = LatticeStateEFSyncDefault::new_random_e_state(
   LatticeStateDefault::<3>::new_determinist(1_f64, 2_f64, 4, &mut rng)?,
   &mut rng,
);
let h = state.hamiltonian_total();
let integrator = SymplecticEulerRayon::default();
let mut leap_frog = state.simulate_to_leapfrog(&integrator,0.000_001_f64)?;
drop(state);

// Realistically you would want more steps
leap_frog = leap_frog.simulate_leap_n(&integrator, 0.000_001_f64, 10)?;

let state = leap_frog.simulate_to_synchronous(&integrator, 0.000_001_f64)?;
let h2 = state.hamiltonian_total();

println!("The error on the Hamiltonian is {}", h - h2);

Implementors§

source§

impl<State, const D: usize> SimulationStateLeapFrog<D> for SimulationStateLeap<State, D>where State: SimulationStateSynchronous<D> + LatticeStateWithEField<D> + ?Sized,

This state is a leap frog state