mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-11-19 04:22:32 +01:00
Dressed davidson with CSF
This commit is contained in:
parent
cf3f510704
commit
d84e3fa236
@ -1,4 +1,3 @@
|
||||
|
||||
BEGIN_PROVIDER [ double precision, CI_energy, (N_states_diag) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
@ -38,6 +38,8 @@ END_PROVIDER
|
||||
double precision, allocatable :: s2_eigvalues(:)
|
||||
double precision, allocatable :: e_array(:)
|
||||
integer, allocatable :: iorder(:)
|
||||
logical :: converged
|
||||
logical :: do_csf
|
||||
|
||||
PROVIDE threshold_davidson nthreads_davidson
|
||||
! Guess values for the "N_states" states of the CI_eigenvectors_dressed
|
||||
@ -53,6 +55,8 @@ END_PROVIDER
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do_csf = s2_eig .and. only_expected_s2 .and. csf_based
|
||||
|
||||
if (diag_algorithm == "Davidson") then
|
||||
|
||||
do j=1,min(N_states,N_det)
|
||||
@ -60,14 +64,78 @@ END_PROVIDER
|
||||
CI_eigenvectors_dressed(i,j) = psi_coef(i,j)
|
||||
enddo
|
||||
enddo
|
||||
logical :: converged
|
||||
converged = .False.
|
||||
if (do_csf) then
|
||||
call davidson_diag_H_csf(psi_det,CI_eigenvectors_dressed, &
|
||||
size(CI_eigenvectors_dressed,1),CI_electronic_energy_dressed, &
|
||||
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||
else
|
||||
call davidson_diag_HS2(psi_det,CI_eigenvectors_dressed, CI_eigenvectors_s2_dressed,&
|
||||
size(CI_eigenvectors_dressed,1), CI_electronic_energy_dressed,&
|
||||
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||
endif
|
||||
|
||||
integer :: N_states_diag_save
|
||||
N_states_diag_save = N_states_diag
|
||||
do while (.not.converged)
|
||||
double precision, allocatable :: CI_electronic_energy_tmp (:)
|
||||
double precision, allocatable :: CI_eigenvectors_tmp (:,:)
|
||||
double precision, allocatable :: CI_s2_tmp (:)
|
||||
|
||||
N_states_diag *= 2
|
||||
TOUCH N_states_diag
|
||||
|
||||
if (do_csf) then
|
||||
|
||||
allocate (CI_electronic_energy_tmp (N_states_diag) )
|
||||
allocate (CI_eigenvectors_tmp (N_det,N_states_diag) )
|
||||
|
||||
CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy_dressed(1:N_states_diag_save)
|
||||
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save)
|
||||
|
||||
call davidson_diag_H_csf(psi_det,CI_eigenvectors_tmp, &
|
||||
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, &
|
||||
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||
|
||||
CI_electronic_energy_dressed(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
|
||||
CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)
|
||||
|
||||
deallocate (CI_electronic_energy_tmp)
|
||||
deallocate (CI_eigenvectors_tmp)
|
||||
|
||||
else
|
||||
|
||||
allocate (CI_electronic_energy_tmp (N_states_diag) )
|
||||
allocate (CI_eigenvectors_tmp (N_det,N_states_diag) )
|
||||
allocate (CI_s2_tmp (N_states_diag) )
|
||||
|
||||
CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy_dressed(1:N_states_diag_save)
|
||||
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save)
|
||||
CI_s2_tmp(1:N_states_diag_save) = CI_eigenvectors_s2_dressed(1:N_states_diag_save)
|
||||
|
||||
call davidson_diag_HS2(psi_det,CI_eigenvectors_tmp, CI_s2_tmp, &
|
||||
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, &
|
||||
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,1,converged)
|
||||
|
||||
CI_electronic_energy_dressed(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
|
||||
CI_eigenvectors_dressed(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)
|
||||
CI_eigenvectors_s2_dressed(1:N_states_diag_save) = CI_s2_tmp(1:N_states_diag_save)
|
||||
|
||||
deallocate (CI_electronic_energy_tmp)
|
||||
deallocate (CI_eigenvectors_tmp)
|
||||
deallocate (CI_s2_tmp)
|
||||
|
||||
endif
|
||||
|
||||
enddo
|
||||
if (N_states_diag > N_states_diag_save) then
|
||||
N_states_diag = N_states_diag_save
|
||||
TOUCH N_states_diag
|
||||
endif
|
||||
|
||||
else if (diag_algorithm == "Lapack") then
|
||||
|
||||
print *, 'Diagonalization of H using Lapack'
|
||||
allocate (eigenvectors(size(H_matrix_dressed,1),N_det))
|
||||
allocate (eigenvalues(N_det))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user