esipy.tools¶
Module Contents¶
Functions¶
|
Checks the topology of the AOMs to obtain the type of wavefunction. |
|
Checks the topology of the AOMs to get the difference between alpha and beta electrons. |
|
Loads a variable from a file. |
|
Saves a variable to a file. |
|
Collects the distance between the atoms in ring connectivity. |
|
Collects the DIs between the atoms in ring connectivity. |
|
Collects the DI between two atoms. |
|
Collects the DI between two atoms for correlated wavefunctions. |
|
Collects the LIs between the atoms in ring connectivity. |
|
Collects the atomic populations of all the atoms in the ring. |
|
Collects the series of atoms that fulfill the 1-2-4-5 relationship for the AV1245 calculation. |
|
Obtains information from the molecule and the calculation to complement the main code function without requiring the 'mol' and 'mf' objects. |
|
Build the connectivity dictionary based on the given atomic overlap matrices. |
|
Processes fragments by combining AOMs and updating rings. |
|
|
|
|
|
Maps the elements of a list according to a permutation. |
|
Obtains the natural orbitals from the SCF calculation. |
|
Builds the eta matrices for the partitioning. They consist of a block-truncated matrix with all elements being |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reorders FCHK AO rows to match PySCF's internal layout AND applies |
- esipy.tools.wf_type(aom)[source]¶
Checks the topology of the AOMs to obtain the type of wavefunction.
- Parameters
aom – The Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
A string with the type of wave function (‘rest’, ‘unrest’ or ‘no’).
- 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, connec=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.build_connectivity(mat=None, threshold=0.25)[source]¶
Build the connectivity dictionary based on the given atomic overlap matrices.
- Parameters
mat – Atomic overlap matrices. If None, uses self.aom or builds meta-lowdin AOMs
threshold – Threshold for connectivity determination. Default is 0.25.
- Returns
Dictionary representing atomic connectivity
- esipy.tools.process_fragments(aom, rings, done=False)[source]¶
Processes fragments by combining AOMs and updating rings.
- Parameters
aom – List of AOMs.
rings – List of rings (can include sets for fragments).
- Returns
Updated AOMs, rings, and fragment AOMs.
- Return type
tuple (list, list, list)
- 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
