mcal package¶
Subpackages¶
- mcal.calculations package
- mcal.utils package
- Submodules
- mcal.utils.cif_reader module
- mcal.utils.gaus_log_reader module
- mcal.utils.gjf_maker module
GjfMakerGjfMaker.ELEMENTS_NUMGjfMaker.ELEMENT_PROPGjfMaker.add_link()GjfMaker.add_root()GjfMaker.create_chk_file()GjfMaker.create_rwf_file()GjfMaker.export_gjf()GjfMaker.opt()GjfMaker.output_detail()GjfMaker.parent_dirGjfMaker.reset_variable()GjfMaker.set_charge_spin()GjfMaker.set_coordinates()GjfMaker.set_function()GjfMaker.set_resource()GjfMaker.set_symbols()GjfMaker.set_title()
- Module contents
Submodules¶
mcal.mcal module¶
mcal
- mcal.mcal.atom_weight(symbol: str) float[source]¶
Get atom weight
- Parameters:
symbol (str) – Symbol of atom
- Returns:
Atomic weight
- Return type:
float
- mcal.mcal.cal_cen_of_weight(symbols1: ndarray[Any, dtype[str]], coordinates1: ndarray[Any, dtype[float64]], symbols2: ndarray[Any, dtype[str]] | None = None, coordinates2: ndarray[Any, dtype[float64]] | None = None) ndarray[Any, dtype[float64]][source]¶
Calculate center of weight
- Parameters:
symbols1 (NDArray[str]) – Symbols of atoms in one monomer
coordinates1 (NDArray[np.float64]) – Coordinates of atoms in one monomer
symbols2 (Optional[NDArray[str]], optional) – Symbols of atoms in another monomer, by default None
coordinates2 (Optional[NDArray[np.float64]], optional) – Coordinates of atoms in another monomer, by default None
- Returns:
Center of weight
- Return type:
NDArray[np.float64]
- mcal.mcal.cal_distance_between_cen_of_weight(symbols1: ndarray[Any, dtype[str]], coordinates1: ndarray[Any, dtype[float64]], symbols2: ndarray[Any, dtype[str]], coordinates2: ndarray[Any, dtype[float64]]) float[source]¶
Calculate distance between centers of weight
- Parameters:
symbols1 (NDArray[str]) – Symbols of atoms in one monomer
coordinates1 (NDArray[np.float64]) – Coordinates of atoms in one monomer
symbols2 (NDArray[str]) – Symbols of atoms in another monomer
coordinates2 (NDArray[np.float64]) – Coordinates of atoms in another monomer
- Returns:
Distance between centers of weight
- Return type:
float
- mcal.mcal.cal_eigenvalue_decomposition(mobility_tensor: ndarray[Any, dtype[float64]]) Tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]][source]¶
Calculate eigenvalue decomposition of mobility tensor
- Parameters:
mobility_tensor (NDArray[np.float64]) – Mobility tensor
- Returns:
Eigenvalue(mobility value) and eigenvector(mobility vector)
- Return type:
Tuple[NDArray[np.float64], NDArray[np.float64]]
- mcal.mcal.cal_min_distance(symbols1: ndarray[Any, dtype[str]], coords1: ndarray[Any, dtype[float64]], symbols2: ndarray[Any, dtype[str]], coords2: ndarray[Any, dtype[float64]]) float[source]¶
Calculate minimum distance between two sets of atoms.
- Parameters:
symbols1 (NDArray[str]) – Symbols of atoms in one monomer
coords1 (NDArray[np.float64]) – Coordinates of atoms in one monomer
symbols2 (NDArray[str]) – Symbols of atoms in another monomer
coords2 (NDArray[np.float64]) – Coordinates of atoms in another monomer
- Returns:
Minimum distance between two sets of atoms
- Return type:
float
- mcal.mcal.cal_moment_of_inertia(symbols1: ndarray[Any, dtype[str]], coordinates1: ndarray[Any, dtype[float64]], symbols2: ndarray[Any, dtype[str]], coordinates2: ndarray[Any, dtype[float64]]) Tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]][source]¶
Calculate moment of inertia and eigenvectors of the inertia tensor.
- Parameters:
symbols1 (NDArray[str]) – Symbols of atoms in one monomer
coordinates1 (NDArray[np.float64]) – Coordinates of atoms in one monomer
symbols2 (NDArray[str]) – Symbols of atoms in another monomer
coordinates2 (NDArray[np.float64]) – Coordinates of atoms in another monomer
- Returns:
Moment of inertia and eigenvectors of the inertia tensor
- Return type:
Tuple[NDArray[np.float64], NDArray[np.float64]]
- mcal.mcal.check_reorganization_energy_completion(cif_path_without_ext: str, osc_type: Literal['p', 'n'], extension_log: str = '.log') List[Literal['opt_neutral', 'opt_ion', 'neutral', 'ion']][source]¶
Check if all reorganization energy calculations are completed normally.
- Parameters:
cif_path_without_ext (str) – Base path of cif file (without extension)
osc_type (Literal['p', 'n']) – Semiconductor type (p-type or n-type)
extension_log (str) – Extension of log file
- Returns:
List of calculations to skip
- Return type:
List[Literal[‘opt_neutral’, ‘opt_ion’, ‘neutral’, ‘ion’]]
- mcal.mcal.check_transfer_integral_completion(gjf_file: str, extension_log: str = '.log') bool[source]¶
Check if all transfer integral calculations are completed normally.
- Parameters:
gjf_file (str) – Base path of gjf file (without extension)
- Returns:
True if all calculations (dimer, monomer1, monomer2) terminated normally
- Return type:
bool
- mcal.mcal.create_reorg_gjf(symbols: ndarray[Any, dtype[str]], coordinates: ndarray[Any, dtype[float64]], basename: str, save_dir: str, cpu: int, mem: int, method: str) None[source]¶
Create gjf file for reorganization energy calculation.
- Parameters:
symbols (NDArray[str]) – Symbols of atoms
coordinates (NDArray[np.float64]) – Coordinates of atoms
basename (str) – Base name of gjf file
save_dir (str) – Directory to save gjf file
cpu (int) – Number of cpu
mem (int) – Number of memory [GB]
method (str) – Calculation method used in Gaussian calculations
- mcal.mcal.create_ti_gjf(unique_mol: Dict[str, ndarray[Any, dtype[str]] | ndarray[Any, dtype[float64]]], neighbor_mol: Dict[str, ndarray[Any, dtype[str]] | ndarray[Any, dtype[float64]]], gjf_basename: str, save_dir: str = '.', cpu: int = 4, mem: int = 16, method: str = 'B3LYP/6-31G*') None[source]¶
Create gjf file for transfer integral calculation.
- Parameters:
unique_mol (Dict[str, Union[NDArray[str], NDArray[np.float64]]]) – Dictionary containing symbols and coordinates of unique monomer
neighbor_mol (Dict[str, Union[NDArray[str], NDArray[np.float64]]]) – Dictionary containing symbols and coordinates of neighbor monomer
gjf_basename (str) – Base name of gjf file
save_dir (str) – Directory to save gjf file, by default ‘.’
cpu (int) – Number of cpu, by default 4
mem (int) – Number of memory [GB], by default 16
method (str) – Calculation method used in Gaussian calculations, by default ‘B3LYP/6-31G(d,p)’
- mcal.mcal.main()[source]¶
Calculate mobility tensor considering anisotropy and path continuity.
Examples
- Basic usage:
Calculate p-type mobility for xxx crystal
$ mcal xxx.cif p
Calculate n-type mobility for xxx crystal
$ mcal xxx.cif n
- With resource options:
Use 8 CPUs and 16GB memory
$ mcal xxx.cif p -c 8 -m 16
Use different calculation method (default is B3LYP/6-31G(d,p))
$ mcal xxx.cif p -M “B3LYP/6-311G(d,p)”
- High-precision calculation:
Calculate all transfer integrals without speedup using moment of inertia and distance between centers of weight
$ mcal xxx.cif p –fullcal
Expand calculation range to 5x5x5 supercell to widen transfer integral calculation range
$ mcal xxx.cif p –cellsize 2
- Resume and save results:
Resume from existing calculations
$ mcal xxx.cif p –resume
Save results to pickle file
$ mcal xxx.cif p –pickle
Read results from existing pickle file
$ mcal xxx_result.pkl p -rp
Read results from existing log files without running Gaussian
$ mcal xxx.cif p -r
- Plot mobility tensor in 2D plane:
Plot mobility tensor in 2D plane (Examples: ab, ac, ba, bc, ca, cb (default is ab))
$ python hop_mcal.py xxx.cif p –plot-plane ab
- Compare calculation methods:
Compare results using kinetic Monte Carlo and ODE methods
$ python hop_mcal.py xxx.cif p –mc –ode
- mcal.mcal.plot_mobility_2d(save_path: Path, mobility_tensor: ndarray[Any, dtype[float64]], lattice: ndarray[Any, dtype[float64]], plane: Literal['ab', 'ac', 'ba', 'bc', 'ca', 'cb'] = 'ab') None[source]¶
Plot mobility tensor in 2D plane.
- Parameters:
save_path (Path) – Path to save the plot
mobility_tensor (NDArray[np.float64]) – Mobility tensor
lattice (NDArray[np.float64]) – Lattice vectors [Å]
plane (Literal['ab', 'ac', 'ba', 'bc', 'ca', 'cb']) – Plane to plot, by default ‘ab’
- mcal.mcal.print_mobility(value: ndarray[Any, dtype[float64]], vector: ndarray[Any, dtype[float64]], sim_type: Literal['MC', 'ODE'] = '')[source]¶
Print mobility and mobility vector
- Parameters:
value (NDArray[np.float64]) – Mobility value
vector (NDArray[np.float64]) – Mobility vector
sim_type (str) – Simulation type (MC or ODE)
- mcal.mcal.print_reorg_energy(osc_type: Literal['p', 'n'], reorg_energy: float)[source]¶
Print reorganization energy
- Parameters:
osc_type (Literal['p', 'n']) – Semiconductor type (p-type or n-type)
reorg_energy (float) – Reorganization energy [eV]
- mcal.mcal.print_tensor(mu: ndarray[Any, dtype[float64]], msg: str = 'Mobility tensor')[source]¶
Print mobility tensor
- Parameters:
mu (NDArray[np.float64]) – Mobility tensor
msg (str) – Message, by default ‘Mobility tensor’
- mcal.mcal.print_transfer_integral(osc_type: Literal['p', 'n'], transfer: float)[source]¶
Print transfer integral
- Parameters:
osc_type (Literal['p', 'n']) – Semiconductor type (p-type or n-type)
transfer (float) – Transfer integral [eV]
- mcal.mcal.read_pickle(file_name: str, plot_plane: Literal['ab', 'ac', 'ba', 'bc', 'ca', 'cb'] | None = None) None[source]¶
Read pickle file and plot mobility tensor in 2D plane.
- Parameters:
file_name (str) – Path to the pickle file
plot_plane (Optional[Literal['ab', 'ac', 'ba', 'bc', 'ca', 'cb']]) – Plane to plot, by default None