# Trait lattice_qcd_rs::simulation::state::LatticeStateWithEField

pub trait LatticeStateWithEField<const D: usize>: LatticeState<D> {
fn e_field(&self) -> &EField<D>;
fn set_e_field(&mut self, e_field: EField<D>);
fn t(&self) -> usize;
fn hamiltonian_efield(&self) -> Real;

fn reset_e_field<Rng>(        &mut self,         rng: &mut Rng    ) -> Result<(), StateInitializationError>    where        Rng: Rng + ?Sized,
{ ... }
fn hamiltonian_total(&self) -> Real { ... }
}
Expand description

Represent a lattice state where the conjugate momenta of the link matrices are included.

If you have a LatticeState and want the default way of adding the conjugate momenta look at LatticeStateEFSyncDefault.

If you want to solve the equation of motion using an SymplecticIntegrator also implement SimulationStateSynchronous and the wrapper SimulationStateLeap can give you an SimulationStateLeapFrog.

It is used for the super::monte_carlo::HybridMonteCarlo algorithm.

## Required methods

The “Electrical” field of this state.

Replace the electrical field with the given input. It should panic if the input is not of the correct size.

##### Panic

Panic if the length of link_matrix is different from lattice.get_number_of_points()

return the time state, i.e. the number of time the simulation ran.

Get the derivative \partial_t U(link), returns None if the link is outside of the lattice.

It is used in order to apply the equation of motion.

Get the derivative \partial_t E(point), returns None if the link is outside of the lattice.

It is used in order to apply the equation of motion.

Get the energy of the conjugate momenta configuration

## Provided methods

Reset the e_field with radom value distributed as N(0, 1 / beta) rand_distr::StandardNormal.

##### Errors

Gives and error if N(0, 0.5/beta ) is not a valid distribution (for example beta = 0).

Gives StateInitializationError::GaussProjectionError if the Gauss projection failed

## Implementors

We just transmit the function of State, there is nothing new.