tcal module

Tcal

class tcal.PairAnalysis(apta)[source]

Bases: object

Analyze atomic pair transfer integrals.

print_element_pairs()[source]

Print element pairs.

print_largest_pairs()[source]

Print largest pairs.

class tcal.Tcal(file, monomer1_atom_num=-1)[source]

Bases: object

Calculate transfer integrals.

EV = 27211.38456571948
atomic_pair_transfer_analysis(analyze_orbital='HOMO', output_apta=False)[source]

Calculate atomic pair transfer integrals.

Parameters:
  • analyze_orbital (str, optional) – Analyze orbital., default ‘HOMO’

  • output_apta (bool, optional) – If it is True, output csv file of atomic pair transfer integrals., default False

static cal_transfer_integrals(bra, overlap, fock, ket)[source]

Calculate intermolecular transfer integrals.

Parameters:
  • bra (numpy.array) – MO coefficients of one molecule.

  • overlap (numpy.array) – Overlap matrix of dimer.

  • fock (numpy.array) – Fock matrix of dimer.

  • ket (numpy.array) – MO coefficients of the other molecule.

Returns:

Intermolecular transfer integrals.

Return type:

double

check_extension_log()[source]

Check the extension of log file.

static check_normal_termination(reader)[source]

Whether the calculation of gaussian was successful or not.

Parameters:

reader (_io.TextIOWrapper) – Return value of open function.

Returns:

Return value of function.

Return type:

_io.TextIOWrapper

Examples

>>> with open('sample.log', 'r') as f:
...     f = Tcal.check_normal_termination(f)
convert_xyz_to_gjf(function='B3LYP/6-31G(d,p)', nprocshared=4, mem=16, unit='GB')[source]

Convert xyz file to gjf file.

Parameters:
  • function (str, optional) – _description_, default ‘b3lyp/6-31g(d,p)’

  • nprocshared (int, optional) – The number of nprocshared., default 4

  • mem (int, optional) – The number of memory., default 16

  • unit (str, optional) – The unit of memory., default ‘GB’

create_cube_file()[source]

Create cube file.

create_monomer_file()[source]

Create gjf files of monomer from gjf file of dimer.

custom_atomic_pair_transfer_analysis(analyze_orb1, analyze_orb2, output_apta=False)[source]

Calculate atomic pair transfer integrals.

Parameters:
  • analyze_orb1 (int, optional) – Analyze orbital., default -1

  • analyze_orb2 (int, optional) – Analyze orbital., default -1

  • output_apta (bool, optional) – If it is True, output csv file of atomic pair transfer integrals., default False

static extract_coordinates(reader)[source]

Extract coordinates from gjf file of dimer.

Parameters:

reader (_io.TextIOWrapper) – Return value of open function.

Returns:

  • _io.TextIOWrapper – Return value of open function.

  • list – The list of coordinates.

Examples

>>> import re
>>> with open(f'sample.gjf', 'r') as f:
...     while True:
...         line = f.readline()
...         if not line:
...             break
...         if re.search('[-0-9]+ [0-3]', line):
...             f, coordinates = Tcal.extract_coordinates(f)
static extract_num(pattern, line, idx=0)[source]

Extract integer in strings.

Parameters:
  • pattern (str) – Strings using regular expression.

  • line (str) – String of target.

Returns:

If there is integer, return it.

Return type:

int or None

static output_csv(file_name, array)[source]

Output csv file of array.

Parameters:
  • file_name (str) – File name including extension.

  • array (array_like) – Array to create csv file.

print_apta(a_transfer, message='Atomic Pair Transfer Analysis')[source]

Create list of apta and print it.

Parameters:
  • a_transfer (numpy.array) – Result of atomic pair transfer analysis.

  • message (str, optional) – Message to print., default ‘Atomic Pair Transfer Analysis’

Returns:

The array of atomic pair transfer analysis.

Return type:

numpy.array

static print_matrix(matrix)[source]

Print matrix.

Parameters:

matrix (array_like)

static print_timestamp()[source]

Print timestamp.

print_tranfer_integral_diff_levels(nlevel, output_ti_diff_levels=False)[source]
print_transfer_integrals()[source]

Print transfer integrals of NLUMO, LUMO, HOMO and NHOMO.

read_dimer(is_matrix=False, output_matrix=False)[source]

Extract overlap and fock matrix from log file of dimer.

Parameters:
  • is_matrix (bool, optional) – If it is True, print overlap and fock matrix., default False

  • output_matrix (bool, optional) – If it is True, Output overlap and fock matrix., default False

static read_matrix(reader, n_basis, n_bsuse)[source]

Read matrix.

Parameters:
  • reader (_io.TextIOWrapper) – Return value of open function.

  • n_basis (int) – The number of row.

  • n_bsuse (int) – The number of column.

Returns:

Read matrix like MO coefficients.

Return type:

numpy.array

read_monomer1(is_matrix=False, output_matrix=False)[source]

Extract MO coefficients from log file of monomer.

Parameters:
  • is_matrix (bool, optional) – If it is True, print MO coefficients., default False

  • output_matrix (bool, optional) – If it is True, Output MO coefficients., default False

read_monomer2(is_matrix=False, output_matrix=False)[source]

Extract MO coefficients from log file of monomer.

Parameters:
  • is_matrix (bool, optional) – If it is True, print MO coefficients., default False

  • output_matrix (bool, optional) – If it is True, Output MO coefficients., default False

static read_symmetric_matrix(reader, n_basis)[source]

Read symmetric matrix.

Parameters:
  • reader (_io.TextIOWrapper) – Return value of open function.

  • n_basis (int) – The number of column or row.

Returns:

Read symmetrix matrix like overlap or fock matrix.

Return type:

numpy.array

run_gaussian(gaussian_command, skip_monomer_num=[0])[source]

Execute gjf files using gaussian.

Parameters:
  • gaussian_command (str) – Command of gaussian.

  • skip_monomer_num (list[int], optional) – If it is 1, skip 1st monomer calculation. If it is 2, skip 2nd monomer calculation. If it is 3, skip dimer calculation.

Returns:

Returncode of subprocess.run.

Return type:

int

tcal.main()[source]

This code is to execute tcal for command line.