4
1
mirror of https://github.com/pfloos/quack synced 2024-06-18 11:15:30 +02:00

reversing loops in HF

This commit is contained in:
Pierre-Francois Loos 2022-12-10 09:03:28 +01:00
parent b450829846
commit e41097e8c2
3 changed files with 15 additions and 15 deletions

View File

@ -126,11 +126,11 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
do while(Conv > thresh .and. nSCF < maxSCF)
! Increment
! Increment
nSCF = nSCF + 1
! Compute energy differences
! Compute energy differences
do i=nC+1,nO
do j=nC+1,nO
@ -156,7 +156,7 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
end do
end do
! Compute intermediates
! Compute intermediates
x_2h1p(:,:) = 0d0
@ -194,7 +194,7 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
end do
end do
! Compute residual for 2h1p sector
! Compute residual for 2h1p sector
do i=nC+1,nO
do j=nC+1,nO
@ -224,7 +224,7 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
end do
end do
! Compute residual for 2p1h sector
! Compute residual for 2p1h sector
do i=nC+1,nO
do a=1,nV-nR
@ -254,16 +254,16 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
end do
end do
! Check convergence
! Check convergence
Conv = max(maxval(abs(r_2h1p)),maxval(abs(r_2p1h)))
! Update amplitudes
! Update amplitudes
t_2h1p(:,:,:,:) = t_2h1p(:,:,:,:) - r_2h1p(:,:,:,:)/delta_2h1p(:,:,:,:)
t_2p1h(:,:,:,:) = t_2p1h(:,:,:,:) - r_2p1h(:,:,:,:)/delta_2p1h(:,:,:,:)
! Compute correlation energy
! Compute self-energy
SigGW(:,:) = 0d0
@ -296,7 +296,7 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
end do
end do
! Diagonalize non-Hermitian matrix
! Diagonalize non-Hermitian matrix
call diagonalize_general_matrix(nBas,SigGW,eGW,cGW)
@ -307,11 +307,11 @@ subroutine CCGW(maxSCF,thresh,nBas,nC,nO,nV,nR,ERI,ENuc,ERHF,e)
call quick_sort(eGW,order,nBas)
call set_order(cGW,order,nBas,nBas)
! Renormalization factor
! Renormalization factor
Z(:) = 1d0
! Dump results
! Dump results
write(*,'(1X,A1,1X,I3,1X,A1,1X,F10.6,1X,A1,1X,F10.6,1X,A1,1X,F10.6,1X,A1,1X)') &
'|',nSCF,'|',eGW(nO)*HaToeV,'|',eGW(nO+1)*HaToeV,'|',Conv,'|'

View File

@ -19,9 +19,9 @@ subroutine density_matrix(nBas,ON,c,P)
P(:,:) = 0d0
do mu=1,nBas
do i=1,nBas
do nu=1,nBas
do i=1,nBas
do mu=1,nBas
P(mu,nu) = P(mu,nu) + 2d0*ON(i)*c(mu,i)*c(nu,i)
enddo
enddo

View File

@ -42,8 +42,8 @@ subroutine dipole_moment(nBas,P,nNuc,ZNuc,rNuc,dipole_int,dipole)
! Electronic part
do mu=1,nBas
do nu=1,nBas
do nu=1,nBas
do mu=1,nBas
dipole(ixyz) = dipole(ixyz) - P(mu,nu)*dipole_int(mu,nu,ixyz)
enddo
enddo