ocal package

Subpackages

Submodules

ocal.ocal module

ocal: single-molecule orbital tail fraction (OTF) and participation ratio (PR) calculator.

Reports the orbital tail fraction (OTF) and the participation ratio PR(ų), together with the supplementary PR per molecular volume PR(ų) / V_vdW(ų), where V_vdW is the all-atom vdW-sphere union volume.

Assumes a neutral closed-shell molecule (charge/spin fixed to 0 1). Input charge/spin information in structure files is ignored. Gaussian functional/basis is fixed to B3LYP/6-31G(d,p) for comparability with previous results; only Ocal._create_gjf(method=...) may override.

Cube inputs must be Gaussian cubegen MO cubes with a Bohr-unit, orthogonal grid. Å-unit and non-orthogonal grids are rejected.

ocal.ocal.main()[source]

Run the ocal CLI: compute OTF and PR for one molecule from a structure, fchk, or cube.

Return type:

None

ocal.ocal.parse_args()[source]

Parse command-line arguments.

Returns:

The parser (for parser.error) and parsed arguments.

Return type:

tuple[argparse.ArgumentParser, argparse.Namespace]

class ocal.ocal.Ocal(file, cpu=4, mem=10)[source]

Bases: object

Calculate orbital tail fraction (OTF) and participation ratio (PR) for a single molecule.

Charge and spin multiplicity are fixed to 0 1 (neutral singlet). Structure-file inputs always run Opt=Tight at B3LYP/6-31G(d,p).

Parameters:
static check_normal_termination(log_file)[source]

Check whether a Gaussian log ended with normal termination.

Parameters:

log_file (str) – Path to the Gaussian log file.

Returns:

True if the calculation terminated normally.

Return type:

bool

static print_timestamp()[source]

Print timestamp.

Return type:

None

create_gjf()[source]

Read the structure file and write a Gaussian input (.gjf).

Return type:

None

run_gaussian(gau_com='g16')[source]

Run Gaussian on the generated gjf.

The subprocess runs with cwd set to the work directory and a relative gjf filename so Windows Gaussian does not concatenate an absolute path onto the current directory.

Parameters:

gau_com (str) – Gaussian executable name (default g16). Stored on the instance as gau_com for future CLI extension (e.g. g09).

Raises:

RuntimeError – If the subprocess fails, no .log/.out is found, or the log does not show normal termination.

Return type:

None

create_fchk()[source]

Convert the checkpoint file to a formatted checkpoint via formchk.

Raises:

RuntimeError – If formchk fails.

Return type:

None

create_cube()[source]

Generate NLUMO/LUMO/HOMO/NHOMO cube files with cubegen.

MO indices are derived from the number of alpha electrons na in the fchk: NLUMO=na+2, LUMO=na+1, HOMO=na, NHOMO=na-1.

Raises:

RuntimeError – If cubegen fails for any orbital.

Return type:

None

calc_otf_pr()[source]

Compute OTF, PR, and related quantities for the target cube file(s).

For the four-orbital path, the vdW union volume from the first orbital is reused for the remaining three (same molecule).

Returns:

Mapping of orbital label (or cube stem) to its metrics.

Return type:

dict[str, CubeMetrics]

Module contents

ocal: program for the calculation of orbital tail fraction (OTF) and participation ratio (PR).