pub trait SimulationStateSynchronous<const D: usize>where
Self: LatticeStateWithEField<D> + Clone,{
// Provided methods
fn simulate_to_leapfrog<I, State>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<State, I::Error>
where State: SimulationStateLeapFrog<D>,
I: SymplecticIntegrator<Self, State, D> + ?Sized { ... }
fn simulate_using_leapfrog_n<I, State>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
where State: SimulationStateLeapFrog<D>,
I: SymplecticIntegrator<Self, State, D> + ?Sized { ... }
fn simulate_using_leapfrog_n_auto<I>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
where I: SymplecticIntegrator<Self, SimulationStateLeap<Self, D>, D> + ?Sized { ... }
fn simulate_sync<I, T>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<Self, I::Error>
where I: SymplecticIntegrator<Self, T, D> + ?Sized,
T: SimulationStateLeapFrog<D> { ... }
fn simulate_sync_n<I, T>(
&self,
integrator: &I,
delta_t: Real,
numbers_of_times: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
where I: SymplecticIntegrator<Self, T, D> + ?Sized,
T: SimulationStateLeapFrog<D> { ... }
fn simulate_symplectic<I, T>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<Self, I::Error>
where I: SymplecticIntegrator<Self, T, D> + ?Sized,
T: SimulationStateLeapFrog<D> { ... }
fn simulate_symplectic_n<I, T>(
&self,
integrator: &I,
delta_t: Real,
numbers_of_times: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
where I: SymplecticIntegrator<Self, T, D> + ?Sized,
T: SimulationStateLeapFrog<D> { ... }
fn simulate_symplectic_n_auto<I>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
where I: SymplecticIntegrator<Self, SimulationStateLeap<Self, D>, D> + ?Sized { ... }
}Expand description
LatticeStateWithEField who represent link matrices at the same time position as
its conjugate momenta
e_field.
If you have a LatticeState and want the default way of adding the conjugate momenta and doing
simulation look at
LatticeStateEFSyncDefault.
I would advice of implementing this trait and not SimulationStateLeapFrog, as there is
a wrapper (SimulationStateLeap) for SimulationStateLeapFrog.
Also not implementing both trait gives you a compile time verification that you did not
considered a leap frog state as a sync one.
Provided Methods§
Sourcefn simulate_to_leapfrog<I, State>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<State, I::Error>
fn simulate_to_leapfrog<I, State>( &self, integrator: &I, delta_t: Real, ) -> Result<State, I::Error>
Sourcefn simulate_using_leapfrog_n<I, State>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_using_leapfrog_n<I, State>( &self, integrator: &I, delta_t: Real, number_of_steps: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Does number_of_steps with delta_t at each step using a leap_frog algorithm by fist
doing half a step and then finishing by doing half step.
§Errors
Return an error if the integration could not be done
or MultiIntegrationError::ZeroIntegration is the number of step is zero.
Sourcefn simulate_using_leapfrog_n_auto<I>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_using_leapfrog_n_auto<I>( &self, integrator: &I, delta_t: Real, number_of_steps: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Does the same thing as SimulationStateSynchronous::simulate_using_leapfrog_n
but use the default wrapper SimulationStateLeap for the leap frog state.
§Errors
Return an error if the integration could not be done.
Sourcefn simulate_sync<I, T>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<Self, I::Error>
fn simulate_sync<I, T>( &self, integrator: &I, delta_t: Real, ) -> Result<Self, I::Error>
Does a simulation step using the sync algorithm
§Errors
Return an error if the integration could not be done.
Sourcefn simulate_sync_n<I, T>(
&self,
integrator: &I,
delta_t: Real,
numbers_of_times: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_sync_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Does numbers_of_times of step of size delta_t using the sync algorithm
§Errors
Return an error if the integration could not be done
or MultiIntegrationError::ZeroIntegration is the number of step is zero.
Sourcefn simulate_symplectic<I, T>(
&self,
integrator: &I,
delta_t: Real,
) -> Result<Self, I::Error>
fn simulate_symplectic<I, T>( &self, integrator: &I, delta_t: Real, ) -> Result<Self, I::Error>
Integrate the state using the symplectic algorithm ( by going to leapfrog and back to sync)
§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,
};
use rand::SeedableRng;
let mut rng = rand::rngs::StdRng::seed_from_u64(0); // change with your seed
let mut 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();
for _ in 0..1 {
// Realistically you would want more steps
state = state.simulate_symplectic(&integrator, 0.000_001_f64)?;
}
let h2 = state.hamiltonian_total();
println!("The error on the Hamiltonian is {}", h - h2);Sourcefn simulate_symplectic_n<I, T>(
&self,
integrator: &I,
delta_t: Real,
numbers_of_times: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_symplectic_n<I, T>( &self, integrator: &I, delta_t: Real, numbers_of_times: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Does numbers_of_times of step of size delta_t using the symplectic algorithm
§Errors
Return an error if the integration could not be done
or MultiIntegrationError::ZeroIntegration is the number of step is zero.
Sourcefn simulate_symplectic_n_auto<I>(
&self,
integrator: &I,
delta_t: Real,
number_of_steps: usize,
) -> Result<Self, MultiIntegrationError<I::Error>>
fn simulate_symplectic_n_auto<I>( &self, integrator: &I, delta_t: Real, number_of_steps: usize, ) -> Result<Self, MultiIntegrationError<I::Error>>
Does the same thing as SimulationStateSynchronous::simulate_symplectic_n
but use the default wrapper SimulationStateLeap for the leap frog state.
§Errors
Return an error if the integration could not be done.
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.
Implementors§
impl<State, const D: usize> SimulationStateSynchronous<D> for LatticeStateEFSyncDefault<State, D>
This is an sync State