pub struct EntropicSampling<Hist, R, E, S, Res, Energy> { /* private fields */ }
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 (see self.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 to be performed
  • set the number of steps to be performed by entropic sampling
Fraction of steps accepted since the creation of self
  • total_steps_accepted / total_steps
  • 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
Creates Entropic from a WangLandauAdaptive state
  • WangLandauAdaptive state needs to be valid, i.e., you must have called one of the init* methods
  • this ensures, that the members old_energy and old_bin are not None
Creates Entropic from a WangLandauAdaptive state
  • WangLandauAdaptive state needs to be valid, i.e., you must have called one of the init* methods
  • this ensures, that the members old_energy and old_bin are not None

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
Entropic sampling
  • performs self.entropic_step(energy_fn) until condition is false
  • Note: you have access to the current step_count (self.step_count())
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 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 call self.energy()
  • you have access to your ensemble with self.ensemble()
  • if you do not need it, you can use |_|{} as print_fn
Entropic sampling using an accumulating markov step
  • performs self.entropic_step_acc(&mut energy_fn) until condition(self) == false
Parameter
  • energy_fn function calculating the energy E 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 call self.energy()
  • you have access to your ensemble with self.ensemble()
  • if you do not need it, you can use |_|{} as print_fn
Entropic sampling
  • if possible, use entropic_sampling_while instead, as it is safer
Safety
  • use this if you need mutable access to your ensemble while printing or calculating the condition. Note, that whatever you do there, should not change the energy of the current state. Otherwise this can lead to undefined behavior and the results of the entropic sampling cannot be trusted anymore!
  • performs self.entropic_step(energy_fn) until condition is false
  • Note: you have access to the current step_count (self.step_count())
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 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 call self.energy()
  • you have mutable access to your ensemble with self.ensemble_mut()
  • if you do not need it, you can use |_|{} as print_fn
Entropic sampling
  • performs self.entropic_step(energy_fn) until self.step_count == self.step_goal
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 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 call self.energy()
  • you have access to your ensemble with self.ensemble()
  • if you do not need it, you can use |_|{} as print_fn
Entropic sampling using an accumulating markov step
  • performs self.entropic_step_acc(&mut energy_fn) until self.step_count >= self.step_goal
Parameter
  • energy_fn function calculating the energy E 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 call self.energy()
  • you have access to your ensemble with self.ensemble()
  • if you do not need it, you can use |_|{} as print_fn
Entropic sampling
  • if possible, use entropic_sampling instead, as it is safer
Safety
  • NOTE You have mutable access to your ensemble (and to self, at least in the printing function). This makes this function unsafe. You should never change your ensemble in a way, that will effect the outcome of the energy function. Otherwise the results will just be wrong. This is intended for usecases, where the energycalculation is more efficient with mutable access, e.g., through using a buffer stored in the ensemble
  • performs self.entropic_step(energy_fn) until self.step_count == self.step_goal
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 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 call self.energy()
  • you have access to your ensemble with self.ensemble()
  • if you do not need it, you can use |_|{} as print_fn
Entropic step
  • if possible, use entropic_step instead
  • performs a single 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
  • energy_fn: should be the same as used for Wang Landau, otherwise the results will be wrong!
Safety
  • While you do have mutable access to the ensemble, the energy function should not change the ensemble in a way, which affects the next calculation of the energy
  • This is intended for usecases, where the energycalculation is more efficient with mutable access, e.g., through using a buffer stored in the ensemble
Entropic step
  • performs a single 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
  • energy_fn: should be the same as used for Wang Landau, otherwise the results will be wrong!
Entropic sampling using an accumulating markov step
  • performs self.entropic_step_acc(&mut energy_fn) until self.step_count == self.step_goal
Parameter
  • energy_fn function calculating the energy E 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 call self.energy()
  • you have access to your ensemble with self.ensemble()
  • if you do not need it, you can use |_|{} as print_fn

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
Number of entropic steps to be performed
  • if self was created from WangLandauAdaptive, step_goal will be equal to the number of WangLandau steps, that were performed
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
How many steps were accepted until now? Read more
How many steps were rejected until now? 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
Current (non normalized) estimate of log_base(P(E)) Read more
Energy of ensemble
  • assuming energy_fn (see self.entropic_step etc.) is deterministic and will allways give the same result for the same ensemble, this returns the energy of the current ensemble
return reference to current state of ensemble
returns mutable reference to ensemble Read more
returns current histogram Read more
Access RNG Read more
If you need to exchange the internal rng 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.

Uses as stepsize: first entry of bestof. If bestof is empty, it uses wl.min_step_size() + (wl.max_step_size() - wl.max_step_size()) / 2

The type returned in the event of a conversion error.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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
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.