scine_autocas¶
Module to provide the Autocas class, which controlls all active space related methods.
Classes
|
Main class to handle all autoCAS functionality. |
Exceptions
Raised when autoCAS determines that the system is single reference instead of multireference. |
- exception scine_autocas.SingleReferenceException[source]¶
Raised when autoCAS determines that the system is single reference instead of multireference. This allows the client to catch the exception in case they want to perform a single reference calculation afterward.
- __doc__ = '\n Raised when autoCAS determines that the system is single reference\n instead of multireference. This allows the client to catch the exception\n in case they want to perform a single reference calculation afterward.\n '¶
- __module__ = 'scine_autocas'¶
- __weakref__¶
list of weak references to the object (if defined)
- class scine_autocas.Autocas(molecule, settings_dict=None)[source]¶
Main class to handle all autoCAS functionality.
Attributes
plateau_values
(int, default = 10) determines the minimum length of a plateau
threshold_step
(float, default 0.01) determines the threshold steps in the plateau search and the number of threshold, respectively
cas
(ActiveSpace) stores information on the active space
molecule
(Molecule) stores information about the current molecule
diagnostics
(Diagnostics) stores information from the DMRG calculation
large_spaces
(LargeSpaces) controls settings for the large active space protocol
_excited_states_orbital_indices
(List[int]) stores excited states CAS indices
_excited_states_mod
(int) handles excited states in combination with large cas
- __slots__ = ('plateau_values', 'threshold_step', 'cas', 'molecule', 'diagnostics', 'large_spaces', '_excited_states_orbital_indices', '_excited_states_mod')¶
- __init__(molecule, settings_dict=None)[source]¶
Initialize an autocas object.
The autocas class provides all functionalities to set up active spaces from molecular information, or to apply an active space search based on entopy information from a dmrg calculation.
- Parameters
- moleculeMolecule
stores molecular information
- settings_dictDict[str, Any], optional
holds settings from an autocas yaml input file
- threshold_step: float¶
determines the threshold steps in the plateau search and the number of threshold, respectively
- molecule: scine_autocas.autocas_utils.molecule.Molecule¶
stores information about the current molecule
- diagnostics: scine_autocas.autocas_utils.diagnostics.Diagnostics¶
stores information from the DMRG calculation
- large_spaces: scine_autocas.autocas_utils.large_active_spaces.LargeSpaces¶
controls settings for the large active space protocol
- cas: scine_autocas.autocas_utils.active_space.ActiveSpace¶
stores information on the active space
- __doc__ = '\n Main class to handle all autoCAS functionality.\n\n Attributes\n ----------\n plateau_values : int, default = 10\n determines the minimum length of a plateau\n threshold_step : float, default 0.01\n determines the threshold steps in the plateau search and the number of threshold, respectively\n cas : ActiveSpace\n stores information on the active space\n molecule : Molecule\n stores information about the current molecule\n diagnostics : Diagnostics\n stores information from the DMRG calculation\n large_spaces : LargeSpaces\n controls settings for the large active space protocol\n _excited_states_orbital_indices : List[int]\n stores excited states CAS indices\n _excited_states_mod : int\n handles excited states in combination with large cas\n '¶
- __module__ = 'scine_autocas'¶
- _sort_orbitals_by_s1(thresholds_list, orbitals_index)[source]¶
Sort orbital indices with respect to their threshold value.
- Parameters
- thresholds_listList[float]
contains the thresholds of s1 values e.g. s1_i / max(s1)
- orbitals_indexList[int]
a list with orbitals indices
- Returns
- thresholds_listList[float]
the ordered tresholds_list
- orbitals_indexList[int]
the ordered orbitals_index with respect to the thresholds
- _get_plateau(thresholds_list)[source]¶
Create a plateau vector from s1 values.
A plateau is complete after not changing the number of orbitals over 10%, e.g. self.plateau_values.
- _make_active_space()[source]¶
Make active space by searching plateaus in s1 and reordering orbitals.
- Returns
- bool
True if a plateau was found, e.g. a smaller active space; False if no plateau was found
- rtype
bool
..
- get_active_space(occupation, s1_entropy, s2_entropy=None, mutual_information=None, force_cas=False, xyz_file=None, molecule=None)[source]¶
Get active space.
autoCAS uses single orbital entropies to decrease the active space size by finding plateaus and including only orbitals with large single orbital entropies
- Parameters
- occupationList[int]
orbital occupation for each orbital in active space
- s1_entropynp.ndarray
single orbital entropy
- s2_entropynp.ndarray, optional
two orbital entropy, not required right now
- mutual_informationnp.ndarray, optional
mutual information, not required right now
- force_cas :: bool
forces to find an active space, even if no orbital has a high single orbital entropy
- Returns
- cas_occupationsList[int]
the occupation of each orbital in the active space, e.g. 2: doubly occupied, 1: singly occupied, 0: virtual orbital
- cas_indicesList[int]
indices of orbitals for the CAS calculation
- Raises
- AttributeError
if no xyz file was provided
- FileNotFoundError
if provided xyz file cannot be found
- Exception
if the entropies indicate, that no cas is required, and not forced
- NotImplementedError
if a larger cas than valence is theoretically required
- get_large_active_spaces()[source]¶
Create a list of active spaces for the large active space protocol in autoCAS.
- Returns
- occupationList[List[int]]
List of occupations for large CAS protocol
- orbital_indicesList[List[int]]
List of orbitals indices for large CAS protocol
- collect_entropies(indices_list, occupations_list, s1_list, s2_list=None, mut_inf_list=None)[source]¶
Fill entropy matrices from lists of entropies produced by the large active space protocol.
- Parameters
- indices_listList[List[int]]
contains several orbital indices from each active space calculation of the large CAS protocol
- occupations_listList[List[int]]
contains several orbital occupations for each active space calculation of the large CAS protocol
- s1_listList[np.ndarray]
contains several s1 entropies from the large CAS protocol
- s2_listList[np.ndarray]
contains several s2 entropies from the large CAS protocol
- mut_inf_listList[np.ndarray]
contains several mutual information from the large CAS protocol
- Returns
- occupationList[int]
the occupation for the large active space
- s1_entropynp.ndarray
s1 entropy build and scaled from several entropies
- s2_entropynp.ndarray, optional
s2 entropy build and scaled from several entropies
- mut_infnp.ndarray, optional
mutual information build and scaled from several mutual information
- get_cas_from_large_cas(indices_list, occupations_list, s1_list, s2_list=None, mut_inf_list=None, force_cas=False)[source]¶
Shortcut function to directly get an active space from the large CAS protocol.
- Parameters
- indices_listList[List[int]]
contains several orbital indices from each active space calculation of the large CAS protocol
- occupations_listList[List[int]]
contains several orbital occupations for each active space calculation of the large CAS protocol
- s1_listList[np.ndarray]
contains several s1 entropies from the large CAS protocol
- s2_listList[np.ndarray], optional
contains several s2 entropies from the large CAS protocol
- mut_inf_listList[np.ndarray], optional
contains several mutual information from the large CAS protocol
- force_casbool, optional, default = False
forces to find an active space, even if no orbital has a high single orbital entropy
- Returns
- cas_occupationsList[int]
the occupation of each orbital in the active space, e.g. 2: doubly occupied, 1: singly occupied, 0: virtual orbital
- cas_indicesList[int]
indices of orbitals for the CAS calculation
- Raises
- ValueError
if something strange happened
- get_cas_from_excited_states(occupation, s1_list, s2_list=None, mutual_information_list=None, force_cas=False)[source]¶
Shortcut function to directly get an active space from excited states.
- Parameters
- occupationList[int]
contains the orbital occupation for the active space.
- s1_listList[np.ndarray]
contains the one orbital entropies for each provided occupation
- s2_listList[np.ndarray], optional
contains the two orbital entropies for each provided occupation
- mutual_information_listList[np.ndarray], optional
contains the mutual information for each provided occupation
- Returns
- final_occupationList[int]
contains the occupations of the found active space
- final_orbital_indicesList[int]
contains the orbital indices of the found active space