Analysis Tools

Functions

FreeBird.AnalysisTools.cvMethod
cv(df::DataFrame, βs::Vector{Float64}, dof::Int, n_walkers::Int)

(Nested Sampling) Calculates the constant-volume heat capacity at constant volume for the given DataFrame, inverse temperatures, degrees of freedom, and number of walkers. The heat capacity is defined as:

\[C_V(\beta) = \frac{\mathrm{dof} \cdot k_B}{2} + k_B \beta^2 \left(\frac{\sum_i \omega_i E_i^2 \exp(-E_i \beta)}{Z(\beta)} - U(\beta)^2\right)\]

where $\mathrm{dof}$ is the degrees of freedom, $k_B$ is the Boltzmann constant (in units of eV/K), $\beta$ is the inverse temperature, $\omega_i$ is the $i$-th $\omega$ factor, $E_i$ is the $i$-th energy, $Z(\beta)$ is the partition function, and $U(\beta)$ is the internal energy.

Arguments

  • df::DataFrame: The DataFrame containing the output data.
  • βs::Vector{Float64}: The inverse temperatures.
  • dof::Int: The degrees of freedom, equals to the number of dimensions times the number of particles. For a lattice, it is zero.
  • n_walkers::Int: The number of walkers.
  • ω0::Float64: The initial $\omega$ factor. Default is 1.0.

Returns

  • A vector of constant-volume heat capacities.
source
FreeBird.AnalysisTools.cvMethod
cv(β::Float64, omega_i::Vector{Float64}, Ei::Vector{Float64}, dof::Int)

Calculates the constant-volume heat capacity for the given $\beta$, $\omega$ factors, energies, and degrees of freedom. The heat capacity is defined as:

\[C_V(\beta) = \frac{\mathrm{dof} \cdot k_B}{2} + k_B \beta^2 \left(\frac{\sum_i \omega_i E_i^2 \exp(-E_i \beta)}{Z(\beta)} - U(\beta)^2\right)\]

where $\mathrm{dof}$ is the degrees of freedom, $k_B$ is the Boltzmann constant (in units of eV/K), $\beta$ is the inverse temperature, $\omega_i$ is the $i$-th $\omega$ factor, $E_i$ is the $i$-th energy, $Z(\beta)$ is the partition function, and $U(\beta)$ is the internal energy.

Arguments

  • β::Float64: The inverse temperature.
  • ωi::Vector{Float64}: The $\omega$ factors.
  • Ei::Vector{Float64}: The energies in eV.
  • dof::Int: The degrees of freedom, equals to the number of dimensions times the number of particles.

Returns

  • The constant-volume heat capacity.
source
FreeBird.AnalysisTools.cvMethod
cv(Ts::Vector{Float64}, dof::Int, energy_bins::Vector{Float64}, entropy::Vector{Float64})

(Wang-Landau Sampling) Calculates the constant-volume heat capacity at constant volume for the given temperatures, degrees of freedom, energy bins, and entropy. The kinetic energy is treated classically, and is added to the heat capacity as $dof \cdot k_B/2$.

Arguments

  • Ts::Vector{Float64}: The temperatures in Kelvin.
  • dof::Int: The degrees of freedom, equals to the number of dimensions times the number of particles. For a lattice, it is zero.
  • energy_bins::Vector{Float64}: The energy bins in eV.
  • entropy::Vector{Float64}: The entropy.

Returns

  • A vector of constant-volume heat capacities.
source
FreeBird.AnalysisTools.internal_energyMethod
internal_energy(β::Float64, ωi::Vector{Float64}, ei::Vector{Float64})

Calculates the internal energy from the partition function for the given $\beta$, $\omega$ factors, and energies. The internal energy is defined as:

\[U(\beta) = \frac{\sum_i \omega_i E_i \exp(-E_i \beta)}{\sum_i \omega_i \exp(-E_i \beta)}\]

where $\omega_i$ is the $i$-th $\omega$ factor, $E_i$ is the $i$-th energy, and $\beta$ is the inverse temperature.

Arguments

  • β::Float64: The inverse temperature.
  • ωi::Vector{Float64}: The $\omega$ factors.
  • Ei::Vector{Float64}: The energies in eV.

Returns

  • The internal energy.
source
FreeBird.AnalysisTools.partition_functionMethod
partition_function(β::Float64, ωi::Vector{Float64}, Ei::Vector{Float64})

Calculates the partition function for the given $\beta$, $\omega$ factors, and energies. The partition function is defined as:

\[Z(\beta) = \sum_i \omega_i \exp(-E_i \beta)\]

where $\omega_i$ is the $i$-th $\omega$ factor, $E_i$ is the $i$-th energy, and $\beta$ is the inverse temperature.

Arguments

  • β::Float64: The inverse temperature.
  • ωi::Vector{Float64}: The $\omega$ factors.
  • Ei::Vector{Float64}: The energies.

Returns

  • The partition function.
source
FreeBird.AnalysisTools.ωᵢMethod
ωᵢ(iters::Vector{Int}, n_walkers::Int)

Calculates the $\omega$ factors for the given number of iterations and walkers. The $\omega$ factors account for the fractions of phase-space volume sampled during each nested sampling iteration, defined as:

\[\omega_i = \frac{1}{N+1} \left(\frac{N}{N+1}\right)^i\]

where $N$ is the number of walkers and $i$ is the iteration number.

Arguments

  • iters::Vector{Int}: The iteration numbers.
  • n_walkers::Int: The number of walkers.
  • ω0::Float64: The initial $\omega$ factor. Default is 1.0.

Returns

  • A vector of $\omega$ factors.
source