9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 19:13:29 +01:00

More stable SCF

This commit is contained in:
Anthony Scemama 2020-03-06 13:55:37 +01:00
parent ac35c8dbbb
commit 2d81db3911
2 changed files with 5 additions and 2 deletions

View File

@ -7,11 +7,11 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
integer :: i,j integer :: i,j
integer :: liwork, lwork, n, info integer :: liwork, lwork, n, info
integer, allocatable :: iwork(:) integer, allocatable :: iwork(:)
double precision, allocatable :: work(:), F(:,:), S(:,:) double precision, allocatable :: work(:), F(:,:), F_save(:,:)
double precision, allocatable :: diag(:) double precision, allocatable :: diag(:)
allocate( F(mo_num,mo_num) ) allocate( F(mo_num,mo_num), F_save(mo_num,mo_num) )
allocate (diag(mo_num) ) allocate (diag(mo_num) )
do j=1,mo_num do j=1,mo_num
@ -51,6 +51,7 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
lwork = -1 lwork = -1
liwork = -1 liwork = -1
F_save = F
call dsyevd( 'V', 'U', mo_num, F, & call dsyevd( 'V', 'U', mo_num, F, &
size(F,1), diag, work, lwork, iwork, liwork, info) size(F,1), diag, work, lwork, iwork, liwork, info)
@ -71,6 +72,7 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
if (info /= 0) then if (info /= 0) then
F = F_save
call dsyev( 'V', 'L', mo_num, F, & call dsyev( 'V', 'L', mo_num, F, &
size(F,1), diag, work, lwork, info) size(F,1), diag, work, lwork, info)

View File

@ -299,6 +299,7 @@ END_DOC
Fock_matrix_AO_(i,j) = 0.d0 Fock_matrix_AO_(i,j) = 0.d0
enddo enddo
do k=1,dim_DIIS do k=1,dim_DIIS
if (dabs(X_vector_DIIS(k)) < 1.d-10) cycle
do i=1,ao_num do i=1,ao_num
Fock_matrix_AO_(i,j) = Fock_matrix_AO_(i,j) + & Fock_matrix_AO_(i,j) = Fock_matrix_AO_(i,j) + &
X_vector_DIIS(k)*Fock_matrix_DIIS(i,j,dim_DIIS-k+1) X_vector_DIIS(k)*Fock_matrix_DIIS(i,j,dim_DIIS-k+1)