4
1
mirror of https://github.com/pfloos/quack synced 2024-12-23 04:43:53 +01:00

change ordering of some loop to increase speed of qsGW

This commit is contained in:
Antoine Marie 2022-12-08 15:06:18 +01:00
parent ab2857b377
commit 8c1dcd96e1
3 changed files with 29 additions and 26 deletions

View File

@ -20,13 +20,13 @@ subroutine excitation_density(nBas,nC,nO,nR,nS,ERI,XpY,rho)
rho(:,:,:) = 0d0 rho(:,:,:) = 0d0
do p=nC+1,nBas-nR jb = 0
do q=nC+1,nBas-nR do j=nC+1,nO
do b=nO+1,nBas-nR
jb = jb + 1
do ia=1,nS do ia=1,nS
jb = 0 do q=nC+1,nBas-nR
do j=nC+1,nO do p=nC+1,nBas-nR
do b=nO+1,nBas-nR
jb = jb + 1
rho(p,q,ia) = rho(p,q,ia) + ERI(p,j,q,b)*XpY(ia,jb) rho(p,q,ia) = rho(p,q,ia) + ERI(p,j,q,b)*XpY(ia,jb)
enddo enddo
enddo enddo

View File

@ -78,10 +78,10 @@ subroutine self_energy_correlation(COHSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,Ec
! Occupied part of the correlation self-energy ! Occupied part of the correlation self-energy
do p=nC+1,nBas-nR do jb=1,nS
do q=nC+1,nBas-nR do i=nC+1,nO
do i=nC+1,nO do q=nC+1,nBas-nR
do jb=1,nS do p=nC+1,nBas-nR
eps = e(p) - e(i) + Omega(jb) eps = e(p) - e(i) + Omega(jb)
SigC(p,q) = SigC(p,q) + 2d0*rho(p,i,jb)*rho(q,i,jb)*eps/(eps**2 + eta**2) SigC(p,q) = SigC(p,q) + 2d0*rho(p,i,jb)*rho(q,i,jb)*eps/(eps**2 + eta**2)
end do end do
@ -91,10 +91,10 @@ subroutine self_energy_correlation(COHSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,Ec
! Virtual part of the correlation self-energy ! Virtual part of the correlation self-energy
do p=nC+1,nBas-nR do jb=1,nS
do q=nC+1,nBas-nR do a=nO+1,nBas-nR
do a=nO+1,nBas-nR do q=nC+1,nBas-nR
do jb=1,nS do p=nC+1,nBas-nR
eps = e(p) - e(a) - Omega(jb) eps = e(p) - e(a) - Omega(jb)
SigC(p,q) = SigC(p,q) + 2d0*rho(p,a,jb)*rho(q,a,jb)*eps/(eps**2 + eta**2) SigC(p,q) = SigC(p,q) + 2d0*rho(p,a,jb)*rho(q,a,jb)*eps/(eps**2 + eta**2)
end do end do
@ -105,9 +105,9 @@ subroutine self_energy_correlation(COHSEX,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,Ec
! Galitskii-Migdal correlation energy ! Galitskii-Migdal correlation energy
EcGM = 0d0 EcGM = 0d0
do i=nC+1,nO do jb=1,nS
do a=nO+1,nBas-nR do a=nO+1,nBas-nR
do jb=1,nS do i=nC+1,nO
eps = e(a) - e(i) + Omega(jb) eps = e(a) - e(i) + Omega(jb)
EcGM = EcGM - 4d0*rho(a,i,jb)*rho(a,i,jb)*eps/(eps**2 + eta**2) EcGM = EcGM - 4d0*rho(a,i,jb)*rho(a,i,jb)*eps/(eps**2 + eta**2)
end do end do

View File

@ -40,13 +40,15 @@ subroutine self_energy_correlation_SRG(eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,EcGM,
! Occupied part of the correlation self-energy ! Occupied part of the correlation self-energy
do p=nC+1,nBas-nR
do q=nC+1,nBas-nR do m=1,nS
do i=nC+1,nO do i=nC+1,nO
do m=1,nS do q=nC+1,nBas-nR
do p=nC+1,nBas-nR
Dpim = e(p) - e(i) + Omega(m) Dpim = e(p) - e(i) + Omega(m)
Dqim = e(q) - e(i) + Omega(m) Dqim = e(q) - e(i) + Omega(m)
SigC(p,q) = SigC(p,q) + 2d0*rho(p,i,m)*rho(q,i,m)*(Dpim + Dqim)/(Dpim**2 + Dqim**2) SigC(p,q) = SigC(p,q) + 2d0*rho(p,i,m)*rho(q,i,m)*(1-exp(-eta*Dpim**2)*exp(-eta*Dqim**2)) &
*(Dpim + Dqim)/(Dpim**2 + Dqim**2)
end do end do
end do end do
end do end do
@ -54,13 +56,14 @@ subroutine self_energy_correlation_SRG(eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho,EcGM,
! Virtual part of the correlation self-energy ! Virtual part of the correlation self-energy
do p=nC+1,nBas-nR do m=1,nS
do q=nC+1,nBas-nR do a=nO+1,nBas-nR
do a=nO+1,nBas-nR do q=nC+1,nBas-nR
do m=1,nS do p=nC+1,nBas-nR
Dpam = e(p) - e(a) - Omega(m) Dpam = e(p) - e(a) - Omega(m)
Dqam = e(q) - e(a) - Omega(m) Dqam = e(q) - e(a) - Omega(m)
SigC(p,q) = SigC(p,q) + 2d0*rho(p,a,m)*rho(q,a,m)*(Dpam + Dqam)/(Dpam**2 + Dqam**2) SigC(p,q) = SigC(p,q) + 2d0*rho(p,a,m)*rho(q,a,m)*(1-exp(-eta*Dpam**2)*exp(-eta*Dqam**2)) &
*(Dpam + Dqam)/(Dpam**2 + Dqam**2)
end do end do
end do end do
end do end do