Type Definition sampling::rewl::Rewl

source · []
pub type Rewl<Ensemble, R, Hist, Energy, S, Res> = ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>;
Expand description

Short for ReplicaExchangeWangLandau, which you can look at for citations

Implementations

Read access to internal rewl walkers
  • each of these walkers independently samples an interval.
  • see paper for more infos
Iterator over ensembles

If you do not know what RwLockReadGuard<'a, Ensemble> is - do not worry. you can just pretend it is &Ensemble and everything should work out fine, since it implements Deref. Of cause, you can also take a look at RwLockReadGuard

read access to your ensembles
  • None if index out of range
  • If you do not know what RwLockReadGuard<Ensemble> is - do not worry. you can just pretend it is &Ensemble and everything will work out fine, since it implements Deref. Of cause, you can also take a look at RwLockReadGuard
Mutable iterator over ensembles
Safety
  • it is assumed, that whatever you change has no effect on the Markov Chain, the result of the energy function etc.
  • might panic if a thread is poisened
mut access to your ensembles
  • if possible, prefer get_ensemble
  • None if index out of range
Safety
  • it is assumed, that whatever you change has no effect on the Markov Chain, the result of the energy function etc.
  • might panic if a thread is poisened

Returns number of walkers per interval

Change step size for markov chain of walkers
  • changes the step size used in the sweep
  • changes step size of all walkers in the nth interval
  • returns Err if index out of bounds, i.e., the requested interval does not exist
  • interval counting starts at 0, i.e., n=0 is the first interval
Get step size for markov chain of walkers
  • returns None if index out of bounds, i.e., the requested interval does not exist
  • interval counting starts at 0, i.e., n=0 is the first interval
Change sweep size for markov chain of walkers
  • changes the sweep size used in the sweep
  • changes sweep size of all walkers in the nth interval
  • returns Err if index out of bounds, i.e., the requested interval does not exist
  • interval counting starts at 0, i.e., n=0 is the first interval
Get sweep size for markov chain of walkers
  • returns None if index out of bounds, i.e., the requested interval does not exist
  • interval counting starts at 0, i.e., n=0 is the first interval
Minimum of roundtrips

Definition of roundtrip: If a walker is in the leftest interval, then in the rightest and then in the leftest again (or the other way around) then this is counted as one roundtrip.

This will return the minimum of roundtrips

Maximum of roundtrips

Definition of roundtrip: If a walker is in the leftest interval, then in the rightest and then in the leftest again (or the other way around) then this is counted as one roundtrip.

This will return the maximum of roundtrips

Roundtrips

Definition of roundtrip: If a walker is in the leftest interval, then in the rightest and then in the leftest again (or the other way around) then this is counted as one roundtrip.

This will return an iterator over the roundtrips

returns largest value of factor log_f present in the walkers

Log_f factors of the walkers
  • the log_f’s will be reduced towards 0 during the simulation
change the threshold of log_f
  • it has to be a positive, normal number
Is the simulation finished?

checks if all walkers have factors log_f that are below the threshold you chose

Results of the simulation

This is what we do the simulation for!

It uses derivative merging to give you a ReplicaGlued which you can use to write the data into a file. The derivative merged is explained in derivative_merged_log_prob_and_aligned

Notes

Fails if the internal histograms (intervals) do not align. Might fail if there is no overlap between neighboring intervals

Results of the simulation

This is what we do the simulation for!

It uses average merging to give you a ReplicaGlued which you can use to write the data into a file. The average merged is explained in average_merged_and_aligned

Notes

Fails if the internal histograms (intervals) do not align. Might fail if there is no overlap between neighboring intervals

Get Ids

This is an indicator that the replica exchange works. In the beginning, this will be a sorted vector, e.g. [0,1,2,3,4]. Then it will show, where the ensemble, which the corresponding walkers currently work with, originated from. E.g. If the vector is [3,1,0,2,4], Then walker 0 has a ensemble originating from walker 3, the walker 1 is back to its original ensemble, walker 2 has an ensemble originating form walker 0 and so on.

read access to internal histogram
  • None if index out of range
Convert into Rees

This creates a Replica exchange entropic sampling simulation from this Replica exchange wang landau simulation

Convert into Rees
  • similar to into_rees, though now we can store extra information. The extra information can be anything, e.g., files in which each walker should later write information every nth step or something else entirely.
important
  • The vector extra must be exactly as long as the walker slice and each walker is assigned the corresponding entry from the vector extra
  • You can look at the walker slice with the walkers method
Perform the Replica exchange wang landau simulation
  • will simulate until all walkers have factors log_f that are below the threshold you chose
Perform the Replica exchange wang landau simulation
  • will simulate until all walkers have factors log_f that are below the threshold you chose or
  • until condition returns false
Sanity check
  • checks if the stored (i.e., last) energy(s) of the system match with the result of energy_fn
Sweep
  • Performs one sweep of the Replica exchange wang landau simulation
  • You can make a complete simulation, by repeatatly calling this method until self.is_finished() returns true