CompletionCheckParams#
- class libcasm.monte.sampling.CompletionCheckParams(
- self: CompletionCheckParams,
- requested_precision: RequestedPrecisionMap | None = None,
- cutoff_params: CutoffCheckParams | None = None,
- calc_statistics_f: Callable[[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]]], BasicStatistics] = None,
- equilibration_check_f: Callable[[numpy.ndarray[numpy.float64[m, 1]], numpy.ndarray[numpy.float64[m, 1]], RequestedPrecision], IndividualEquilibrationResult] = None,
- log_spacing: bool = False,
- check_begin: int | None = None,
- check_period: int | None = None,
- check_base: float | None = None,
- check_shift: float | None = None,
- check_period_max: int | None = None,
Bases:
pybind11_object
Parameters that determine if a simulation is complete
CompletionCheckParams allow:
setting the requested precision for convergence of sampled data
setting cutoff parameters, forcing the simulation to keep running to meet certain minimums (number of steps or passes, number of samples, amount of simulated time or elapsed clocktime), or stop when certain maximums are met
controlling when completion checks are performed
customizing the method used to calculate statistics
customizing the method used to check for equilibration.
Constructor
- Parameters:
requested_precision (Optional[RequestedPrecisionMap] = None) – Requested precision for convergence of sampler components. When all components reach the requested precision, and all cutoff_params minimums are met, then the completion check returns True, indicating the Monte Carlo simulation is complete.
cutoff_params (Optional[CutoffCheckParams] = None,) – Cutoff check parameters allow setting limits on the Monte Carlo simulation to prevent calculations from stopping too soon or running too long. If None, no cutoffs are applied.
calc_statistics_f (Optional[Callable] = None,) –
A function for calculating
BasicStatistics
from sampled data, with signature:def calc_statistics_f( observations: np.ndarray, sample_weight: np.ndarray, ) -> libcasm.monte.BasicStatistics: ...
If None, the default is
BasicStatisticsCalculator
.equilibration_check_f (Optional[Callable] = None,) –
A function for checking equilibration of sampled data, with signature:
def equilibration_check_f( observations: np.ndarray, sample_weight: np.ndarray, requested_precision: libcasm.monte.RequestedPrecision, ) -> libcasm.monte.IndividualEquilibrationResult: ...
If None, the default is
default_equilibration_check
.log_spacing (bool = False) –
If True, use logarithmic spacing for completion checking; else use linear spacing. For linear spacing, the n-th check (n=0,1,2,…) will be taken when:
sample = check_begin + check_period * n
For logarithmic spacing, the n-th check will be taken when:
sample = check_begin + round( check_base ** (n + check_shift) )
However, if check(n) - check(n-1) > check_period_max, then subsequent checks are made every check_period_max samples.
For linear spacing, the default is to check for completion after 100, 200, 300, etc. samples are taken.
For log spacing, the default is to check for completion after 100, 1000, 10000, 20000, 30000, etc. samples are taken (note the effect of the default
check_period_max=10000
).The default value is False, for linear spacing.
check_period (Optional[int] = None) – The linear completion checking period. Default is 100.
check_begin (Optional[int] = None) – The earliest sample to begin completion checking. Default is check_period for linear spacing and 0 for log spacing.
check_base (Optional[float] = None) – The logarithmic completion checking base. Default is 10.
check_shift (Optional[float] = None) – The shift for the logarithmic spacing exponent. Default is 2.
check_period_max (Optional[int] = None) – The maximum check spacing for logarithmic check spacing. Default is 10000.
Methods
Construct a CompletionCheckParams from a Python dict.
Attributes
Function to calculate statistics.
The logarithmic completion checking base.
Earliest number of samples to begin completion checking.
The linear completion checking period.
The maximum check spacing for logarithmic check spacing.
The shift for the logarithmic spacing exponent.
Cutoff check parameters
Function that performs equilibration checking.
If True, use logirithmic spacing for completiong checking; else use linear spacing.
Requested precision for convergence of sampler components.