esipy.tools

Module Contents

Functions

wf_type(aom)

Checks the topology of the AOMs to obtain the type of wavefunction.

find_multiplicity(aom)

Checks the topology of the AOMs to get the difference between alpha and beta electrons.

load_file(file)

Loads a variable from a file.

save_file(file, save)

Saves a variable to a file.

find_distances(arr, geom)

Collects the distance between the atoms in ring connectivity.

find_dis(arr, aom)

Collects the DIs between the atoms in ring connectivity.

find_di(aom, i, j)

Collects the DI between two atoms.

find_di_no(aom, i, j)

Collects the DI between two atoms for correlated wavefunctions.

find_lis(arr, aom)

Collects the LIs between the atoms in ring connectivity.

find_ns(arr, aom)

Collects the atomic populations of all the atoms in the ring.

av1245_pairs(arr)

Collects the series of atoms that fulfill the 1-2-4-5 relationship for the AV1245 calculation.

mol_info([mol, mf, save, partition])

Obtains information from the molecule and the calculation to complement the main code function without requiring the 'mol' and 'mf' objects.

format_partition(partition)

Filters the 'partition' attribute for flexibility.

format_short_partition(partition)

Filters the short version of the 'partition' attribute.

mapping(arr, perm)

Maps the elements of a list according to a permutation.

get_natorbs(mf, S)

Obtains the natural orbitals from the SCF calculation.

build_eta(mol)

Builds the eta matrices for the partitioning. They consist of a block-truncated matrix with all elements being

esipy.tools.wf_type(aom)[source]

Checks the topology of the AOMs to obtain the type of wavefunction.

Parameters

aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

Returns

A string with the type of wave function (‘rest’, ‘unrest’ or ‘no’).

Return type

str

esipy.tools.find_multiplicity(aom)[source]

Checks the topology of the AOMs to get the difference between alpha and beta electrons.

Parameters

aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

Returns

A string with the multiplicity of the calculations.

Return type

str

esipy.tools.load_file(file)[source]

Loads a variable from a file.

Parameters

file (str) – Contains the name or the path containing the variable.

Returns

The file loaded.

Return type

object

esipy.tools.save_file(file, save)[source]

Saves a variable to a file.

Parameters
  • file (object) – The variable to be stored.

  • save (str) – The name or the path where the variable will be saved.

Returns

None

esipy.tools.find_distances(arr, geom)[source]

Collects the distance between the atoms in ring connectivity.

Parameters
  • arr (list of int) – Indices of the atoms in ring connectivity.

  • geom (numpy.ndarray) – Geometry of the molecule as in mol.atom_coords().

Returns

List containing the distances of the members of the ring in Bohrs.

Return type

list of float

esipy.tools.find_dis(arr, aom)[source]

Collects the DIs between the atoms in ring connectivity.

Parameters
  • arr (list of int) – Indices of the atoms in ring connectivity.

  • aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

Returns

List containing the DIs of the members of the ring.

Return type

list of float

esipy.tools.find_di(aom, i, j)[source]

Collects the DI between two atoms.

Parameters
  • aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

  • i (int) – Index of the first atom.

  • j (int) – Index of the second atom.

Returns

DI between the atoms i and j.

Return type

float

esipy.tools.find_di_no(aom, i, j)[source]

Collects the DI between two atoms for correlated wavefunctions.

Parameters
  • aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

  • i (int) – Index of the first atom.

  • j (int) – Index of the second atom.

Returns

DI between the atoms i and j.

Return type

float

esipy.tools.find_lis(arr, aom)[source]

Collects the LIs between the atoms in ring connectivity.

Parameters
  • arr (list of int) – Indices of the atoms in ring connectivity.

  • aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

Returns

List containing the DIs of the members of the ring.

Return type

list of float

esipy.tools.find_ns(arr, aom)[source]

Collects the atomic populations of all the atoms in the ring.

Parameters
  • arr (list of int) – Indices of the atoms in ring connectivity.

  • aom (list of matrices) – The Atomic Overlap Matrices (AOMs) in the MO basis.

Returns

List containing the atomic populations of the members of the ring.

Return type

list of float

esipy.tools.av1245_pairs(arr)[source]

Collects the series of atoms that fulfill the 1-2-4-5 relationship for the AV1245 calculation.

Parameters

arr (list of int) – Indices of the atoms in ring connectivity.

Returns

List containing the series of atoms that fulfill the 1-2-4-5 relationship.

Return type

list of tuple

esipy.tools.mol_info(mol=None, mf=None, save=None, partition=None)[source]

Obtains information from the molecule and the calculation to complement the main code function without requiring the ‘mol’ and ‘mf’ objects.

Parameters
  • mol (pyscf.gto.Mole) – PySCF Mole object.

  • mf (pyscf.scf.hf.SCF) – PySCF SCF object.

  • save (str) – String with the name of the file to save the information.

  • partition (str) – String with the name of the partition.

Returns

Dictionary with the information of the molecule and the calculation.

Return type

dict

esipy.tools.format_partition(partition)[source]

Filters the ‘partition’ attribute for flexibility.

Parameters

partition (str) – String with the name of the partition.

Returns

String with the standard partition name for ESIpy.

Return type

str

esipy.tools.format_short_partition(partition)[source]

Filters the short version of the ‘partition’ attribute.

Parameters

partition (str) – String with the name of the partition.

Returns

String with the short version of the partition scheme.

Return type

str

esipy.tools.mapping(arr, perm)[source]

Maps the elements of a list according to a permutation.

Parameters
  • arr (list) – List of elements.

  • perm (list of int) – Permutation of the elements.

Returns

List of elements corresponding to a given permutation.

Return type

list

esipy.tools.get_natorbs(mf, S)[source]

Obtains the natural orbitals from the SCF calculation.

Parameters
  • mf (pyscf.scf.hf.SCF) – PySCF SCF object.

  • S (numpy.ndarray) – Overlap matrix in an AO basis.

Returns

List containing the occupancies and the Natural Orbitals.

Return type

tuple of (numpy.ndarray, numpy.ndarray)

esipy.tools.build_eta(mol)[source]

Builds the eta matrices for the partitioning. They consist of a block-truncated matrix with all elements being zero except for the diagonal elements corresponding to the basis functions of a given atom, which are set to one.

Parameters

mol (pyscf.gto.Mole) – PySCF Mole object.

Returns

List containing the eta matrices for each atom.

Return type

list of numpy.ndarray