forte2.helpers.davidsonliu ========================== .. py:module:: forte2.helpers.davidsonliu Module Contents --------------- .. py:class:: DavidsonLiuSolver(size: int, nroot: int, basis_per_root: int = 4, collapse_per_root: int = 2, maxiter: int = 100, e_tol: float = 1e-12, r_tol: float = 1e-06, eta: float | None = None, log_level: int = logger.get_verbosity_level(), dtype: type = np.float64) Davidson-Liu solver for iterative diagonalization of Hermitian matrices. :Parameters: **size** : int Dimension of the matrix / number of basis vectors. **nroot** : int Number of roots to find. **basis_per_root** : int, optional, default=4 Number of basis vectors to keep per root. **collapse_per_root** : int, optional, default=2 Number of vectors to collapse to per root. **maxiter** : int, optional, default=100 Maximum number of iterations to perform. **e_tol** : float, optional, default=1e-12 Convergence tolerance for eigenvalues. **r_tol** : float, optional, default=1e-6 Convergence tolerance for residuals. **eta** : float, optional Target eigenvalue shift for sorting eigenpairs. If None, no shift is applied. **log_level** : int, optional, default=logger.get_verbosity_level() Logging level for output messages. **dtype** : type, optional, default=np.float64 Data type of the matrix to diagonalize. Must be float or complex. :Attributes: **iter** : int Current iteration number. **converged** : bool Whether the solver has converged. .. !! processed by numpydoc !! .. py:attribute:: size .. py:attribute:: nroot .. py:attribute:: collapse_per_root :value: 2 .. py:attribute:: basis_per_root :value: 4 .. py:attribute:: maxiter :value: 100 .. py:attribute:: e_tol :value: 1e-12 .. py:attribute:: r_tol :value: 1e-06 .. py:attribute:: eta :value: None .. py:attribute:: log_level :value: 3 .. py:attribute:: dtype .. py:attribute:: collapse_size .. py:attribute:: max_subspace_size .. py:attribute:: b .. py:attribute:: sigma .. py:attribute:: r .. py:attribute:: h_diag :value: None .. py:attribute:: G .. py:attribute:: alpha .. py:attribute:: lam .. py:attribute:: lam_old .. py:attribute:: schmidt_discard_threshold :value: 1e-07 .. py:attribute:: schmidt_orthogonality_threshold :value: 1e-12 .. py:attribute:: basis_size :value: 0 .. py:attribute:: sigma_size :value: 0 .. py:method:: add_sigma_builder(sigma_builder) Add the function that builds the matrix-vector product. :Parameters: **sigma_builder** : callable This function should have signature ``sigma_builder(basis_block, sigma_block) -> None``, where ``basis_block.shape == (size, m)`` and ``sigma_block.shape == (size, m)``. and it modifies ``sigma_block`` in place, performing the operation ``sigma_block = matrix @ basis_block``. .. !! processed by numpydoc !! .. py:method:: add_h_diag(h_diag) .. py:method:: add_guesses(guesses) Add initial guesses for the eigenvectors. :Parameters: **guesses: NDArray** ``guesses.shape == (size, n_guess)``, with n_guess between 1 and subspace_size. .. !! processed by numpydoc !! .. py:method:: add_project_out(project_out) project_out: list of arrays each shape (size,) .. !! processed by numpydoc !! .. py:method:: solve() .. py:method:: add_rows_and_orthonormalize(A_existing: numpy.ndarray, B_candidates: numpy.ndarray, A_slots: numpy.ndarray) -> int Add candidate column vectors from B_candidates into A_slots, using iterative orthogonalization per vector. Returns the number of columns added. .. !! processed by numpydoc !! .. py:method:: orthonormality_check(b: numpy.ndarray, msg: str = 'Orthonormality check failed.') Check if the columns of b are orthonormal. .. !! processed by numpydoc !!