hqs_spin_mapper.orbital_optimization
Identify the basis of maximally spin-like orbitals from given set of 1-RDMs and 2-RDMs.
Functions
| 
 | Optimize the basis for extremal local parities via a single pairwise rotation of orbitals. | 
| 
 | Returns the rotation generator matrix for a given orbital index and vector of angles. | 
| 
 | Returns the general rotation matrix for a given orbital index and vector of angles. | 
| 
 | Determine spin-like orbitals via an optimization of local parities. | 
| 
 | Returns the local parity of the chosen orbital after rotation with the specified angles. | 
| 
 | Returns the gradient of the local parity of the orbital with respect to the angles. | 
| 
 | Returns the Hessian of the local parity of the orbital with respect to the angles. | 
| 
 | Rotate the 1-RDM for pairwise rotations. | 
| 
 | Rotate the 2-RDM for pairwise rotations. | 
| 
 | Identify spin-like orbitals using an optimization of the local parities. | 
Exceptions
| 
 | Custom exception that is raised if the search for spin-like orbitals failed. | 
- hqs_spin_mapper.orbital_optimization.basis_optimization(i: int, j: int, rdm1: ndarray, rdm2: ndarray, target: str = 'minimum') Tuple[float, ndarray]
- Optimize the basis for extremal local parities via a single pairwise rotation of orbitals. - Parameters:
- i (int) – First orbital index 
- j (int) – Second orbital index 
- rdm1 (np.ndarray) – Matrix of 1-RDM 
- rdm2 (np.ndarray) – 4-Tensor of the 2-RDM 
- target (str) – Determine the extremum to be determined, i.e - minimum,- maximumor
- extremum. 
 
- Returns:
- Optimal rotation angle \(\phi_{ij}\) np.ndarray: Rotation matrix \(U_{ip}\). 
- Return type:
- float 
- Raises:
- ValueError – Invalid optimization target 
 
- hqs_spin_mapper.orbital_optimization.global_spin_orbital_optimization(transformable_system: SpinFinder | Supports_SW_Transformation, _algorithm: str = 'trust-ncg', _delta_sufficiently_spin_like: float = 0.001, _maxiter: int = 150) None
- Determine spin-like orbitals via an optimization of local parities. - Performs a sequence of pairwise rotation between orbital indices \(i\) and \(j\) trying to minimize the resulting local parity of the orbital \(i\). - Parameters:
- transformable_system (Supports_Spin_Optimization) – Container object for the system data. 
- _algorithm (str) – Name of the scipy optimization algorithm. Default is - trust-ncg
- _delta_sufficiently_spin_like (float) – Orbitals i with \(P_i = (-1 + \delta)\) are not 
- optimized 
- _maxiter (int) – Maximum number of attempted iterations for the algorithm 
 
- Raises:
- InsufficientProtocolError – transformable_system does not satisfy Supports_SW_Transformation. 
 
- hqs_spin_mapper.orbital_optimization.rotate_rdm1(rdm1: ndarray, U: ndarray, i: int, j: int) ndarray
- Rotate the 1-RDM for pairwise rotations. - Parameters:
- rdm1 (np.ndarray) – Matrix description of the 1-RDM. 
- U (np.ndarray) – Rotation matrix \(U_{ip}\). 
- i (int) – First orbital index of the pair. 
- j (int) – Second orbital index of the pair. 
 
- Returns:
- Rotated 1-RDM 
- Return type:
- np.ndarray 
 
- hqs_spin_mapper.orbital_optimization.rotate_rdm2(rdm2: ndarray, U: ndarray, i: int, j: int) ndarray
- Rotate the 2-RDM for pairwise rotations. - Parameters:
- rdm2 (np.ndarray) – Tensor description of the 2-RDM. 
- U (np.ndarray) – Rotation matrix \(U_{ip}\). 
- i (int) – First orbital index of the pair. 
- j (int) – Second orbital index of the pair. 
 
- Returns:
- Rotated 2-RDM 
- Return type:
- np.ndarray 
 
- hqs_spin_mapper.orbital_optimization.spin_orbital_optimization(transformable_system: SpinFinder | Supports_SW_Transformation, space_reduction: bool = True, fast_mode: bool = False, target: str = 'minimum', _delta_sufficiently_spin_like: float = 0.001) None
- Identify spin-like orbitals using an optimization of the local parities. - Performs a sequence of pairwise rotation between orbital indices i and j trying to extremize the resulting local parity of the orbital i after rotation. - Parameters:
- transformable_system (Supports_Spin_Optimization) – Container object for the system data. 
- space_reduction (bool) – Flag for performing rotations in the reduced search space only. 
- fast_mode (bool) – Flag for performing approximate rotations of the RDMs to increase speed. (This will result in slight inaccuracies of the RDMs.) 
- target (str) – Determine the extremum to be determined (default=minimum) 
- _delta_sufficiently_spin_like (float) – Orbitals i with this value for \(\delta\) in 
 
 - :param :math:`P_i =: :type :math:`P_i =: -1 + delta - Raises:
- InsufficientProtocolError – The transformable_system does not satisfy 
- Supports_SW_Transformation. – 
- ValueError – Invalid target was specified.