run_kmc

kmcpy.cli.run_kmc.main()[source]

Entry point for the kMCpy command-line interface to run kinetic Monte Carlo (kMC) simulations.

This function parses command-line arguments for running a kMC simulation using kMCpy. It supports two modes of input:

  1. Providing a single JSON/YAML file containing all simulation parameters.

  2. Providing individual arguments for each required parameter.

If a JSON/YAML input file is provided, all other parameters are read from this file. Otherwise, the user must specify all required arguments individually.

Parameters:
  • input (str, optional) – Path to the input JSON/YAML file for kMC simulation. If provided, all other parameters are read from this file.

  • supercell_shape (str) – Shape of the supercell as a list of integers (e.g., [2, 2, 2]). Required if input file is not provided.

  • model_file (str) – Path to model JSON file. Files written by model.to(…) include class metadata. Required if input file is not provided.

  • structure_file (str) – Path to the CIF file of the template structure (with all sites filled). Required if input file is not provided.

  • event_file (str) – Path to the JSON file containing the list of events. Required if input file is not provided.

  • attempt_frequency (float, optional) – Attempt frequency (prefactor) for hopping events. Defaults to 1e13 Hz.

  • temperature (float, optional) – Simulation temperature in Kelvin. Defaults to 300 K.

  • convert_to_primitive_cell (bool, optional) – Whether to convert the structure to its primitive cell. Defaults to False.

Return type:

None

Returns:

None

kmcpy.cli.run_kmc.run_kmc(args)[source]

Runs the kinetic Monte Carlo (KMC) simulation based on the provided arguments.

This function initializes the simulation input either from a JSON/YAML file or directly from the command-line arguments, constructs the KMC simulation object, and executes the simulation.

Parameters:

args (argparse.Namespace) – Parsed command-line arguments. If ‘input’ is provided, it should be a path to a JSON/YAML file containing the simulation parameters. Otherwise, parameters are taken directly from the other attributes of ‘args’.

Return type:

None

Returns:

None