run#

SemiGrandCanonicalCalculator.run(
self: SemiGrandCanonicalCalculator,
state: IsingState,
sampling_functions: StateSamplingFunctionMap,
json_sampling_functions: jsonStateSamplingFunctionMap,
completion_check_params: CompletionCheckParams,
event_generator: SemiGrandCanonicalEventGenerator,
sample_period: int = 1,
method_log: MethodLog | None = None,
random_engine: RandomNumberEngine = None,
write_status_f: Callable[[SemiGrandCanonicalCalculator, MethodLog], None] | None = None,
) None#

Run a semi-grand canonical calculation at a single thermodynamic state

Notes

On completion, results can be obtained from the data attribute.

Parameters:
  • state (IsingState) – Initial Monte Carlo state, including configuration and conditions. Is modified by the method.

  • sampling_functions (StateSamplingFunctionMap) – The sampling functions to use

  • json_sampling_functions (jsonStateSamplingFunctionMap) – The JSON sampling functions to use

  • completion_check_params (CompletionCheckParams) – Controls when the run finishes

  • event_generator (jsonStateSamplingFunctionMap) – An event generator which proposes new events and applies accepted events.

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

  • method_log (MethodLog) – Method log, for writing status updates. If None, default writes to a “status.json” file in the current working directory every 10 minutes.

  • random_engine (RandomNumberEngine) – Random number engine. Default constructs a new engine.

  • write_status_f (Optional[Callable] = None) –

    Function with signature

    def f(
        mc_calculator: SemiGrandCanonicalCalculator,
        method_log: MethodLog,
    ) -> None:
        ...
    

    accepting self as the first argument, that writes status updates, after a new sample has been taken and due according to method_log.log_frequency(). Default uses default_write_status(), which writes the current completion check results to method_log.logfile_path() and prints a summary of the current state and sampled data to stdout.