Struct net_ensembles::sampling::WangLandau1T[][src]

pub struct WangLandau1T<Hist, Rng, Ensemble, S, Res, Energy> { /* fields omitted */ }
Expand description

The 1/t Wang Landau approach comes from this paper

R. E. Belardinelli and V. D. Pereyra, “Fast algorithm to calculate density of states,” Phys. Rev. E 75: 046701 (2007), DOI 10.1103/PhysRevE.75.046701

  • The original Wang Landau algorithim comes from this paper

F. Wang and D. P. Landau, “Efficient, multiple-range random walk algorithm to calculate the density of states,” Phys. Rev. Lett. 86, 2050–2053 (2001), DOI 10.1103/PhysRevLett.86.2050

Implementations

Check if self is initialized

  • if this returns true, you can begin the WangLandau simulation
  • otherwise call one of the self.init* methods

Create a new WangLandau simulation

IMPORTANT You have to call one of the init* functions, to create a valid state, before you can start the simulation

Parameter

  • log_f_threshold: how small should the ln(f) (see paper) become until the simulation is finished?
  • ensemble: The ensemble to explore. Current state of ensemble will be used as inital condition for the init* functions
  • step_size: The markov steps will be performed with this step size, e.g., ensemble.m_steps(step_size)
  • histogram: Provides the binning. You can either use one of the already implemented histograms, like HistU32Fast, HistU32, HistF64 etc. or implement your own by implementing the traits Histogram + HistogramVal<Energy> yourself
  • check_refine_every: how often to check, if every bin in the histogram was hit. Needs to be at least 1. Good values depend on the problem at hand, but if you are unsure, you can start with a value like 1000

Find a valid starting Point

  • if the ensemble is already at a valid starting point, the ensemble is left unchanged (as long as your energy calculation does not change the ensemble)
  • Uses a greedy heuristik. Performs markov steps. If that brought us closer to the target interval, the step is accepted. Otherwise it is rejected

Parameter

  • step_limit: Some(val) -> val is max number of steps tried, if no valid state is found, it will return an Error. None -> will loop until either a valid state is found or forever
  • energy_fn function calculating Some(energy) of the system or rather the Parameter of which you wish to obtain the probability distribution. Has to be the same function as used for the wang landau simulation later. If there are any states, for which the calculation is invalid, None should be returned
  • steps resulting in ensembles for which energy_fn(&mut ensemble) is None will always be rejected

Find a valid starting Point

  • if the ensemble is already at a valid starting point, the ensemble is left unchanged (as long as your energy calculation does not change the ensemble)
  • Uses overlapping intervals. Accepts a step, if the resulting ensemble is in the same interval as before, or it is in an interval closer to the target interval
  • Take a look at the HistogramIntervalDistance trait

Parameter

  • step_limit: Some(val) -> val is max number of steps tried, if no valid state is found, it will return an Error. None -> will loop until either a valid state is found or forever
  • energy_fn function calculating Some(energy) of the system or rather the Parameter of which you wish to obtain the probability distribution. Has to be the same function as used for the wang landau simulation later. If there are any states, for which the calculation is invalid, None should be returned
  • steps resulting in ensembles for which energy_fn(&mut ensemble) is None will always be rejected

Find a valid starting Point

  • if the ensemble is already at a valid starting point, the ensemble is left unchanged (as long as your energy calculation does not change the ensemble)
  • overlap - see HistogramIntervalDistance trait Should be greater than 0 and smaller than the number of bins in your histogram. E.g. overlap = 3 if you have 200 bins
  • mid - should be something like 128u8, 0i8 or 0i16. It is very unlikely that using a type with more than 16 bit makes sense for mid
  • step_limit: Some(val) -> val is max number of steps tried, if no valid state is found, it will return an Error. None -> will loop until either a valid state is found or forever
  • alternates between greedy and interval heuristik everytime a wrapping counter passes mid or U::min_value()
  • I recommend using this heuristik, if you do not know which one to use

Parameter

  • energy_fn function calculating Some(energy) of the system or rather the Parameter of which you wish to obtain the probability distribution. Has to be the same function as used for the wang landau simulation later. If there are any states, for which the calculation is invalid, None should be returned
  • steps resulting in ensembles for which energy_fn(&mut ensemble) is None will always be rejected

Wang Landau Step

  • performs a single Wang Landau step

Parameter

  • energy_fn function calculating Some(energy) of the system or rather the Parameter of which you wish to obtain the probability distribution. If there are any states, for which the calculation is invalid, None should be returned
  • steps resulting in ensembles for which energy_fn(&mut ensemble) is None will always be rejected

Important

  • You have to call one of the self.init* functions before calling this one - will panic otherwise

Wang Landau Step

  • if possible, use self.wang_landau_step() instead - it is safer
  • unsafe, because you have to make sure, that the energy_fn function does not change the state of the ensemble in such a way, that the result of energy_fn changes when called again. Maybe do cleanup at the beginning of the energy function?
  • performs a single Wang Landau step

Parameter

  • energy_fn function calculating Some(energy) of the system or rather the Parameter of which you wish to obtain the probability distribution. If there are any states, for which the calculation is invalid, None should be returned
  • steps resulting in ensembles for which energy_fn(&mut ensemble) is None will always be rejected

Important

  • You have to call one of the self.init* functions before calling this one - will panic otherwise

Wang Landau Step

  • performs a single Wang Landau step

Parameter

  • energy_fn function calculating the energy of the system on the fly
  • steps resulting in invalid ensembles are not allowed!

Important

  • You have to call one of the self.init* functions before calling this one - will panic otherwise

Wang Landau

  • perform Wang Landau simulation
  • calls self.wang_landau_step(energy_fn, valid_ensemble) until self.is_finished()

Wang Landau - efficient energy calculation

  • perform Wang Landau simulation
  • calls self.wang_landau_step_acc(energy_fn, valid_ensemble) until self.is_finished()

Wang Landau

  • if possible, use self.wang_landau_convergence() instead - it is safer
  • You have mutable access to your ensemble, which is why this function is unsafe. If you do anything, which changes the future outcome of the energy function, the results will be wrong!
  • perform Wang Landau simulation
  • calls self.wang_landau_step_unsafe(energy_fn, valid_ensemble) until self.is_finished()

Wang Landau

  • perform Wang Landau simulation
  • calls self.wang_landau_step(energy_fn) until self.is_finished() or condition(&self) is false

Wang Landau

  • perform Wang Landau simulation
  • calls self.wang_landau_step(energy_fn) until self.is_finished() or condition(&self) is false

Wang Landau

  • if possible, use self.wang_landau_while() instead - it is safer
  • You have mutable access to your ensemble, which is why this function is unsafe. If you do anything, which changes the future outcome of the energy function, the results will be wrong!
  • perform Wang Landau simulation
  • calls self.wang_landau_step(energy_fn) until self.is_finished() or condition(&self) is false

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

get current value of log_f

returns currently set threshold for log_f

Try to set the threshold. Read more

Current (non normalized) estimate of ln(P(E)) Read more

Writes Information about the simulation to a file. E.g. How many steps were performed. Read more

Returns current wang landau mode Read more

Counter Read more

How many steps were rejected until now? Read more

How many steps were accepted until now? Read more

Checks wang landau threshold Read more

Current (non normalized) estimate of log10(P(E)) Read more

Current (non normalized) estimate of log_base(P(E)) Read more

Counter Read more

Calculate, which fraction of steps were accepted Read more

Calculate, which fraction of steps were rejected Read more

returns the last accepted Energy calculated None if no energy was calculated yet Read more

return reference to current state of ensemble

mutable reference to current state Read more

returns current histogram Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast from Self to T

Try converting from Self to T

Cast to integer, truncating Read more

Cast to the nearest integer Read more

Cast the floor to an integer Read more

Cast the ceiling to an integer Read more

Try converting to integer with truncation Read more

Try converting to the nearest integer Read more

Try converting the floor to an integer Read more

Try convert the ceiling to an integer Read more

Convert from T to Self

Try converting from T to Self

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.