Struct lattice_qcd_rs::simulation::state::LatticeStateEFSyncDefault
source · pub struct LatticeStateEFSyncDefault<State, const D: usize>where
State: LatticeState<D> + ?Sized,{ /* private fields */ }
Expand description
wrapper to implement LatticeStateWithEField
from a LatticeState
using
the default implementation of conjugate momenta.
It also implement SimulationStateSynchronous
.
Implementations§
source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized,
sourcepub fn state_owned(self) -> Statewhere
State: Sized,
pub fn state_owned(self) -> Statewhere State: Sized,
Absorbs self and return the state as owned. It essentially deconstruct the structure.
sourcepub const fn lattice_state(&self) -> &State
pub const fn lattice_state(&self) -> &State
Get a reference to the state.
sourcepub fn lattice_state_mut(&mut self) -> &mut State
pub fn lattice_state_mut(&mut self) -> &mut State
Get a mutable reference to the state.
sourcepub fn new_random_e_state(lattice_state: State, rng: &mut impl Rng) -> Selfwhere
State: Sized,
pub fn new_random_e_state(lattice_state: State, rng: &mut impl Rng) -> Selfwhere State: Sized,
Take a state and generate a new random one and try projecting it to the Gauss law.
Panic
Panics if N(0, 0.5/beta ) is not a valid distribution (for example beta = 0). Panics if the field could not be projected to the Gauss law.
sourcepub fn new_e_cold(lattice_state: State) -> Selfwhere
State: Sized,
pub fn new_e_cold(lattice_state: State) -> Selfwhere State: Sized,
Create a new Self from a state and a cold configuration of the e field (i.e. set to 0)
sourcepub fn e_field_mut(&mut self) -> &mut EField<D>
pub fn e_field_mut(&mut self) -> &mut EField<D>
Get a mutable reference to the efield
source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
Self: LatticeStateWithEField<D>,
State: LatticeState<D> + ?Sized,
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where Self: LatticeStateWithEField<D>, State: LatticeState<D> + ?Sized,
sourcepub fn gauss(&self, point: &LatticePoint<D>) -> Option<CMatrix3>
pub fn gauss(&self, point: &LatticePoint<D>) -> Option<CMatrix3>
Get the gauss coefficient G(x) = \sum_i E_i(x) - U_{-i}(x) E_i(x - i) U^\dagger_{-i}(x)
.
source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
Self: LatticeStateWithEFieldNew<D>,
<Self as LatticeStateWithEFieldNew<D>>::Error: From<LatticeInitializationError>,
State: LatticeState<D>,
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where Self: LatticeStateWithEFieldNew<D>, <Self as LatticeStateWithEFieldNew<D>>::Error: From<LatticeInitializationError>, State: LatticeState<D>,
sourcepub fn new_determinist<R>(
size: Real,
beta: Real,
number_of_points: usize,
rng: &mut R,
d: &impl Distribution<Real>
) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>where
R: Rng + ?Sized,
pub fn new_determinist<R>( size: Real, beta: Real, number_of_points: usize, rng: &mut R, d: &impl Distribution<Real> ) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>where R: Rng + ?Sized,
Generate a hot (i.e. random) initial state.
Single threaded generation with a given random number generator.
size
is the size parameter of the lattice and number_of_points
is the number of points
in each spatial dimension of the lattice. See LatticeCyclic::new
for more info.
useful to reproduce a set of data but slower than
LatticeStateEFSyncDefault::new_random_threaded
.
Errors
Return StateInitializationError::LatticeInitializationError
if the parameter is invalid
for LatticeCyclic
.
Or propagates the error form Self::new
.
Example
use rand::{SeedableRng,rngs::StdRng};
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
let distribution = rand::distributions::Uniform::from(-1_f64..1_f64);
assert_eq!(
LatticeStateEFSyncDefault::<LatticeStateDefault<4>, 4>::new_determinist(1_f64, 1_f64, 4, &mut rng_1, &distribution).unwrap(),
LatticeStateEFSyncDefault::<LatticeStateDefault<4>, 4>::new_determinist(1_f64, 1_f64, 4, &mut rng_2, &distribution).unwrap()
);
sourcepub fn new_determinist_cold_e_hot_link<R>(
size: Real,
beta: Real,
number_of_points: usize,
rng: &mut R
) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>where
R: Rng + ?Sized,
pub fn new_determinist_cold_e_hot_link<R>( size: Real, beta: Real, number_of_points: usize, rng: &mut R ) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>where R: Rng + ?Sized,
Generate a configuration with cold e_field and hot link matrices
Errors
Return StateInitializationError::LatticeInitializationError
if the parameter is invalid
for LatticeCyclic
.
Or propagates the error form Self::new
.
sourcepub fn new_cold(
size: Real,
beta: Real,
number_of_points: usize
) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
pub fn new_cold( size: Real, beta: Real, number_of_points: usize ) -> Result<Self, <Self as LatticeStateWithEFieldNew<D>>::Error>
Generate a new cold state.
It meas that the link matrices are set to the identity and electrical field are set to 0.
Errors
Return StateInitializationError::LatticeInitializationError
if the parameter is invalid
for LatticeCyclic
.
Or propagates the error form Self::new
.
source§impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where
Self: LatticeStateWithEFieldNew<D, Error = StateInitializationError>,
State: LatticeState<D>,
impl<State, const D: usize> LatticeStateEFSyncDefault<State, D>where Self: LatticeStateWithEFieldNew<D, Error = StateInitializationError>, State: LatticeState<D>,
sourcepub fn new_random_threaded<Distribution>(
size: Real,
beta: Real,
number_of_points: usize,
d: &Distribution,
number_of_thread: usize
) -> Result<Self, ThreadedStateInitializationError>where
Distribution: Distribution<Real> + Sync,
pub fn new_random_threaded<Distribution>( size: Real, beta: Real, number_of_points: usize, d: &Distribution, number_of_thread: usize ) -> Result<Self, ThreadedStateInitializationError>where Distribution: Distribution<Real> + Sync,
Generate a hot (i.e. random) initial state.
Multi threaded generation of random data. Due to the non deterministic way threads
operate a set cannot be reproduce easily, In that case use
LatticeStateEFSyncDefault::new_determinist
.
Errors
Return StateInitializationError::LatticeInitializationError
if the parameter is invalid
for LatticeCyclic
.
Return ThreadError::ThreadNumberIncorrect
if number_of_points = 0
.
Returns an error if a thread panicked. Finally, propagates the error form Self::new
.
Trait Implementations§
source§impl<State, const D: usize> Clone for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized + Clone,
impl<State, const D: usize> Clone for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Clone,
source§fn clone(&self) -> LatticeStateEFSyncDefault<State, D>
fn clone(&self) -> LatticeStateEFSyncDefault<State, D>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<State, const D: usize> Debug for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized + Debug,
impl<State, const D: usize> Debug for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Debug,
source§impl<'de, State, const D: usize> Deserialize<'de> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized + Deserialize<'de>,
SVector<Su3Adjoint, D>: Deserialize<'de>,
impl<'de, State, const D: usize> Deserialize<'de> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Deserialize<'de>, SVector<Su3Adjoint, D>: 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, const D: usize> LatticeState<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized,
impl<State, const D: usize> LatticeState<D> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized,
source§fn set_link_matrix(&mut self, link_matrix: LinkMatrix)
fn set_link_matrix(&mut self, link_matrix: LinkMatrix)
Panic
panic under the same condition as State::set_link_matrix
source§fn link_matrix(&self) -> &LinkMatrix
fn link_matrix(&self) -> &LinkMatrix
source§fn lattice(&self) -> &LatticeCyclic<D>
fn lattice(&self) -> &LatticeCyclic<D>
source§fn hamiltonian_links(&self) -> Real
fn hamiltonian_links(&self) -> Real
source§impl<const D: usize> LatticeStateWithEField<D> for LatticeStateEFSyncDefault<LatticeStateDefault<D>, D>where
Direction<D>: DirectionList,
impl<const D: usize> LatticeStateWithEField<D> for LatticeStateEFSyncDefault<LatticeStateDefault<D>, D>where Direction<D>: DirectionList,
source§fn hamiltonian_efield(&self) -> Real
fn hamiltonian_efield(&self) -> Real
By default \sum_x Tr(E_i E_i)
source§fn set_e_field(&mut self, e_field: EField<D>)
fn set_e_field(&mut self, e_field: EField<D>)
Panic
Panic if the length of link_matrix is different from lattice.get_number_of_points()
source§fn derivative_u(
link: &LatticeLinkCanonical<D>,
link_matrix: &LinkMatrix,
e_field: &EField<D>,
lattice: &LatticeCyclic<D>
) -> Option<CMatrix3>
fn derivative_u( link: &LatticeLinkCanonical<D>, link_matrix: &LinkMatrix, e_field: &EField<D>, lattice: &LatticeCyclic<D> ) -> Option<CMatrix3>
Get the derive of U_i(x).
source§fn derivative_e(
point: &LatticePoint<D>,
link_matrix: &LinkMatrix,
_e_field: &EField<D>,
lattice: &LatticeCyclic<D>
) -> Option<SVector<Su3Adjoint, D>>
fn derivative_e( point: &LatticePoint<D>, link_matrix: &LinkMatrix, _e_field: &EField<D>, lattice: &LatticeCyclic<D> ) -> Option<SVector<Su3Adjoint, D>>
Get the derive of E(x) (as a vector of Su3Adjoint).
source§fn reset_e_field<Rng>(
&mut self,
rng: &mut Rng
) -> Result<(), StateInitializationError>where
Rng: Rng + ?Sized,
fn reset_e_field<Rng>( &mut self, rng: &mut Rng ) -> Result<(), StateInitializationError>where Rng: Rng + ?Sized,
rand_distr::StandardNormal
. Read moresource§fn hamiltonian_total(&self) -> Real
fn hamiltonian_total(&self) -> Real
LatticeStateWithEField::hamiltonian_efield
Read moresource§impl<State, const D: usize> LatticeStateWithEFieldNew<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + LatticeStateNew<D>,
Self: LatticeStateWithEField<D>,
StateInitializationError: Into<State::Error>,
State::Error: From<NormalError>,
impl<State, const D: usize> LatticeStateWithEFieldNew<D> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + LatticeStateNew<D>, Self: LatticeStateWithEField<D>, StateInitializationError: Into<State::Error>, State::Error: From<NormalError>,
source§fn new(
lattice: LatticeCyclic<D>,
beta: Real,
e_field: EField<D>,
link_matrix: LinkMatrix,
t: usize
) -> Result<Self, Self::Error>
fn new( lattice: LatticeCyclic<D>, beta: Real, e_field: EField<D>, link_matrix: LinkMatrix, t: usize ) -> Result<Self, Self::Error>
create a new simulation state. If e_field
or link_matrix
does not have the corresponding
amount of data compared to lattice it fails to create the state.
t
is the number of time the simulation ran. i.e. the time sate.
§type Error = <State as LatticeStateNew<D>>::Error
type Error = <State as LatticeStateNew<D>>::Error
source§fn new_random_e<R>(
lattice: LatticeCyclic<D>,
beta: Real,
link_matrix: LinkMatrix,
rng: &mut R
) -> Result<Self, Self::Error>where
R: Rng + ?Sized,
fn new_random_e<R>( lattice: LatticeCyclic<D>, beta: Real, link_matrix: LinkMatrix, rng: &mut R ) -> Result<Self, Self::Error>where R: Rng + ?Sized,
rand_distr::Normal
^. Read moresource§impl<State, const D: usize> PartialEq<LatticeStateEFSyncDefault<State, D>> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized + PartialEq,
impl<State, const D: usize> PartialEq<LatticeStateEFSyncDefault<State, D>> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + PartialEq,
source§fn eq(&self, other: &LatticeStateEFSyncDefault<State, D>) -> bool
fn eq(&self, other: &LatticeStateEFSyncDefault<State, D>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<State, const D: usize> Serialize for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + ?Sized + Serialize,
SVector<Su3Adjoint, D>: Serialize,
impl<State, const D: usize> Serialize for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized + Serialize, SVector<Su3Adjoint, D>: Serialize,
source§impl<State, const D: usize> SimulationStateSynchronous<D> for LatticeStateEFSyncDefault<State, D>where
State: LatticeState<D> + Clone + ?Sized,
Self: LatticeStateWithEField<D>,
impl<State, const D: usize> SimulationStateSynchronous<D> for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + Clone + ?Sized, Self: LatticeStateWithEField<D>,
This is an sync State
source§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_to_leapfrog<I, State>( &self, integrator: &I, delta_t: Real ) -> Result<State, I::Error>where State: SimulationStateLeapFrog<D>, I: SymplecticIntegrator<Self, State, D> + ?Sized,
source§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<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,
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. Read moresource§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_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,
SimulationStateSynchronous::simulate_using_leapfrog_n
but use the default wrapper SimulationStateLeap
for the leap frog state. Read moresource§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<I, T>( &self, integrator: &I, delta_t: Real ) -> Result<Self, I::Error>where I: SymplecticIntegrator<Self, T, D> + ?Sized, T: SimulationStateLeapFrog<D>,
source§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_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>,
source§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<I, T>( &self, integrator: &I, delta_t: Real ) -> Result<Self, I::Error>where I: SymplecticIntegrator<Self, T, D> + ?Sized, T: SimulationStateLeapFrog<D>,
source§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<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>,
source§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,
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,
SimulationStateSynchronous::simulate_symplectic_n
but use the default wrapper SimulationStateLeap
for the leap frog state. Read moreimpl<State, const D: usize> StructuralPartialEq for LatticeStateEFSyncDefault<State, D>where State: LatticeState<D> + ?Sized,
Auto Trait Implementations§
impl<State: ?Sized, const D: usize> RefUnwindSafe for LatticeStateEFSyncDefault<State, D>where State: RefUnwindSafe,
impl<State: ?Sized, const D: usize> Send for LatticeStateEFSyncDefault<State, D>where State: Send,
impl<State: ?Sized, const D: usize> Sync for LatticeStateEFSyncDefault<State, D>where State: Sync,
impl<State: ?Sized, const D: usize> Unpin for LatticeStateEFSyncDefault<State, D>where State: Unpin,
impl<State: ?Sized, const D: usize> UnwindSafe for LatticeStateEFSyncDefault<State, D>where 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.