Struct net_ensembles::sampling::rewl::ReplicaExchangeWangLandau [−][src]
pub struct ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> { /* fields omitted */ }
Expand description
Efficient replica exchange Wang landau
- use this to quickly build your own parallel replica exchange wang landau simulation
Tipp
Use the short hand Rewl
Citations
- the following paper were used to progamm this - you should cite them, if you use this library for a publication!
Y. W. Li, T. Vogel, T. Wüst and D. P. Landau, “A new paradigm for petascale Monte Carlo simulation: Replica exchange Wang-Landau sampling,” J. Phys.: Conf. Ser. 510 012012 (2014), DOI 10.1088/1742-6596/510/1/012012
T. Vogel, Y. W. Li, T. Wüst and D. P. Landau, “Exploring new frontiers in statistical physics with a new, parallel Wang-Landau framework,” J. Phys.: Conf. Ser. 487 012001 (2014), DOI 10.1088/1742-6596/487/1/012001
T. Vogel, Y. W. Li, T. Wüst and D. P. Landau, “Scalable replica-exchange framework for Wang-Landau sampling,” Phys. Rev. E 90: 023302 (2014), DOI 10.1103/PhysRevE.90.023302
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
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
impl<Ensemble, R, Hist, Energy, S, Res> ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>
impl<Ensemble, R, Hist, Energy, S, Res> ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>
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
ifindex
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 implementsDeref
. Of cause, you can also take a look atRwLockReadGuard
Mutable iterator over ensembles
- if possible, prefer
ensemble_iter
- unsafe only use this if you know what you are doing
- 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
- unsafe only use this if you know what you are doing
- it is assumed, that whatever you change has no effect on the Markov Chain, the result of the energy function etc.
- None if
index
out of range - 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
pub fn change_sweep_size_of_interval(
&mut self,
n: usize,
sweep_size: NonZeroUsize
) -> Result<(), ()>
pub fn change_sweep_size_of_interval(
&mut self,
n: usize,
sweep_size: NonZeroUsize
) -> Result<(), ()>
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
impl<Ensemble, R, Hist, Energy, S, Res> ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
R: Send + Sync + Rng + SeedableRng,
S: Send + Sync,
Res: Send + Sync,
Hist: Send + Sync + Histogram + HistogramVal<Energy>,
Energy: Send + Sync + Clone,
Ensemble: MarkovChain<S, Res>,
impl<Ensemble, R, Hist, Energy, S, Res> ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
R: Send + Sync + Rng + SeedableRng,
S: Send + Sync,
Res: Send + Sync,
Hist: Send + Sync + Histogram + HistogramVal<Energy>,
Energy: Send + Sync + Clone,
Ensemble: MarkovChain<S, Res>,
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
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
Is the simulation finished?
checks if all walkers have factors log_f
that are below the threshold you chose
pub fn merged_log10_prob(&self) -> Result<(Hist, Vec<f64, Global>), HistErrors> where
Hist: HistogramCombine,
pub fn merged_log10_prob(&self) -> Result<(Hist, Vec<f64, Global>), HistErrors> where
Hist: HistogramCombine,
Result of the simulations!
This is what we do the simulation for!
It returns the log10 of the normalized (i.e. sum=1 within numerical precision) probability density and the histogram, which contains the corresponding bins.
Failes if the internal histograms (invervals) do not align. Might fail if there is no overlap between neighboring intervals
pub fn merged_log10_prob_and_aligned(
&self
) -> Result<(Hist, Vec<f64, Global>, Vec<Vec<f64, Global>, Global>), HistErrors> where
Hist: HistogramCombine,
pub fn merged_log10_prob_and_aligned(
&self
) -> Result<(Hist, Vec<f64, Global>, Vec<Vec<f64, Global>, Global>), HistErrors> where
Hist: HistogramCombine,
Results of the simulation
This is what we do the simulation for!
It returns histogram, which contains the corresponding bins and the logarithm with base 10 of the normalized (i.e. sum=1 within numerical precision) probability density. Lastly it returns the vector of the aligned probability estimates (also log10) of the different intervals. This can be used to see, how good the simulation worked, e.g., by plotting them to see, if they match
Notes
Failes if the internal histograms (invervals) do not align. Might fail if there is no overlap between neighboring intervals
pub fn merged_log_prob(&self) -> Result<(Hist, Vec<f64, Global>), HistErrors> where
Hist: HistogramCombine,
pub fn merged_log_prob(&self) -> Result<(Hist, Vec<f64, Global>), HistErrors> where
Hist: HistogramCombine,
Result of the simulations!
This is what we do the simulation for!
It returns the natural logarithm of the normalized (i.e. sum=1 within numerical precision) probability density and the histogram, which contains the corresponding bins.
Failes if the internal histograms (invervals) do not align. Might fail if there is no overlap between neighboring intervals
pub fn merged_log_prob_and_aligned(
&self
) -> Result<(Hist, Vec<f64, Global>, Vec<Vec<f64, Global>, Global>), HistErrors> where
Hist: HistogramCombine,
pub fn merged_log_prob_and_aligned(
&self
) -> Result<(Hist, Vec<f64, Global>, Vec<Vec<f64, Global>, Global>), HistErrors> where
Hist: HistogramCombine,
Results of the simulation
This is what we do the simulation for!
It returns histogram, which contains the corresponding bins and the natural logarithm of the normalized (i.e. sum=1 within numerical precision) probability density. Lastly it returns the vector of the aligned probability estimates (also ln) of the different intervals. This can be used to see, how good the simulation worked, e.g., by plotting them to see, if they match
Notes
Failes if the internal histograms (invervals) 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
pub fn into_rees(
self
) -> ReplicaExchangeEntropicSampling<(), Ensemble, R, Hist, Energy, S, Res>
pub fn into_rees(
self
) -> ReplicaExchangeEntropicSampling<(), Ensemble, R, Hist, Energy, S, Res>
Convert into Rees
This creates a Replica exchange entropic sampling simulation from this Replica exchange wang landau simulation
pub fn into_rees_with_extra<Extra>(
self,
extra: Vec<Extra, Global>
) -> Result<ReplicaExchangeEntropicSampling<Extra, Ensemble, R, Hist, Energy, S, Res>, (ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>, Vec<Extra, Global>)>
pub fn into_rees_with_extra<Extra>(
self,
extra: Vec<Extra, Global>
) -> Result<ReplicaExchangeEntropicSampling<Extra, Ensemble, R, Hist, Energy, S, Res>, (ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>, Vec<Extra, Global>)>
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 vectorextra
- You can look at the walker slice with the walkers method
Trait Implementations
impl<'de, Ensemble, R, Hist, Energy, S, Res> Deserialize<'de> for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
R: Deserialize<'de>,
S: Deserialize<'de>,
Res: Deserialize<'de>,
Hist: Deserialize<'de>,
Energy: Deserialize<'de>,
Ensemble: Deserialize<'de>,
impl<'de, Ensemble, R, Hist, Energy, S, Res> Deserialize<'de> for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
R: Deserialize<'de>,
S: Deserialize<'de>,
Res: Deserialize<'de>,
Hist: Deserialize<'de>,
Energy: Deserialize<'de>,
Ensemble: Deserialize<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<Ensemble, R, Hist, Energy, S, Res> From<ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>> for ReplicaExchangeEntropicSampling<(), Ensemble, R, Hist, Energy, S, Res> where
Hist: Histogram,
impl<Ensemble, R, Hist, Energy, S, Res> From<ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>> for ReplicaExchangeEntropicSampling<(), Ensemble, R, Hist, Energy, S, Res> where
Hist: Histogram,
pub fn from(
rewl: ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>
) -> ReplicaExchangeEntropicSampling<(), Ensemble, R, Hist, Energy, S, Res>
pub fn from(
rewl: ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res>
) -> ReplicaExchangeEntropicSampling<(), Ensemble, R, Hist, Energy, S, Res>
Performs the conversion.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<Ensemble, R, Hist, Energy, S, Res> RefUnwindSafe for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
Energy: RefUnwindSafe,
Hist: RefUnwindSafe,
R: RefUnwindSafe,
Res: RefUnwindSafe,
S: RefUnwindSafe,
impl<Ensemble, R, Hist, Energy, S, Res> Send for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
Energy: Send,
Ensemble: Send,
Hist: Send,
R: Send,
Res: Send,
S: Send,
impl<Ensemble, R, Hist, Energy, S, Res> Sync for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
Energy: Sync,
Ensemble: Send + Sync,
Hist: Sync,
R: Sync,
Res: Sync,
S: Sync,
impl<Ensemble, R, Hist, Energy, S, Res> Unpin for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
Energy: Unpin,
Ensemble: Unpin,
Hist: Unpin,
R: Unpin,
Res: Unpin,
S: Unpin,
impl<Ensemble, R, Hist, Energy, S, Res> UnwindSafe for ReplicaExchangeWangLandau<Ensemble, R, Hist, Energy, S, Res> where
Energy: UnwindSafe,
Hist: UnwindSafe,
R: UnwindSafe,
Res: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more