ConfigurationalDensityOfStates class¶
Objects of this class are used to select optimal structures to train cluster expansion models. Also, allows to evaluate the quality of training sets.
Initialization and methods¶
- class clusterx.thermodynamics.wang_landau.ConfigurationalDensityOfStates(scell=None, filename='cdos.json', read=False, **kwargs)¶
ConfigurationalDensityOfStates class
Objects of this class are use to store and access the configurational density of states (CDOS) that was generated from a Wang-Landau sampling.
Since the Wang-Landau algorithm is iterative, it contains the CDOS for each iteration of the outer loop.
- Parameters:
- scellSuperCell, default None
Super cell in which the Wang-Landau sampling is performed.
- filenamestr, default cdos.json
The trajectoy can be stored in a json file
filename.- readbool, default False
If True, the CDOS is read from the Json file
filename.- **kwargskeyword arguments
Keyword arguments can be used to store additional information about the parameters used for the WangLandau.wang_landau_sampling rountine. This will be saved in the Json file
filenameundersampling_info, if the object is serialized.
- calculate_thermodynamic_property(temperatures, prop_name='U', modification_factor=None)¶
Calculate the thermodynamic property with name
prop_namefor the temperature list given listtemperatures.In disregard of the normalization used for the configurational density of states \(g(E)\), for numerical convenience this method internally normalizes \(g(E)\) according to
\[g(E_0=0) = 1\]For the output quantities other normalizations can be easily obtained considering the following transformations:
\[ \begin{align}\begin{aligned}& g(E) \rightarrow c g(E)\\& Z(T) \rightarrow c Z(T)\\& S(T) \rightarrow S(T) + k_B ln(c)\\& F(T) \rightarrow F(T) - k_B T ln(c)\end{aligned}\end{align} \]- Parameters:
- temperatureslist of floats
Temperatures for which the thermodynamic property is calculated, in Kelvin.
- prop_namestr, default U
Name of thermodynamic property.
If U, the internal energy is calculated.
If C_p, the isobaric specific heat at zero pressure is calculated.
If F, the free energy is calculated.
If S, the entropy is calculated.
- modification_factorfloat, default None
If None, the CDOS from the last iteration is used for calculuting the thermodynamic property. If not None, the CDOS corresponding to the given modification factor is used.
- get_cdos(ln=False, normalization=True, normalization_type=0, set_normalization_ln=None, modification_factor=None, discard_empty_bins=True)¶
Returns the energy_bins and configurational density of states (CDOS) as arrays, respectively.
- Parameters:
- lnbool, default False
Whether to return the natural logarithm of the CDOS.
- normalizationbool, default True
Whether to normalize the configurational density of states.
- normalization_typeint, default 0
If
normalizationis true, type of normalization applied. Possible values are:0: \(g(E_{min}) = 1\)1: \(\sum_E g(E) = \sum_{subl.} Binom(N_{sites}, n_{subs})\),i.e. the total weight of the histogram equals the total number of configurations.
2: \(\sum_E g(E) = e^{F}\),where \(F\) is a custom normalization factor given by the argument
set_normalization_ln, see below.
- set_normalization_lnfloat, default None
If not None, the normalization is set by the exponential of the given value. See option
2ofnormalization_type.- discard_empty_binsbool, default True
Whether to keep the energy bins that are not visited during the sampling.
- modification_factorfloat, default None
If None, the CDOS from the last iteration is returned. If not None, the CDOS corresponding to the given modification factor is returned.
- read(filename=None)¶
Read ConfigurationalDensityOfStates object from Json file with name
filename. Iffilenameis not defined, it usesfilenamedefined in the initialization of ConfigurationalDensityOfStates object.
- serialize(filename=None)¶
Write ConfigurationalDensityOfStates object containing the configurational density of states to Json file with name
filename. Iffilenameis not defined, it usesfilenamedefined in the initialization of ConfigurationalDensityOfStates object.
- store_cdos(cdos, f, flatness_condition, hist_cond, n_mc_steps=0, n_mc_steps_total=0, start_time=0)¶
Add entry of configurational of states that is obtained after a flat histgram reached (corresponding to a fixed modification factor \(f\)).