10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 04:43:50 +01:00

Valgrind OK with dsyevr

This commit is contained in:
Anthony Scemama 2017-06-07 23:31:41 +02:00
parent c23ca86017
commit ab626735de

View File

@ -1,38 +1,46 @@
BEGIN_PROVIDER [ double precision, diagonal_Fock_matrix_mo, (ao_num) ] BEGIN_PROVIDER [ double precision, diagonal_Fock_matrix_mo, (mo_tot_num) ]
&BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num_align,mo_tot_num) ] &BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num_align,mo_tot_num) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Diagonal Fock matrix in the MO basis ! Diagonal Fock matrix in the MO basis
END_DOC END_DOC
integer :: i,j integer :: i,j, m
integer :: liwork, lwork, n, info integer :: liwork, lwork, n, info
integer, allocatable :: iwork(:) integer, allocatable :: iwork(:), isuppz(:)
double precision, allocatable :: work(:), F(:,:), S(:,:) double precision, allocatable :: work(:), F(:,:), F2(:,:)
integer :: iorb,jorb
allocate( F(mo_tot_num,mo_tot_num) ) allocate( F(mo_tot_num,mo_tot_num),F2(mo_tot_num,mo_tot_num), isuppz(2*mo_tot_num) )
do j=1,mo_tot_num do j=1,mo_tot_num
do i=1,mo_tot_num do i=1,mo_tot_num
F(i,j) = Fock_matrix_mo(i,j) F(i,j) = Fock_matrix_mo(i,j)
enddo enddo
enddo enddo
if(no_oa_or_av_opt)then if(no_oa_or_av_opt)then
integer :: iorb,jorb
do i = 1, n_act_orb do i = 1, n_act_orb
iorb = list_act(i) iorb = list_act(i)
ASSERT (iorb > 0)
ASSERT (iorb <= mo_tot_num)
do j = 1, n_inact_orb do j = 1, n_inact_orb
jorb = list_inact(j) jorb = list_inact(j)
ASSERT (jorb > 0)
ASSERT (jorb <= mo_tot_num)
F(iorb,jorb) = 0.d0 F(iorb,jorb) = 0.d0
F(jorb,iorb) = 0.d0 F(jorb,iorb) = 0.d0
enddo enddo
do j = 1, n_virt_orb do j = 1, n_virt_orb
jorb = list_virt(j) jorb = list_virt(j)
ASSERT (jorb > 0)
ASSERT (jorb <= mo_tot_num)
F(iorb,jorb) = 0.d0 F(iorb,jorb) = 0.d0
F(jorb,iorb) = 0.d0 F(jorb,iorb) = 0.d0
enddo enddo
do j = 1, n_core_orb do j = 1, n_core_orb
jorb = list_core(j) jorb = list_core(j)
ASSERT (jorb > 0)
ASSERT (jorb <= mo_tot_num)
F(iorb,jorb) = 0.d0 F(iorb,jorb) = 0.d0
F(jorb,iorb) = 0.d0 F(jorb,iorb) = 0.d0
enddo enddo
@ -53,33 +61,7 @@
n = mo_tot_num n = mo_tot_num
lwork = 1+6*n + 2*n*n lwork = 1+6*n + 2*n*n
liwork = 3 + 5*n liwork = 10*n
allocate(work(lwork))
allocate(iwork(liwork) )
lwork = -1
liwork = -1
integer :: m, ISUPPZ(mo_tot_num)
call dsyevr('V', 'A', 'U', mo_tot_num, F, size(F,1), &
-100.d0, 100.d0, 1, mo_tot_num, 0.d0, &
m, diagonal_Fock_matrix_mo, &
eigenvectors_Fock_matrix_mo, &
size(eigenvectors_Fock_matrix_mo,1), &
isuppz, work, lwork, iwork, liwork, info)
if (info /= 0) then
print *, irp_here//' DSYEVD failed : ', info
stop 1
endif
lwork = int(work(1))
liwork = iwork(1)
deallocate(iwork)
deallocate(work)
allocate(work(lwork)) allocate(work(lwork))
allocate(iwork(liwork) ) allocate(iwork(liwork) )
@ -87,23 +69,20 @@
call dsyevr('V', 'A', 'U', mo_tot_num, F, size(F,1), & call dsyevr('V', 'A', 'U', mo_tot_num, F, size(F,1), &
-100.d0, 100.d0, 1, mo_tot_num, 0.d0, & -100.d0, 100.d0, 1, mo_tot_num, 0.d0, &
m, diagonal_Fock_matrix_mo, & m, diagonal_Fock_matrix_mo, &
eigenvectors_Fock_matrix_mo, & F2, size(F2,1), &
size(eigenvectors_Fock_matrix_mo,1), &
isuppz, work, lwork, iwork, liwork, info) isuppz, work, lwork, iwork, liwork, info)
deallocate(iwork)
if (info /= 0) then if (info /= 0) then
print *, irp_here//' DSYEV failed : ', info print *, irp_here//' DSYEV failed : ', info
stop 1 stop 1
endif endif
F(1:mo_tot_num,1:mo_tot_num) = eigenvectors_Fock_matrix_mo(1:mo_tot_num,1:mo_tot_num)
call dgemm('N','N',ao_num,mo_tot_num,mo_tot_num, 1.d0, & call dgemm('N','N',ao_num,mo_tot_num,mo_tot_num, 1.d0, &
mo_coef, size(mo_coef,1), F, size(F,1), & mo_coef, size(mo_coef,1), F2, size(F2,1), &
0.d0, eigenvectors_Fock_matrix_mo, size(eigenvectors_Fock_matrix_mo,1)) 0.d0, eigenvectors_Fock_matrix_mo, size(eigenvectors_Fock_matrix_mo,1))
deallocate(work, F) deallocate(work, F2, F)
deallocate(iwork, isuppz)