pub struct BoltzmannDistribution {
pub energies: Vec<f64>,
pub degeneracies: Vec<f64>,
pub temperature: f64,
}Expand description
Boltzmann probability distribution over a discrete energy spectrum.
Computes Boltzmann weights, occupation probabilities, entropy, and free energy.
Fields§
§energies: Vec<f64>Energy levels.
degeneracies: Vec<f64>Degeneracies per level.
temperature: f64Temperature (k_B = 1).
Implementations§
Source§impl BoltzmannDistribution
impl BoltzmannDistribution
Sourcepub fn new(energies: Vec<f64>, degeneracies: Vec<f64>, temperature: f64) -> Self
pub fn new(energies: Vec<f64>, degeneracies: Vec<f64>, temperature: f64) -> Self
Creates a new Boltzmann distribution.
Sourcepub fn uniform(energies: Vec<f64>, temperature: f64) -> Self
pub fn uniform(energies: Vec<f64>, temperature: f64) -> Self
Creates a uniform degeneracy distribution (all degeneracies = 1).
Sourcepub fn partition_function(&self) -> f64
pub fn partition_function(&self) -> f64
Returns the partition function Z = Σ_i weight(i).
Sourcepub fn probability(&self, i: usize) -> f64
pub fn probability(&self, i: usize) -> f64
Returns the normalised probability P_i = weight(i) / Z.
Sourcepub fn probabilities(&self) -> Vec<f64>
pub fn probabilities(&self) -> Vec<f64>
Returns all occupation probabilities as a vector.
Sourcepub fn free_energy(&self) -> f64
pub fn free_energy(&self) -> f64
Returns the Helmholtz free energy F = -T ln Z.
Sourcepub fn mean_energy(&self) -> f64
pub fn mean_energy(&self) -> f64
Returns the mean energy ⟨E⟩ = Σ_i P_i E_i.
Trait Implementations§
Source§impl Clone for BoltzmannDistribution
impl Clone for BoltzmannDistribution
Source§fn clone(&self) -> BoltzmannDistribution
fn clone(&self) -> BoltzmannDistribution
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BoltzmannDistribution
impl RefUnwindSafe for BoltzmannDistribution
impl Send for BoltzmannDistribution
impl Sync for BoltzmannDistribution
impl Unpin for BoltzmannDistribution
impl UnsafeUnpin for BoltzmannDistribution
impl UnwindSafe for BoltzmannDistribution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.