ocal package

Subpackages

Submodules

ocal.ocal module

ocal: single-molecule orbital tail fraction (OTF) calculator.

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 OTF results; only Ocal._create_gjf(method=...) may override.

ocal.ocal.main()[source]

Run the ocal CLI: compute OTF 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) 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 NHOMO/HOMO/LUMO/NLUMO cube files with cubegen.

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

Raises:

RuntimeError – If cubegen fails for any orbital.

Return type:

None

calc_otf()[source]

Compute OTF and density_sum for the target cube file(s).

Returns:

Mapping of orbital label (or cube stem) to (otf, density_sum).

Return type:

dict[str, tuple[float, float]]

Module contents

ocal: program for the calculation of orbital tail fraction (OTF).