mcal.calculations package

Submodules

mcal.calculations.hopping_mobility_model module

hopping_mobility_model.py (2026/01/29)

mcal.calculations.hopping_mobility_model.cal_pinv(array: ndarray[Any, dtype[float64]], rcond: float = 0.001) ndarray[Any, dtype[float64]][source]

Calculate pseudo-inverse matrix using eigenvalue decomposition

Parameters:
  • array (NDArray[np.float64]) – Input matrix

  • rcond (float, optional) – Cutoff for small singular values, by default 1e-9

Returns:

Pseudo-inverse matrix

Return type:

NDArray[np.float64]

Raises:
  • ValueError – The last eigenvalue is not zero.

  • ValueError – All eigenvalues except the last one should be negative.

mcal.calculations.hopping_mobility_model.demo()[source]
mcal.calculations.hopping_mobility_model.diffusion_coefficient_tensor(lattice: ndarray[Any, dtype[float64]], hop: List[Tuple[int, int, int, int, int, float]]) ndarray[Any, dtype[float64]][source]

Calculate diffusion coefficient tensor from hopping rate

Parameters:
  • lattice (3x3 numpy.array) – lattice[0,:] is a-axis vector, lattice[1,:] b-axis vector, lattice[2,:] c-axis vector

  • hop (list of (int, int, int, int, int, float) tuple.) – (s, t, i, j, k, p) means that the hopping rate from s-th molecule in (0, 0, 0) cell to t-th molecule in (i, j, k) cell is p.

Returns:

Diffusion coefficient tensor

Return type:

3x3 numpy.array

mcal.calculations.hopping_mobility_model.marcus_rate(transfer: float, reorganization: float, T: float = 300.0) float[source]

Calculate hopping rate (1/s) from transfer integral (eV) and reorganization energy (eV)

Parameters:
  • transfer (float) – Transfer integral [eV]

  • reorganization (float) – Reorganization energy [eV]

  • T (float) – Temperature [K], by default 300.0

Returns:

Hopping rate [1/s]

Return type:

float

mcal.calculations.hopping_mobility_model.mobility_tensor(D: ndarray[Any, dtype[float64]], T: float = 300.0) ndarray[Any, dtype[float64]][source]

Calculate mobility tensor from diffusion coefficient tensor

Parameters:
  • D (3x3 numpy.array) – Diffusion coefficient tensor

  • T (float) – Temperature [K], by default 300.0

Returns:

Mobility tensor

Return type:

3x3 numpy.array

mcal.calculations.hopping_mobility_model.print_tensor(tensor: ndarray[Any, dtype[float64]], msg: str = 'Mobility tensor')[source]

mcal.calculations.rcal module

Rcal

exception mcal.calculations.rcal.GausTermError[source]

Bases: Exception

Exception for Gaussian error termination.

exception mcal.calculations.rcal.OSCTypeError[source]

Bases: Exception

Exception for organic semiconductor type.

class mcal.calculations.rcal.Rcal(input_file: str, osc_type: Literal['p', 'n'] = 'p', fmt='gjf')[source]

Bases: object

Calculate reorganization energy.

calc_reorganization(gau_com: str = 'g16', only_read: bool = False, is_output_detail: bool = False, skip_specified_cal: List[Literal['opt_neutral', 'opt_ion', 'neutral', 'ion']] = []) float[source]

Calculate reorganization energy.

Parameters:
  • gau_com (str) – Gaussian command, by default ‘g16’.

  • only_read (bool) – if True, the calculation is only read, by default False.

  • is_output_detail (bool) – if True, the calculation detail will be output, by default False.

  • skip_specified_cal (List[Literal['opt_neutral', 'opt_ion', 'neutral', 'ion']]) – if specified, the calculation of the specified type will be skipped, by default [].

Returns:

reorganization energy [eV].

Return type:

float

static check_error_term(line: str) None[source]

Check the error term of Gaussian.

Parameters:

line (str) – last line of the log file.

Raises:

GausTermError – if the calculation of Gaussian was error termination.

check_extension_log(gjf: str) None[source]

Check the extension of log file.

Parameters:

gjf (str) – gjf file name.

extract_energy(gjf: str, only_read: bool = False, is_output_detail: bool = False, skip_cal: bool = False) float[source]

Extract energy from log file.

Parameters:
  • gjf (str) – gjf file name.

  • only_read (bool) – if True, the calculation is only read, by default False.

  • is_output_detail (bool) – if True, the calculation detail will be output, by default False.

Returns:

total energy.

Return type:

float

static print_timestamp() None[source]

Print timestamp.

mcal.calculations.rcal.main()[source]

This code is to execute rcal for command line.

mcal.calculations.rcal_pyscf module

RcalPySCF

class mcal.calculations.rcal_pyscf.RcalPySCF(xyz_file: str, osc_type: Literal['p', 'n'] = 'p', method: str = 'B3LYP/6-31G(d,p)', use_gpu: bool = False, ncore: int = 4, max_memory_gb: int = 16, cart: bool = False)[source]

Bases: Rcal

Calculate reorganization energy using PySCF.

HARTREE_TO_EV = 27.2114
calc_reorganization(gau_com: str = 'g16', only_read: bool = False, is_output_detail: bool = False, skip_specified_cal: List[Literal['opt_neutral', 'opt_ion', 'neutral', 'ion']] = []) float[source]

Calculate reorganization energy.

Parameters:
  • gau_com (str) – Ignored. Kept for interface compatibility with Rcal.

  • only_read (bool) – If True, load results from existing checkpoint files without running calculations.

  • is_output_detail (bool) – If True, print energy details for each step.

  • skip_specified_cal (List[Literal['opt_neutral', 'opt_ion', 'neutral', 'ion']]) – Steps to skip (load from existing files instead of running).

Returns:

Reorganization energy [eV].

Return type:

float

Module contents