10
1
mirror of https://github.com/pfloos/quack synced 2025-05-06 07:05:33 +02:00

bug fix in self energy and parallelisation of self energy

This commit is contained in:
Loris Burth 2025-04-23 15:05:25 +02:00
parent 179a0835b3
commit d6e25e67f0
6 changed files with 62 additions and 11 deletions

View File

@ -49,6 +49,10 @@ subroutine complex_RGW_SRG_SigC_dSigC(flow,p,eta,nBas,nC,nO,nV,nR,nS,Re_w,Im_w,R
! Occupied part
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(p,rho,eta,nS,nC,nO,nR,Re_w,Im_w,Re_e,Im_e,Om,s), &
!$OMP PRIVATE(m,i,eps,num,eta_tilde,tmp) &
!$OMP REDUCTION(+:Re_SigC,Im_SigC,Re_DS,Im_DS)
do i=nC+1,nO
do m=1,nS
eps = Re_w - Re_e(i) + real(Om(m))
@ -66,9 +70,15 @@ subroutine complex_RGW_SRG_SigC_dSigC(flow,p,eta,nBas,nC,nO,nV,nR,nS,Re_w,Im_w,R
Im_DS = Im_DS + aimag(tmp)
end do
end do
!$OMP END PARALLEL DO
! Virtual part
!$OMP PARALLEL &
!$OMP SHARED(p,nBas,rho,eta,nS,nC,nO,nR,Re_w,Im_w,Re_e,Im_e,Om,s) &
!$OMP PRIVATE(m,a,eps,tmp,eta_tilde,num) &
!$OMP REDUCTION(+:Re_SigC,Im_SigC,Re_DS,Im_DS) &
!$OMP DEFAULT(NONE)
!$OMP DO
do a=nO+1,nBas-nR
do m=1,nS
eps = Re_w - Re_e(a) - real(Om(m))
@ -85,4 +95,7 @@ subroutine complex_RGW_SRG_SigC_dSigC(flow,p,eta,nBas,nC,nO,nV,nR,nS,Re_w,Im_w,R
Im_DS = Im_DS + aimag(tmp)
end do
end do
!$OMP END DO
!$OMP END PARALLEL
end subroutine

View File

@ -150,7 +150,7 @@ subroutine complex_RGW_SRG_self_energy(flow,eta,nBas,nOrb,nC,nO,nV,nR,nS,e,Om,rh
eta_tilde = eta + aimag(e(p)) - aimag(e(a)) - aimag(Om(m))
num = 2d0*rho(p,a,m)*rho(p,a,m)*(1d0-exp(-2d0*s*(eps**2+eta_tilde**2)))
tmp = num*cmplx(-(eps**2 - eta_tilde**2)/(eps**2 + eta_tilde**2)**2,&
2*eta_tilde*eps/eps/(eps**2 + eta_tilde**2)**2,kind=8)
2*eta_tilde*eps/(eps**2 + eta_tilde**2)**2,kind=8)
Re_DS(p) = Re_DS(p) + real(tmp)
Im_DS(p) = Im_DS(p) + aimag(tmp)
end do

View File

@ -53,6 +53,11 @@ subroutine complex_RGW_SRG_self_energy_diag(flow,eta,nBas,nOrb,nC,nO,nV,nR,nS,Re
!----------------!
! Occupied part of the correlation self-energy
!$OMP PARALLEL &
!$OMP SHARED(nBas,Re_Sig,Im_Sig,Re_Z,Im_Z,rho,eta,nS,nC,nO,nOrb,nR,Re_e,Im_e,Om,Re_DS,s,Im_DS), &
!$OMP PRIVATE(m,i,p,eps,num,eta_tilde,tmp) &
!$OMP DEFAULT(NONE)
!$OMP DO
do p=nC+1,nBas-nR
do i=nC+1,nO
do m=1,nS
@ -71,9 +76,15 @@ subroutine complex_RGW_SRG_self_energy_diag(flow,eta,nBas,nOrb,nC,nO,nV,nR,nS,Re
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Virtual part of the correlation self-energy
!$OMP PARALLEL &
!$OMP SHARED(nBas,Re_Sig,Im_Sig,Re_Z,Im_Z,Re_DS,Im_DS,rho,eta,nS,nC,nO,nOrb,nR,Re_e,Im_e,Om,s) &
!$OMP PRIVATE(m,a,p,eps,tmp,eta_tilde,num) &
!$OMP DEFAULT(NONE)
!$OMP DO
do p=nC+1,nBas-nR
do a=nO+1,nBas-nR
do m=1,nS
@ -86,13 +97,14 @@ subroutine complex_RGW_SRG_self_energy_diag(flow,eta,nBas,nOrb,nC,nO,nV,nR,nS,Re
Re_Sig(p) = Re_Sig(p) + real(tmp)
Im_Sig(p) = Im_Sig(p) + aimag(tmp)
tmp = num*cmplx(-(eps**2 - eta_tilde**2)/(eps**2 + eta_tilde**2)**2,&
2*eta_tilde*eps/eps/(eps**2 + eta_tilde**2)**2,kind=8)
2*eta_tilde*eps/(eps**2 + eta_tilde**2)**2,kind=8)
Re_DS(p) = Re_DS(p) + real(tmp)
Im_DS(p) = Im_DS(p) + aimag(tmp)
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Compute renormalization factor from derivative
Re_Z(:) = (1d0-Re_DS(:))/((1d0 - Re_DS(:))**2 + Im_DS(:)**2)

View File

@ -47,7 +47,12 @@ subroutine complex_RGW_SigC_dSigC(p,eta,nBas,nC,nO,nV,nR,nS,Re_w,Im_w,Re_e,Im_e,
! Compute self energy and its derivative
! Occupied part
!$OMP PARALLEL &
!$OMP SHARED(p,rho,eta,nS,nC,nO,nR,Re_w,Im_w,Re_e,Im_e,Om), &
!$OMP PRIVATE(m,i,eps,num,eta_tilde,tmp) &
!$OMP REDUCTION(+:Re_SigC,Im_SigC,Re_DS,Im_DS)&
!$OMP DEFAULT(NONE)
!$OMP DO
do i=nC+1,nO
do m=1,nS
eps = Re_w - Re_e(i) + real(Om(m))
@ -65,9 +70,16 @@ subroutine complex_RGW_SigC_dSigC(p,eta,nBas,nC,nO,nV,nR,nS,Re_w,Im_w,Re_e,Im_e,
Im_DS = Im_DS + aimag(tmp)
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Virtual part
!$OMP PARALLEL &
!$OMP SHARED(p,nBas,rho,eta,nS,nC,nO,nR,Re_w,Im_w,Re_e,Im_e,Om) &
!$OMP PRIVATE(m,a,eps,tmp,eta_tilde,num) &
!$OMP REDUCTION(+:Re_SigC,Im_SigC,Re_DS,Im_DS) &
!$OMP DEFAULT(NONE)
!$OMP DO
do a=nO+1,nBas-nR
do m=1,nS
eps = Re_w - Re_e(a) - real(Om(m))
@ -84,4 +96,6 @@ subroutine complex_RGW_SigC_dSigC(p,eta,nBas,nC,nO,nV,nR,nS,Re_w,Im_w,Re_e,Im_e,
Im_DS = Im_DS + aimag(tmp)
end do
end do
!$OMP END DO
!$OMP END PARALLEL
end subroutine

View File

@ -144,7 +144,7 @@ subroutine complex_RGW_self_energy(eta,nBas,nOrb,nC,nO,nV,nR,nS,e,Om,rho,EcGM,Si
eta_tilde = eta + aimag(e(p)) - aimag(e(a)) - aimag(Om(m))
num = 2d0*rho(p,a,m)*rho(p,a,m)
tmp = num*cmplx(-(eps**2 - eta_tilde**2)/(eps**2 + eta_tilde**2)**2,&
2*eta_tilde*eps/eps/(eps**2 + eta_tilde**2)**2,kind=8)
2*eta_tilde*eps/(eps**2 + eta_tilde**2)**2,kind=8)
Re_DS(p) = Re_DS(p) + real(tmp)
Im_DS(p) = Im_DS(p) + aimag(tmp)
end do

View File

@ -50,6 +50,11 @@ subroutine complex_RGW_self_energy_diag(eta,nBas,nOrb,nC,nO,nV,nR,nS,Re_e,Im_e,O
!----------------!
! Occupied part of the correlation self-energy
!$OMP PARALLEL &
!$OMP SHARED(nBas,Re_Sig,Im_Sig,rho,eta,nS,nC,nO,nOrb,nR,Re_e,Im_e,Om,Re_DS,Im_DS) &
!$OMP PRIVATE(m,i,p,eps,num,eta_tilde,tmp) &
!$OMP DEFAULT(NONE)
!$OMP DO
do p=nC+1,nBas-nR
do i=nC+1,nO
do m=1,nS
@ -68,9 +73,15 @@ subroutine complex_RGW_self_energy_diag(eta,nBas,nOrb,nC,nO,nV,nR,nS,Re_e,Im_e,O
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Virtual part of the correlation self-energy
!$OMP PARALLEL &
!$OMP SHARED(nBas,Re_Sig,Im_Sig,rho,eta,nS,nC,nO,nOrb,nR,Re_e,Im_e,Om,Re_DS,Im_DS) &
!$OMP PRIVATE(m,a,p,eps,num,eta_tilde,tmp) &
!$OMP DEFAULT(NONE)
!$OMP DO
do p=nC+1,nBas-nR
do a=nO+1,nBas-nR
do m=1,nS
@ -83,13 +94,14 @@ subroutine complex_RGW_self_energy_diag(eta,nBas,nOrb,nC,nO,nV,nR,nS,Re_e,Im_e,O
Re_Sig(p) = Re_Sig(p) + real(tmp)
Im_Sig(p) = Im_Sig(p) + aimag(tmp)
tmp = num*cmplx(-(eps**2 - eta_tilde**2)/(eps**2 + eta_tilde**2)**2,&
2*eta_tilde*eps/eps/(eps**2 + eta_tilde**2)**2,kind=8)
2*eta_tilde*eps/(eps**2 + eta_tilde**2)**2,kind=8)
Re_DS(p) = Re_DS(p) + real(tmp)
Im_DS(p) = Im_DS(p) + aimag(tmp)
end do
end do
end do
!$OMP END DO
!$OMP END PARALLEL
! Compute renormalization factor from derivative
Re_Z(:) = (1d0-Re_DS(:))/((1d0 - Re_DS(:))**2 + Im_DS(:)**2)