2014-05-25 01:18:41 +02:00
|
|
|
BEGIN_PROVIDER [ character*(64), diag_algorithm ]
|
|
|
|
implicit none
|
|
|
|
BEGIN_DOC
|
|
|
|
! Diagonalization algorithm (Davidson or Lapack)
|
|
|
|
END_DOC
|
2014-06-01 22:03:26 +02:00
|
|
|
if (N_det > N_det_max_jacobi) then
|
2014-05-25 01:18:41 +02:00
|
|
|
diag_algorithm = "Davidson"
|
|
|
|
else
|
|
|
|
diag_algorithm = "Lapack"
|
|
|
|
endif
|
2014-05-26 13:09:32 +02:00
|
|
|
|
|
|
|
if (N_det < N_states) then
|
|
|
|
diag_algorithm = "Lapack"
|
|
|
|
endif
|
2014-05-25 01:18:41 +02:00
|
|
|
|
|
|
|
END_PROVIDER
|
|
|
|
|
|
|
|
BEGIN_PROVIDER [ double precision, CI_energy, (N_states) ]
|
|
|
|
implicit none
|
|
|
|
BEGIN_DOC
|
|
|
|
! N_states lowest eigenvalues of the CI matrix
|
|
|
|
END_DOC
|
|
|
|
|
|
|
|
integer :: j
|
2014-05-29 01:38:46 +02:00
|
|
|
character*(8) :: st
|
|
|
|
call write_time(output_Dets)
|
2014-05-26 13:09:32 +02:00
|
|
|
do j=1,N_states
|
2014-05-25 01:18:41 +02:00
|
|
|
CI_energy(j) = CI_electronic_energy(j) + nuclear_repulsion
|
2014-05-29 01:38:46 +02:00
|
|
|
write(st,'(I4)') j
|
|
|
|
call write_double(output_Dets,CI_energy(j),'Energy of state '//trim(st))
|
2014-05-25 01:18:41 +02:00
|
|
|
enddo
|
|
|
|
|
|
|
|
END_PROVIDER
|
|
|
|
|
|
|
|
BEGIN_PROVIDER [ double precision, CI_electronic_energy, (N_states) ]
|
|
|
|
&BEGIN_PROVIDER [ double precision, CI_eigenvectors, (N_det,N_states) ]
|
|
|
|
implicit none
|
|
|
|
BEGIN_DOC
|
|
|
|
! Eigenvectors/values of the CI matrix
|
|
|
|
END_DOC
|
|
|
|
integer :: i,j
|
|
|
|
|
|
|
|
do j=1,N_states
|
|
|
|
do i=1,N_det
|
|
|
|
CI_eigenvectors(i,j) = psi_coef(i,j)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
if (diag_algorithm == "Davidson") then
|
|
|
|
|
|
|
|
call davidson_diag(psi_det,CI_eigenvectors,CI_electronic_energy, &
|
|
|
|
size(CI_eigenvectors,1),N_det,N_states,N_int,output_Dets)
|
|
|
|
|
|
|
|
else if (diag_algorithm == "Lapack") then
|
|
|
|
|
|
|
|
double precision, allocatable :: eigenvectors(:,:), eigenvalues(:)
|
|
|
|
allocate (eigenvectors(size(H_matrix_all_dets,1),N_det))
|
|
|
|
allocate (eigenvalues(N_det))
|
|
|
|
call lapack_diag(eigenvalues,eigenvectors, &
|
|
|
|
H_matrix_all_dets,size(H_matrix_all_dets,1),N_det)
|
|
|
|
CI_electronic_energy(:) = 0.d0
|
|
|
|
do j=1,min(N_states,N_det)
|
|
|
|
do i=1,N_det
|
|
|
|
CI_eigenvectors(i,j) = eigenvectors(i,j)
|
|
|
|
enddo
|
|
|
|
CI_electronic_energy(j) = eigenvalues(j)
|
|
|
|
enddo
|
|
|
|
deallocate(eigenvectors,eigenvalues)
|
|
|
|
endif
|
|
|
|
|
|
|
|
END_PROVIDER
|
|
|
|
|
2014-05-26 21:42:16 +02:00
|
|
|
subroutine diagonalize_CI
|
|
|
|
implicit none
|
|
|
|
BEGIN_DOC
|
|
|
|
! Replace the coefficients of the CI states by the coefficients of the
|
|
|
|
! eigenstates of the CI matrix
|
|
|
|
END_DOC
|
|
|
|
integer :: i,j
|
|
|
|
do j=1,N_states
|
|
|
|
do i=1,N_det
|
|
|
|
psi_coef(i,j) = CI_eigenvectors(i,j)
|
|
|
|
enddo
|
|
|
|
enddo
|
2014-06-04 21:28:43 +02:00
|
|
|
SOFT_TOUCH psi_coef CI_electronic_energy CI_energy CI_eigenvectors
|
2014-05-26 21:42:16 +02:00
|
|
|
end
|