basic_occupation_metropolis#

libcasm.monte.methods.basic_occupation_metropolis(
data: BasicOccupationMetropolisData,
temperature: SupportsFloat | SupportsIndex,
potential_occ_delta_per_supercell_f: collections.abc.Callable[[OccEvent], float],
propose_event_f: collections.abc.Callable[[RandomNumberGenerator], OccEvent],
apply_event_f: collections.abc.Callable[[OccEvent], None],
sample_period: SupportsInt | SupportsIndex = 1,
method_log: MethodLog | None = None,
random_engine: RandomNumberEngine = None,
write_status_f: collections.abc.Callable[[BasicOccupationMetropolisData, MethodLog], None] = None,
) None#

Run a basic occupation Metropolis Monte Carlo simulation

Parameters:
  • data (BasicOccupationMetropolisData) – Holds basic occupation Metropolis Monte Carlo run data and results when finished.

  • temperature (float) – The temperature used for the Metropolis algorithm.

  • potential_occ_delta_per_supercell_f (function) – A function with signature def (e: OccEvent) -> float that calculates the change in the potential due to a proposed occupation event.

  • propose_event_f (function) – A function with signature def f(rng: RandomNumberGenerator) -> OccEvent that proposes an event of type OccEvent based on the current state and a random number generator.

  • apply_event_f (function) – A function with signature def f(e: OccEvent) -> None, which applies an accepted event to update the current state.

  • sample_period (int = 1) – Number of passes per sample. One pass is one Monte Carlo step per site with variable occupation.

  • method_log (Optional[MethodLog] = None) – Method log, for writing status updates. If None, default writes to “status.json” every 10 minutes.

  • random_engine (Optional[RandomNumberEngine] = None) – Random number engine. Default constructs a new engine.

  • write_status_f (Optional[function] = None) – Function with signature def f(data: BasicOccupationMetropolisData, method_log: MethodLog) -> None that writes status updates, after a new sample has been taken and is due according to method_log.log_frequency(). Default writes the current completion check results to method_log.logfile_path() and prints a summary to stdout.