Struct net_ensembles::sampling::EntropicSamplingAdaptive [−][src]
pub struct EntropicSamplingAdaptive<Hist, R, E, S, Res, T> { /* fields omitted */ }
Expand description
Entropic sampling made easy
J. Lee, “New Monte Carlo algorithm: Entropic sampling,” Phys. Rev. Lett. 71, 211–214 (1993), DOI: 10.1103/PhysRevLett.71.211
Implementations
Energy of ensemble
- assuming
energy_fn
(seeself.entropic_step
etc.) is deterministic and will allways give the same result for the same ensemble, this returns the energy of the current ensemble
Number of entropic steps done until now
- will be reset by
self.refine_estimate
Number of entropic steps to be performed
- if
self
was created fromWangLandauAdaptive
,step_goal
will be equal to the number of WangLandau steps, that were performed
Number of entropic steps to be performed
- set the number of steps to be performed by entropic sampling
Currently used best of
- might have length 0, if statistics are still being gathered
- otherwise this contains the step sizes, from which the next stepsize is drawn uniformly
Fraction of steps accepted since the statistics were reset the last time
- (steps accepted since last reset) / (steps since last reset)
NaN
if no steps were performed yet
Fraction of steps accepted since the creation of self
NaN
if no steps were performed yet
- returns the (non normalized) log_density estimate log(P(E)), with which the simulation was started
- if you created this from a WangLandau simulation, this is the result of the WangLandau Simulation
impl<Hist, R, E, S, Res, T> EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, T> EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
R: Rng,
Hist: Histogram,
pub fn from_wl_adaptive(
wl: WangLandauAdaptive<Hist, R, E, S, Res, T>
) -> Result<EntropicSamplingAdaptive<Hist, R, E, S, Res, T>, EntropicErrors>
pub fn from_wl_adaptive(
wl: WangLandauAdaptive<Hist, R, E, S, Res, T>
) -> Result<EntropicSamplingAdaptive<Hist, R, E, S, Res, T>, EntropicErrors>
Creates EntropicSamplingAdaptive from a WangLandauAdaptive
state
WangLandauAdaptive
state needs to be valid, i.e., you must have called one of theinit*
methods
- this ensures, that the members
old_energy
andold_bin
are notNone
calculates the (non normalized) log_density estimate log(P(E)) according to the paper
Calculates self.log_density_refined
and uses that as estimate for a the entropic sampling simulation
- returns old estimate
prepares self
for a new entropic simulation
- sets new estimate for log(P(E))
- resets statistic gathering
- resets step_count
How often to adjust bestof_steps
?
- if you try to set a value smaller 10, it will be set to 10
- will reevalute the statistics every
adjust_bestof_every
steps,
- this will not start new statistics gathering but just trigger a reevaluation of the gathered statistics (should be O(max_stepsize - min_stepsize))
Is the simulation in the process of rebuilding the statistics, i.e., is it currently trying many differnt step sizes?
Estimate accept/reject statistics
- contains list of estimated probabilities for accepting a step of corresponding step size
- list[i] corresponds to step size
i + self.min_step
- O(trial_step_max - trial_step_min)
impl<Hist, R, E, S, Res, T> EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
T: Clone,
R: Rng,
E: MarkovChain<S, Res>,
Hist: Histogram + HistogramVal<T>,
impl<Hist, R, E, S, Res, T> EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
T: Clone,
R: Rng,
E: MarkovChain<S, Res>,
Hist: Histogram + HistogramVal<T>,
pub unsafe fn entropic_sampling_while_unsafe<F, G, W>(
&mut self,
energy_fn: F,
print_fn: G,
condition: W
) where
F: FnMut(&mut E) -> Option<T>,
W: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>) -> bool,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
pub unsafe fn entropic_sampling_while_unsafe<F, G, W>(
&mut self,
energy_fn: F,
print_fn: G,
condition: W
) where
F: FnMut(&mut E) -> Option<T>,
W: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>) -> bool,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
Entropic sampling
- performs
self.entropic_step(energy_fn)
untilcondition
is false - Note: you have access to the current step_count (
self.step_count()
)
Parameter
energy_fn
function calculatingSome(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)
isNone
will always be rejected - Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong! print_fn
: see below
Correlations
- if you want to measure correlations between “energy” and other measurable quantities,
use
print_fn
, which will be called after each step - use this function to write to a file or whatever you desire - Note: You do not have to recalculate the energy, if you need it in
print_fn
: just callself.energy()
- you have access to your ensemble with
self.ensemble()
- if you do not need it, you can use
|_|{}
asprint_fn
pub fn entropic_sampling_while<F, G, W>(
&mut self,
energy_fn: F,
print_fn: G,
condition: W
) where
F: FnMut(&E) -> Option<T>,
W: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>) -> bool,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
pub fn entropic_sampling_while<F, G, W>(
&mut self,
energy_fn: F,
print_fn: G,
condition: W
) where
F: FnMut(&E) -> Option<T>,
W: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>) -> bool,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
Entropic sampling
- performs
self.entropic_step(energy_fn)
untilcondition
is false - Note: you have access to the current step_count (
self.step_count()
)
Parameter
energy_fn
function calculatingSome(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)
isNone
will always be rejected - Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong! print_fn
: see below
Correlations
- if you want to measure correlations between “energy” and other measurable quantities,
use
print_fn
, which will be called after each step - use this function to write to a file or whatever you desire - Note: You do not have to recalculate the energy, if you need it in
print_fn
: just callself.energy()
- you have access to your ensemble with
self.ensemble()
- if you do not need it, you can use
|_|{}
asprint_fn
pub fn entropic_sampling_while_acc<F, G, W>(
&mut self,
energy_fn: F,
print_fn: G,
condition: W
) where
F: FnMut(&E, &S, &mut T),
W: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>) -> bool,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
pub fn entropic_sampling_while_acc<F, G, W>(
&mut self,
energy_fn: F,
print_fn: G,
condition: W
) where
F: FnMut(&E, &S, &mut T),
W: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>) -> bool,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
Entropic sampling using an accumulating markov step
- performs
self.entropic_step_acc(&mut energy_fn)
untilcondition(self) == false
Parameter
energy_fn
function calculating the energyE
of the system (or rather the Parameter of which you wish to obtain the probability distribution) during the markov steps, which can be more efficient.- Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong! print_fn
: see below
Correlations
- if you want to measure correlations between “energy” and other measurable quantities,
use
print_fn
, which will be called after each step - use this function to write to a file or whatever you desire - Note: You do not have to recalculate the energy, if you need it in
print_fn
: just callself.energy()
- you have access to your ensemble with
self.ensemble()
- if you do not need it, you can use
|_|{}
asprint_fn
pub unsafe fn entropic_sampling_unsafe<F, G>(
&mut self,
energy_fn: F,
print_fn: G
) where
F: FnMut(&mut E) -> Option<T>,
G: FnMut(&mut EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
pub unsafe fn entropic_sampling_unsafe<F, G>(
&mut self,
energy_fn: F,
print_fn: G
) where
F: FnMut(&mut E) -> Option<T>,
G: FnMut(&mut EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
Entropic sampling
- if possible, use
self.entropic_sampling()
instead! - More powerful version of
self.entropic_sampling()
, since you now have mutable access - to access ensemble mutable, use
self.ensemble_mut()
- Note: Whatever you do with the ensemble (or self), should not change the result of the energy function, if performed again. Otherwise the results will be false!
- performs
self.entropic_step_unsafe(energy_fn)
untilself.step_count == self.step_goal
Parameter
energy_fn
function calculatingSome(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)
isNone
will always be rejected - Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong! print_fn
: see below
Correlations
- if you want to measure correlations between “energy” and other measurable quantities,
use
print_fn
, which will be called after each step - use this function to write to a file or whatever you desire - Note: You do not have to recalculate the energy, if you need it in
print_fn
: just callself.energy()
- you have access to your ensemble with
self.ensemble()
- if you do not need it, you can use
|_|{}
asprint_fn
pub fn entropic_sampling<F, G>(&mut self, energy_fn: F, print_fn: G) where
F: FnMut(&E) -> Option<T>,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
pub fn entropic_sampling<F, G>(&mut self, energy_fn: F, print_fn: G) where
F: FnMut(&E) -> Option<T>,
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
Entropic sampling
- performs
self.entropic_step(energy_fn)
untilself.step_count == self.step_goal
Parameter
energy_fn
function calculatingSome(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)
isNone
will always be rejected - Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong! print_fn
: see below
Correlations
- if you want to measure correlations between “energy” and other measurable quantities,
use
print_fn
, which will be called after each step - use this function to write to a file or whatever you desire - Note: You do not have to recalculate the energy, if you need it in
print_fn
: just callself.energy()
- you have access to your ensemble with
self.ensemble()
- if you do not need it, you can use
|_|{}
asprint_fn
pub fn entropic_sampling_acc<F, G>(&mut self, energy_fn: F, print_fn: G) where
F: FnMut(&E, &S, &mut T),
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
pub fn entropic_sampling_acc<F, G>(&mut self, energy_fn: F, print_fn: G) where
F: FnMut(&E, &S, &mut T),
G: FnMut(&EntropicSamplingAdaptive<Hist, R, E, S, Res, T>),
Entropic sampling using an accumulating markov step
- performs
self.entropic_step_acc(&mut energy_fn)
untilself.step_count == self.step_goal
Parameter
energy_fn
function calculating the energyE
of the system (or rather the Parameter of which you wish to obtain the probability distribution) during the markov steps, which can be more efficient.- Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong! print_fn
: see below
Correlations
- if you want to measure correlations between “energy” and other measurable quantities,
use
print_fn
, which will be called after each step - use this function to write to a file or whatever you desire - Note: You do not have to recalculate the energy, if you need it in
print_fn
: just callself.energy()
- you have access to your ensemble with
self.ensemble()
- if you do not need it, you can use
|_|{}
asprint_fn
pub unsafe fn entropic_step_unsafe<F>(&mut self, energy_fn: F) where
F: FnMut(&mut E) -> Option<T>,
pub unsafe fn entropic_step_unsafe<F>(&mut self, energy_fn: F) where
F: FnMut(&mut E) -> Option<T>,
Entropic step
- performs a single step
Parameter
energy_fn
function calculatingSome(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)
isNone
will always be rejected
Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong!
Entropic step
- performs a single step
Parameter
energy_fn
function calculatingSome(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)
isNone
will always be rejected
Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong!
Accumulating entropic step
- performs a single step
Parameter
energy_fn
function calculating the energyE
of the system (or rather the Parameter of which you wish to obtain the probability distribution) during the markov steps, which can be more efficient.
Important
energy_fn
: should be the same as used for Wang Landau, otherwise the results will be wrong!
Trait Implementations
impl<'de, Hist, R, E, S, Res, T> Deserialize<'de> for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
T: Deserialize<'de>,
R: Deserialize<'de>,
S: Deserialize<'de>,
E: Deserialize<'de>,
Hist: Deserialize<'de>,
impl<'de, Hist, R, E, S, Res, T> Deserialize<'de> for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
T: Deserialize<'de>,
R: Deserialize<'de>,
S: Deserialize<'de>,
E: Deserialize<'de>,
Hist: Deserialize<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<EntropicSamplingAdaptive<Hist, R, E, S, Res, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<EntropicSamplingAdaptive<Hist, R, E, S, Res, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<Hist, R, E, S, Res, T> Entropic for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, T> Entropic for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
R: Rng,
Hist: Histogram,
Number of entropic steps done until now
- will be reset by
self.refine_estimate
Number of entropic steps to be performed
- if
self
was created fromWangLandauAdaptive
,step_goal
will be equal to the number of WangLandau steps, that were performed
How many steps were accepted until now? Read more
How many steps were rejected until now? 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
Counter Read more
Calculate, which fraction of steps were accepted Read more
Calculate, which fraction of steps were rejected Read more
Checks wang landau threshold Read more
Current (non normalized) estimate of log10(P(E)) Read more
impl<Hist, R, E, S, Res, Energy> EntropicEnergy<Energy> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, Energy> EntropicEnergy<Energy> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
Hist: Histogram,
Energy of ensemble
- assuming
energy_fn
(seeself.entropic_step
etc.) is deterministic and will allways give the same result for the same ensemble, this returns the energy of the current ensemble
impl<Hist, R, E, S, Res, Energy> EntropicEnsemble<E> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, Energy> EntropicEnsemble<E> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, Energy> EntropicHist<Hist> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, Energy> EntropicHist<Hist> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, Energy> HasRng<R> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
impl<Hist, R, E, S, Res, Energy> HasRng<R> for EntropicSamplingAdaptive<Hist, R, E, S, Res, Energy> where
R: Rng,
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
impl<Hist, R, E, S, Res, T> TryFrom<WangLandauAdaptive<Hist, R, E, S, Res, T>> for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
R: Rng,
Hist: Histogram,
impl<Hist, R, E, S, Res, T> TryFrom<WangLandauAdaptive<Hist, R, E, S, Res, T>> for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
R: Rng,
Hist: Histogram,
type Error = EntropicErrors
type Error = EntropicErrors
The type returned in the event of a conversion error.
pub fn try_from(
wl: WangLandauAdaptive<Hist, R, E, S, Res, T>
) -> Result<EntropicSamplingAdaptive<Hist, R, E, S, Res, T>, <EntropicSamplingAdaptive<Hist, R, E, S, Res, T> as TryFrom<WangLandauAdaptive<Hist, R, E, S, Res, T>>>::Error>
pub fn try_from(
wl: WangLandauAdaptive<Hist, R, E, S, Res, T>
) -> Result<EntropicSamplingAdaptive<Hist, R, E, S, Res, T>, <EntropicSamplingAdaptive<Hist, R, E, S, Res, T> as TryFrom<WangLandauAdaptive<Hist, R, E, S, Res, T>>>::Error>
Performs the conversion.
Auto Trait Implementations
impl<Hist, R, E, S, Res, T> RefUnwindSafe for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
E: RefUnwindSafe,
Hist: RefUnwindSafe,
R: RefUnwindSafe,
Res: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<Hist, R, E, S, Res, T> Send for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
E: Send,
Hist: Send,
R: Send,
Res: Send,
S: Send,
T: Send,
impl<Hist, R, E, S, Res, T> Sync for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
E: Sync,
Hist: Sync,
R: Sync,
Res: Sync,
S: Sync,
T: Sync,
impl<Hist, R, E, S, Res, T> Unpin for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
E: Unpin,
Hist: Unpin,
R: Unpin,
Res: Unpin,
S: Unpin,
T: Unpin,
impl<Hist, R, E, S, Res, T> UnwindSafe for EntropicSamplingAdaptive<Hist, R, E, S, Res, T> where
E: UnwindSafe,
Hist: UnwindSafe,
R: UnwindSafe,
Res: UnwindSafe,
S: UnwindSafe,
T: 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