2.5. Multi-configurations free energy¶
2.5.2. Same phonon density of states¶
-
class
qha.multi_configurations.same_phonon_dos.
PartitionFunction
(temperature, degeneracies, q_weights, static_energies, frequencies, precision=500)[source]¶ A class that represents the partition function of multiple configurations with the same phonon density of states. In mathematics, it is represented as
\[Z_{\text{all configs}}(T, V) = \sum_{j = 1}^{N_{c}} g_{j} \bigg\{ \exp \Big( -\frac{ E_j(V) }{ k_B T } \Big) \prod_{\mathbf{q}s} \bigg( \tfrac{\exp \big(-\tfrac{ \hbar \omega_{\mathbf{ q }s}^j(V) }{ 2 k_B T }\big)}{1 - \exp \big(-\tfrac{ \hbar \omega_{\mathbf{ q }s}^j(V) }{ k_B T }\big)} \bigg)^{w_{\mathbf{ q }}^j} \bigg\}.\]- Parameters
temperature (float64) – The temperature at which the partition function is calculated.
degeneracies (array(float64, 1d, A)) – An array of degeneracies of each configuration, which will not be normalized in the calculation. They should all be positive integers.
q_weights (array(float64, 1d, A)) – The weights of all q-points that are sampled, should be a vector since all configurations should have the same q-point weights.
static_energies (array(float64, 2d, A)) – The static energies of each configuration of each volume.
frequencies (array(float64, 3d, A)) – It is a 3D array that specifies the frequency on each volume, q-point and mode. It is not 4D since we have all configurations sharing the same phonon density of states.
precision (
Optional
[int
]) – The precision of a big float number to represent the partition function since it is a very large value, by default, is500
.
-
class
qha.multi_configurations.same_phonon_dos.
FreeEnergy
(temperature, degeneracies, q_weights, static_energies, volumes, frequencies, static_only=False, order=3)[source]¶ A class that represents the free energy of multiple configurations with the same phonon density of states. In mathematics, it is represented as
\[F_{\text{all configs}}(T, V) = - k_B T \ln Z_{\text{all configs}}(T, V) = - k_B T \ln \bigg( \sum_{j = 1}^{N_{c}} g_{j} \exp \Big( -\frac{ E_j(V) }{ k_B T } \Big) \bigg) + \sum_{\mathbf{ q }s} w_\mathbf{ q } \bigg\{ \frac{ \hbar \omega_{\mathbf{ q }s}(V) }{ 2 } + k_B \ln \bigg( 1 - \exp \Big( -\frac{ \hbar \omega_{\mathbf{ q }s}(V) }{ k_B T } \Big) \bigg) \bigg\}.\]- Parameters
temperature (float64) – The temperature at which the partition function is calculated.
degeneracies (array(float64, 1d, A)) – An array of degeneracies of each configuration, which will not be normalized in the calculation. They should all be positive integers.
q_weights (array(float64, 1d, A)) – The weights of all q-points that are sampled, should be a vector since all configurations should have the same q-point weights.
static_energies (array(float64, 2d, A)) – The static energy of each configuration of each volume.
volumes (array(float64, 2d, A)) – A matrix of volumes of each configurations, should have the same values for each configuration.
frequencies (array(float64, 3d, A)) – It is a 3D array that specifies the frequency on each volume, q-point and mode. It is not 4D since we have all configurations sharing the same phonon density of states.
static_only (
Optional
[bool
]) – Whether the calculation only takes static contribution and does not consider the vibrational contribution, by default, isFalse
.order (
Optional
[int
]) – The order of Birch–Murnaghan equation of state fitting, by default, is3
.
-
property
aligned_static_energies_for_each_configuration
[source]¶ If the input static energies are not aligned for each configuration, then do a fitting to align all static energies.
- Returns
A matrix of aligned static energy of each configuration of each volume.
-
get_free_energies
()[source]¶ If
static_only = True
is specified in class instantiation, then only the static contribution will be counted. Then it is equivalent to thestatic_part
property. If not, then this is equivalent to thetotal
property.- Returns
The free energy on the temperature-volume grid.
-
property
harmonic_part
[source]¶ Calculate the harmonic contribution to the free energy.
- Returns
The harmonic contribution on the temperature-volume grid.
2.5.2. Different phonon density of states¶
-
class
qha.multi_configurations.different_phonon_dos.
PartitionFunction
(temperature, degeneracies, q_weights, static_energies, volumes, frequencies, static_only=False, precision=500, order=3)[source]¶ A class that represents the partition function of multiple configurations with different phonon density of states. In mathematics, it is represented as
\[Z_{\text{all configs}}(T, V) = \sum_{j = 1}^{N_{c}} g_{j} Z_{j}(T, V),\]where \(N_{c}\) stands for the number of configurations and \(g_{j}\) stands for degeneracy for the \(j\) th configuration.
- Parameters
temperature (float64) – The temperature at which the partition function is calculated.
degeneracies (array(float64, 1d, A)) – An array of degeneracies of each configuration, which will not be normalized in the calculation. They should all be positive integers.
q_weights (array(float64, 2d, A)) – The weights of all q-points that are sampled, can be a 2D matrix so each configuration can have a little bit different q-point weights, but the number of q-points of each configuration must be the same.
static_energies (array(float64, 2d, A)) – The static energy of each configuration of each volume.
volumes (array(float64, 2d, A)) – A matrix of volumes of each configuration, should have the same values for each configuration.
frequencies (array(float64, 4d, A)) – A 4D array that specifies the frequency on each configuration, volume, q-point and mode.
static_only (
Optional
[bool
]) – Whether the calculation only takes static contribution and does not consider the vibrational contribution, by default, isFalse
.precision (
Optional
[int
]) – The precision of a big float number to represent the partition function since it is a very large value, by default, is500
.order (
Optional
[int
]) – The order of Birch–Murnaghan equation of state fitting, by default, is3
.
-
property
aligned_free_energies_for_each_configuration
[source]¶ Then do a fitting to align all these free energies.
- Returns
A matrix, the aligned free energy of each configuration of each volume.
-
get_free_energies
()[source]¶ The free energy calculated from the partition function \(Z_{\text{all configs}}(T, V)\) by
\[F_{\text{all configs}}(T, V) = - k_B T \ln Z_{\text{all configs}}(T, V).\]- Returns
The free energy on a temperature-volume grid.
-
property
partition_functions_for_all_configurations
[source]¶ Sum the partition functions for all configurations.
\[Z_{\text{all configs}}(T, V) = \sum_{j} Z_{j}(T, V).\]- Returns
A vector, the partition function of each volume.