Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Davidson works when doubles folding in ADC(2) #176

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TianLin-228
Copy link

@TianLin-228 TianLin-228 commented Aug 16, 2024

Implement a modified Davidson procedure for doubles-folding. It solves pseudo-eigenvalue problem ωi ui = A(ωi) ui, where A(ωi) is an effective ADC matrix which depends on the eigenvalue ωi. The modified procedure is based on the implementation stated in the paper ( J. Chem. Phys. 158, 124121 (2023)).

The algorithm consists of state-specific macro and micro iterations and further DIIS acceleration. Micro-iterations use Davidson iterations to diagonalize the effective matrix Aeffi) with the fixed eigenvalue ωi, giving a new eigenvalue ω'i. After convergence, a new macro-iteration begins with the effective matrix Aeff'i) . This process continues until the eigenvectors meet a threshold (default=1e-3), after which DIIS further converges the individual roots.

NB: This procedure only works for single excitations.

Changes:

  1. In file “davidson.py”:
  • New functions named “davidson_folded_DIIS“ and “eigsh_folded” are added, which implements the main procedure of the modified Davidson method. It consists of loops for macro iterations, in which the davidson_iterations are performed as micro iterations, and loops for DIIS iterations.

  • Changes in function “davidson_iterations” :

    • For the folding case, when it breaks at convergence or otherwise, the eigenvectors with the number of n_block are calculated by the rvecs and guesses, and the subspace_vectors is updated for the next macro iteration;
    • A different convergence criteria for the folding case as following:
      ω0i - ω1i > ωn-1i - ωni , where ω0i is the initial guess of ωi and ωni is the Ritz value of the current micro iteration.
  • Add new Class DIIS to implement diis acceleration.

  • There are two new Classes: Class FoldedDavidsonState inherits from Class DavidsonState and contains more properties about the DavidsonState in doubles-folding case; Class DIIS is used when performing extrapolation on the corrected vector.

  • Add new properties for Class DavidsonState: “folded” is the flag to distinguish normal or modified davidson procedures when running “davidson_iterations”, and “DIIS_iter” sums the total number of performed DIIS iterations for all required states.

  • In the function “default_print”, there are new identifiers for the folding case.

  1. In the file “AdcMatrix.py”, the matrix-vector product of the folded ADC matrix with singles component is defined in the new Class AdcMatrixFolded.

  2. Workflow - two options of guesses vector in doubles-folding case:
    guesses_fold = “adc1”, which takes adc1 results (excitation_vector and excitation_energy_uncorrected) as initial guess vectors and guess eigenvalues.
    Or obtaining guess vectors by inspecting the diagonal matrix elements as default.

Testing:

test_davidson_folded.py: testing davidson_folded_DIIS in two cases of given guesses and taking guesses as adc1 results.
test_workflow.py: I added two tests for new parameters “fold”, “guesses_fold” and “omegas”.

@TianLin-228 TianLin-228 marked this pull request as ready for review August 19, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant