esipy¶
Submodules¶
Package Contents¶
Classes¶
Initialize the indicators from Unrestricted calculations. |
|
Initialize the indicators from Natural Orbitals calculations. |
|
Main class for the ESIpy code. |
Functions¶
|
Writes the input for the ESI-3D code from the AOMs. |
|
Reads the AOMs from ESIpy's writeaoms() method or from an AIMAll calculation. |
|
Reads all *.int files from a directory and builds the molinfo dictionary. |
|
Calculation of the Iring aromaticity index. |
|
Computes the MCI sequentially by computing the Iring without storing the permutations. |
|
Computes the MCI by generating all the permutations for a later distribution along the specified number of cores. |
|
Computes the AV1245 and AVmin indices. Not available for rings smaller than 6 members. |
|
Computes the PDI for the given 6-membered ring connectivity. Only computed for rings n=6. |
|
Computes the FLU index. |
|
Computes the BOA and BOA_c indices. |
|
Computes the HOMER index. |
|
Computes the HOMA index. |
|
Computes the BLA and BLA_c indices. |
|
Calculation of the Iring aromaticity index for correlated wavefunctions. |
|
Computes the MCI for correlated wavefunctions sequentially by computing the Iring without storing the permutations. |
|
Computes the MCI for correlated wavefunctions by generating all the permutations for a later distribution along the specified number of cores. |
|
Computes the AV1245 and AVmin indices for correlated wavefunctions. Not available for rings smaller than 6 members. |
|
Computes the PDI for the given 6-membered ring connectivity. Only computed for rings n=6. |
|
Computes the BOA and BOA_c indices for correlated wavefunctions. |
|
Obtains information from the molecule and the calculation to complement the main code function without requiring the 'mol' and 'mf' objects. |
|
|
|
Loads a variable from a file. |
|
|
|
Checks the topology of the AOMs to obtain the type of wavefunction. |
|
Saves a variable to a file. |
|
|
|
|
|
|
|
|
|
Processes fragments by combining AOMs and updating rings. |
|
Build the connectivity dictionary based on the given atomic overlap matrices. |
Attributes¶
- esipy.write_aoms(mol, mf, name, aom, ring=[], partition=None)[source]¶
Writes the input for the ESI-3D code from the AOMs.
- Parameters
mol (PySCF instance) – Molecule object from PySCF.
mf (PySCF instance) – Calculation object from PySCF.
name (str) – Name of the calculation.
aom (list) – Concatenated list of Atomic Overlap Matrices (AOMs) in the MO basis.
ring (list of int, optional) – Connectivity of the atoms in the ring. Can be more than one ring as a list of lists.
partition (str, optional) – Partition scheme for the AOMs. Options are “mulliken”, “lowdin”, “meta-lowdin”, “nao”, “iao”.
- Returns
None
- Generates
A ‘_atomicfiles/’ directory with all the files created.
A ‘.int’ file for each atom with its corresponding AOM.
A ‘name.files’ file with a list of the names of the ‘.int’ files.
A ‘name.bad’ file with a standard input for the ESI-3D code.
A ‘name.wfx’ file with the occupancies for the ESI-3D code.
- esipy.read_aoms(path='.')[source]¶
Reads the AOMs from ESIpy’s writeaoms() method or from an AIMAll calculation.
- Parameters
path (str) – Path of the directory of the files.
- Returns
The AOMs in ESIpy format stored in ‘ESI.aom’.
- Return type
list
- esipy.read_molinfo(path)[source]¶
Reads all *.int files from a directory and builds the molinfo dictionary.
- Parameters
path (str) – Path to the directory containing *.int files.
- Returns
A dictionary containing molecular information.
- Return type
dict
- esipy.compute_iring(arr, aom)[source]¶
Calculation of the Iring aromaticity index.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
The Iring for the given ring connectivity.
- Return type
float
- esipy.sequential_mci(arr, aom, partition)[source]¶
Computes the MCI sequentially by computing the Iring without storing the permutations. Default option if no number of cores is specified.
- esipy.multiprocessing_mci(arr, aom, ncores, partition)[source]¶
Computes the MCI by generating all the permutations for a later distribution along the specified number of cores.
- esipy.compute_av1245(arr, aom, partition)[source]¶
Computes the AV1245 and AVmin indices. Not available for rings smaller than 6 members.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
partition (str) – Specifies the atom-in-molecule partition scheme. Options include ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’, and ‘iao’.
- Returns
The AV1245 index, the AVmin index, and each of the AV1245 in a list for the output, respectively.
- Return type
tuple
- esipy.compute_pdi(arr, aom)[source]¶
Computes the PDI for the given 6-membered ring connectivity. Only computed for rings n=6.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
The PDI value and each of the DIs in para position.
- Return type
tuple
- esipy.compute_flu(arr, molinfo, aom, flurefs=None, partition=None)[source]¶
Computes the FLU index.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
molinfo (dict) – Contains the molecular information.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
flurefs (dict, optional) – User-provided references for the FLU index.
partition (str, optional) – Specifies the atom-in-molecule partition scheme. Options include ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’, and ‘iao’.
- Returns
The FLU value for the given ring connectivity.
- Return type
float
- esipy.compute_boa(arr, aom)[source]¶
Computes the BOA and BOA_c indices.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
Contains the BOA and the BOA_c indices, respectively.
- Return type
tuple
- esipy.compute_homer(arr, molinfo, homerrefs=None)[source]¶
Computes the HOMER index.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
molinfo (dict) – Contains the molecular information.
homerrefs (dict, optional) – User-provided references for the HOMER index.
- Returns
HOMER value for the given ring connectivity.
- Return type
float
- esipy.compute_homa(arr, molinfo, homarefs=None)[source]¶
Computes the HOMA index.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
molinfo (dict) – Contains the molecular information.
homarefs (dict, optional) – User-provided references for the HOMA index.
- Returns
HOMA value for the given ring connectivity.
- Return type
float
- esipy.compute_bla(arr, molinfo)[source]¶
Computes the BLA and BLA_c indices.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
molinfo (dict) – Contains the molecular information.
- Returns
Contains the BLA and the BLA_c indices, respectively.
- Return type
tuple
- esipy.compute_iring_no(arr, aom)[source]¶
Calculation of the Iring aromaticity index for correlated wavefunctions.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
The Iring for the given ring connectivity.
- Return type
float
- esipy.sequential_mci_no(arr, aom, partition)[source]¶
Computes the MCI for correlated wavefunctions sequentially by computing the Iring without storing the permutations.
- esipy.multiprocessing_mci_no(arr, aom, ncores, partition)[source]¶
Computes the MCI for correlated wavefunctions by generating all the permutations for a later distribution along the specified number of cores.
- esipy.compute_av1245_no(arr, aom, partition)[source]¶
Computes the AV1245 and AVmin indices for correlated wavefunctions. Not available for rings smaller than 6 members.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
partition (str) – Specifies the atom-in-molecule partition scheme. Options include ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’, and ‘iao’.
- Returns
The AV1245 index, the AVmin index, and each of the AV1245 in a list for the output, respectively.
- Return type
tuple
- esipy.compute_pdi_no(arr, aom)[source]¶
Computes the PDI for the given 6-membered ring connectivity. Only computed for rings n=6.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
The PDI value and each of the DIs in para position.
- Return type
tuple
- esipy.compute_boa_no(arr, aom)[source]¶
Computes the BOA and BOA_c indices for correlated wavefunctions.
- Parameters
arr (list of int) – Contains the indices defining the ring connectivity.
aom (list of matrices) – Specifies the Atomic Overlap Matrices (AOMs) in the MO basis.
- Returns
Contains the BOA and the BOA_c indices, respectively.
- Return type
tuple
- esipy.make_aoms(mol, mf, partition, myhf=None, save=None)¶
Build the Atomic Overlap Matrices (AOMs) in the Molecular Orbitals basis.
- esipy.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.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.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.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.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.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
- class esipy.IndicatorsRest(aom=None, rings=None, mol=None, mf=None, myhf=None, partition=None, mci=None, av1245=None, flurefs=None, homarefs=None, homerrefs=None, connectivity=None, geom=None, molinfo=None, ncores=1)[source]¶
-
- property av1245_list[source]¶
Get the list of 4c-MCIs that form the AV1245.
- Returns
The list of 4c-MCIs that form the AV1245.
- Return type
numpy.ndarray
- property pdi_list[source]¶
Get the list of the DIs (1-4, 2-5, 3-6).
- Returns
The list of the DI values that form PDI.
- Return type
numpy.ndarray
- _av()[source]¶
Compute the AV1245, AVmin and the list of the 4c-MCIs.
- Returns
Tuple containing the AV1245, AVmin and the list of the 4c-MCIs.
- Return type
tuple
- _boa()[source]¶
Compute the BOA and BOA_c values.
- Returns
The BOA and BOA_c values.
- Return type
tuple
- class esipy.IndicatorsUnrest(aom=None, rings=None, mol=None, mf=None, myhf=None, partition=None, mci=None, av1245=None, flurefs=None, homarefs=None, homerrefs=None, connectivity=None, geom=None, molinfo=None, ncores=1)[source]¶
Initialize the indicators from Unrestricted calculations.
- Parameters
aom (concatenated list) – Atomic Overlap Matrices (AOMs) in the MO basis.
rings (list) – List of indices of the atoms in the ring connectivity. Can be a list of lists.
mol (optional, obj) – Molecule object “mol” from PySCF.
mf (optional, obj) – Calculation object “mf” from PySCF.
partition (optional, str) – Type of Hilbert-space partition scheme. Options are ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’ and ‘iao’.
mci (optional, boolean) – Whether to compute the MCI.
av1245 (optional, boolean) – Whether to compute the AV1245.
flurefs (optional, dict) – Custom FLU references.
homarefs (optional, dict) – Custom HOMA references: “n_opt”, “c”, “r1”.
homerrefs (optional, dict) – Custom HOMER references: “alpha” and “r_opt” .
connectivity (optional, list) – Symbols of the ring connectivity as in “rings”.
geom (optional, list of lists) – Geometry of the molecule as in mol.atom_coords().
molinfo (optional, dict) – Information about the molecule and calculation.
ncores (optional, int) – Number of cores to use for the MCI calculation. Default is 1.
- property iring_alpha[source]¶
Get the Iring_alpha value.
- Returns
The Iring_alpha value.
- Return type
float
- property iring_beta[source]¶
Get the Iring_beta value.
- Returns
The Iring_beta value.
- Return type
float
- property av1245_alpha[source]¶
Get the AV1245_alpha value.
- Returns
The AV1245_alpha value.
- Return type
float
- property av1245_beta[source]¶
Get the AV1245_beta value.
- Returns
The AV1245_beta value.
- Return type
float
- property avmin_alpha[source]¶
Get the AVmin_alpha value.
- Returns
The AVmin_alpha value.
- Return type
float
- property avmin_beta[source]¶
Get the AVmin_beta value.
- Returns
The AVmin_beta value.
- Return type
float
- property av1245_list[source]¶
Get the list of 4c-MCIs that form the AV1245.
- Returns
The list of 4c-MCIs that form the AV1245.
- Return type
numpy.ndarray
- property av1245_list_alpha[source]¶
Get the list of 4c-MCIs that form the AV1245_alpha.
- Returns
The list of 4c-MCIs that form the AV1245_alpha.
- Return type
numpy.ndarray
- property av1245_list_beta[source]¶
Get the list of 4c-MCIs that form the AV1245_beta.
- Returns
The list of 4c-MCIs that form the AV1245_beta.
- Return type
numpy.ndarray
- property pdi_list[source]¶
Get the list of the DIs (1-4, 2-5, 3-6).
- Returns
The list of the DI values that form PDI.
- Return type
numpy.ndarray
- property pdi_list_alpha[source]¶
Get the list of the alpha component of the DIs (1-4, 2-5, 3-6).
- Returns
The list of the alpha component of the DI values that form PDI.
- Return type
numpy.ndarray
- property pdi_list_beta[source]¶
Get the list of the beta component of the DIs (1-4, 2-5, 3-6).
- Returns
The list of the beta component of the DI values that form PDI.
- Return type
numpy.ndarray
- property boa_c_alpha[source]¶
Get the BOA_c_alpha value.
- Returns
The BOA_c_alpha value.
- Return type
float
- property boa_c_beta[source]¶
Get the BOA_c_beta value.
- Returns
The BOA_c_beta value.
- Return type
float
- _irings()[source]¶
Compute the Iring and their alpha and beta components.
- Returns
The Iring, Iring_alpha and Iring_beta.
- Return type
tuple
- _mcis()[source]¶
- Compute the MCI values for alpha and beta components. Different algorithms are used depending on
the number of cores.
- Returns
The MCI values for alpha and beta components.
- Return type
tuple
- _avs()[source]¶
Compute the AV1245, AVmin and the list of the 4c-MCIs for alpha and beta components.
- Returns
The AV1245, AVmin and the list of the 4c-MCIs for alpha and beta components.
- Return type
tuple
- _pdis()[source]¶
Compute the PDI values for alpha and beta components.
- Returns
The PDI values for alpha and beta components.
- Return type
tuple
- _flus()[source]¶
Compute the FLU values for alpha and beta components.
- Returns
The FLU values for alpha and beta components.
- Return type
tuple
- _boas()[source]¶
Compute the BOA and BOA_c values for alpha and beta components.
- Returns
The BOA and BOA_c values for alpha and beta components.
- Return type
tuple
- class esipy.IndicatorsNatorb(aom=None, rings=None, mol=None, mf=None, myhf=None, partition=None, mci=None, av1245=None, flurefs=None, homarefs=None, homerrefs=None, connectivity=None, geom=None, molinfo=None, ncores=1)[source]¶
Initialize the indicators from Natural Orbitals calculations.
- Parameters
aom (concatenated list) – Atomic Overlap Matrices (AOMs) in the MO basis.
rings (list) – List of indices of the atoms in the ring connectivity. Can be a list of lists.
mol (optional, obj) – Molecule object “mol” from PySCF.
mf (optional, obj) – Calculation object “mf” from PySCF.
myhf (optional, obj) – Reference RHF object for IAO-Natural Orbitals calculation.
partition (optional, str) – Type of Hilbert-space partition scheme. Options are ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’ and ‘iao’.
mci (optional, boolean) – Whether to compute the MCI.
av1245 (optional, boolean) – Whether to compute the AV1245.
flurefs (optional, dict) – Custom FLU references.
homarefs (optional, dict) – Custom HOMA references: “n_opt”, “c”, “r1”.
homerrefs (optional, dict) – Custom HOMER references: “alpha” and “r_opt” .
connectivity (optional, list) – Symbols of the ring connectivity as in “rings”.
geom (optional, list of lists) – Geometry of the molecule as in mol.atom_coords().
molinfo (optional, dict) – Information about the molecule and calculation.
ncores (optional, int) – Number of cores to use for the MCI calculation. Default is 1.
- property av1245_list[source]¶
Get the list of 4c-MCIs that form the AV1245.
- Returns
The list of 4c-MCIs that form the AV1245.
- Return type
numpy.ndarray
- property pdi_list[source]¶
Get the list of the DIs (1-4, 2-5, 3-6).
- Returns
The list of the DI values that form PDI.
- Return type
numpy.ndarray
- _av_no()[source]¶
Compute the AV1245, AVmin and the list of the 4c-MCIs.
- Returns
List containing the AV1245, AVmin and the list of the 4c-MCIs.
- Return type
list
- _boa_no()[source]¶
Compute the BOA and BOA_c values.
- Returns
The BOA and BOA_c values.
- Return type
tuple
- class esipy.ESI(aom=None, rings=None, mol=None, mf=None, myhf=None, partition=None, mci=None, av1245=None, flurefs=None, homarefs=None, homerrefs=None, connectivity=None, geom=None, molinfo=None, ncores=1, save=None, readpath='.', read=False, maxlen=12, minlen=6, rings_thres=0.3, exclude=None)[source]¶
Main class for the ESIpy code.
Attributes: aom (concatenated list): Atomic Overlap Matrices (AOMs) in the MO basis. rings (list): List of indices of the atoms in the ring connectivity. Can be a list of lists. mol (optional, obj): Molecule object “mol” from PySCF. mf (optional, obj): Calculation object “mf” from PySCF. myhf (optional, obj): Reference RHF object for IAO-Natural Orbitals calculation. partition (optional, str): Type of Hilbert-space partition scheme.
Options are ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’ and ‘iao’.
mci (optional, boolean): Whether to compute the MCI. av1245 (optional, boolean): Whether to compute the AV1245. flurefs (optional, dict): Custom FLU references. homarefs (optional, dict): Custom HOMA references: “n_opt”, “c”, “r1”. homerrefs (optional, dict): Custom HOMER references: “alpha” and “r_opt” . connectivity (optional, list): Symbols of the ring connectivity as in “rings”. geom (optional, list of lists): Geometry of the molecule as in mol.atom_coords(). molinfo (optional, dict): Information about the molecule and calculation. ncores (optional, int): Number of cores to use for the MCI calculation. Default is 1. saveaoms (optional): Name where to save the AOMs in binary. savemolinfo (optional): Name where to save the molecular information dictionary in binary. readpath (optional, str): Path to read the AOMs. Default is ‘.’. indicators (obj): Object containing the indicators of the calculation. Generated in the initialization.
Methods: readaoms(): Reads the AOMs from a directory in AIMAll and ESIpy format. writeaoms(): Writes ESIpy’s AOMs in AIMAll format. print(): Prints the output for the main ESIpy functions.
- property molinfo[source]¶
Get the information about the molecule and calculation. If not provided, it will compute it. If set as a string, it will read the information from the directory. Can be saved in a file with the savemolinfo attribute.
- Returns
Information about the molecule and calculation.
- Return type
dict
- property aom[source]¶
Get the Atomic Overlap Matrices (AOMs) in the MO basis. If not provided, it will compute them. If set as a string, it will read the AOMs from the directory. Can be saved in a file with the saveaoms attribute.
- Returns
The AOMs in the MO basis.
- Return type
list
- property partition[source]¶
Get the partition scheme for the Hilbert-space. Options are ‘mulliken’, ‘lowdin’, ‘meta-lowdin’, ‘nao’ and ‘iao’. Some variations of these names are also available. Only one partition at a time.
- Returns
The partition scheme for the Hilbert-space calculation.
- Return type
str
- property connec[source]¶
Get the connectivity matrix. If the partition is ‘mulliken’ or ‘lowdin’, build the NAO AOMs and compute the connectivity matrix from there. The computation is controlled by the ‘done_connec’ flag. Based on the DIs.
- Returns
The connectivity matrix.
- Return type
dict
- property mci[source]¶
Whether to compute the MCI. If not provided, it will compute it if the number of rings is less than 12.
- Returns
Whether to compute the MCI.
- Return type
boolean
- property exclude[source]¶
Processes the exclude list. If an element symbol (str) is found, it finds all indices for that element. If an int is found, it keeps it.
- property av1245[source]¶
Whether to compute the AV1245. If not provided, it will compute it if the number of rings is greater than 9.
- Returns
Whether to compute the AV1245.
- Return type
boolean
- readaoms()[source]¶
Reads the AOMs from a directory in AIMAll and ESIpy format. Overwrites ‘ESI.aom’ variable. By default, it will read the AOMs from the working directory. If the ‘readpath’ attribute is set, it will read from that directory.
- Returns
The AOMs in the MO basis, overwriting the aom variable.
- Return type
list
- writeaoms(file)[source]¶
Writes ESIpy’s AOMs in AIMAll format in the working directory.
- Generates:
A ‘_atomicfiles/’ directory with all the files created.
A ‘.int’ file for each atom with its corresponding AOM.
A ‘name.files’ with a list of the names of the ‘.int’ files.
A ‘name.bad’ with a standard input for the ESI-3D code.
A ‘name.wfx’ with the occupancies for the ESI-3D code.
