io

IO takes dictionary like object and convert them into json writable string

Author: Zeyu Deng Email: dengzeyu@gmail.com

class kmcpy.io.InputSet(_parameters={}, api=1)[source]

a flexible input set class for running KMC just a dictionary

change_key_name(oldname='lce', newname='lce_fname')[source]

change the key name from old name to new name for self._parameters

Parameters:
  • oldname (str) – defined name in self._parameters

  • newname (str) – new name

enumerate(**kwargs)[source]

generate a new InputSet from the input kwargs

Inputs:

for example: InputSet.enumerate(T=298.15)

Returns:

a InputSet class with modified parameters

Return type:

InputSet

classmethod from_json(input_json_path='examples/test_input.json', verbose=False, api=1)[source]

input_reader takes input (a json file with all parameters as shown in run_kmc.py in examples folder) return a dictionary with all input parameters if verbose=True, then print the parameters

parameter_checker()[source]

a rough parameter checker to make sure that there is enough parameters to run a job

Raises:

ValueError – In case that parameter is not defined in the self._parameters

report_parameter(format='equation')[source]

report_parameter, to print the parameters of this input set. This is only for development convenience

for example: the output of a default input set is :v= 5000000000000,equ_pass= 1,kmc_pass= 1000,supercell_shape= [2, 1, 1],fitting_results=’./inputs/fitting_results.json’,fitting_results_site=’./inputs/fitting_results_site.json’,lce_fname=’./inputs/lce.json’,lce_site_fname=’./inputs/lce_site.json’,prim_fname=’./inputs/prim.json’,event_fname=’./inputs/events.json’,event_kernel=’./inputs/event_kernal.csv’,mc_results=’./initial_state.json’,T= 298,comp= 1,structure_idx= 1,occ= [-1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1]. :type format: :param format: “equation” or “dict”. If format=dict, then print a python dict. format=equation: print equations that is capable for kwargs. Defaults to “equation”. :type format: str, optional

set_parameter(key_to_change='T', value_to_change=273.15)[source]

_summary_

Parameters:
  • key_to_change (str, optional) – the key to change in the parameters. Defaults to “T”.

  • value_to_change (any, optional) – any type that json can read. Defaults to 273.15.

kmcpy.io.load_occ(fname='./initial_state.json', shape=[2, 1, 1], select_sites=[0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 16, 17], api=1, verbose=False, **kwargs)[source]

load occupation data

Parameters:
  • fname (str, optional) – initial occupation that also includes immutable site(for example, Zr, O). Defaults to “./initial_state.json”.

  • shape (list, optional) – supercell shape. Defaults to [2,1,1].

  • select_sites (list, optional) – all the sites included in kinetic monte carlo process, i.e., this is the list include only the indices of Na, Si, P (no Zr and O) in the Na1+xZr2P3-xSixO12. . Defaults to [0,1,2,3,4,5,6,7,12,13,14,15,16,17].

  • api (int, optional) – version. Defaults to 1.

  • verbose (bool, optional) – verbose output. Defaults to False.

Raises:

ValueError

Returns:

list of 1 and -1 states, the initial occupation data of sites included in KMC, for example, Na, Si, P initial states in NZSP

Return type:

chebyshev occupation