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

fixed ppBSE@GF2, still need to add openMP on loops

This commit is contained in:
Antoine Marie 2024-09-06 20:40:54 +02:00
parent cd25d07f6f
commit 4134aadac5
3 changed files with 136 additions and 96 deletions

View File

@ -24,7 +24,7 @@ subroutine RGF2_ppBSE_static_kernel_B(ispin,eta,nBas,nC,nO,nV,nR,nOO,nVV,lambda,
double precision,external :: Kronecker_delta double precision,external :: Kronecker_delta
double precision :: dem,num double precision :: dem,num
integer :: i,j,k,a,b,c integer :: i,j,a,b,m,e
integer :: ab,ij integer :: ab,ij
! Output variables ! Output variables
@ -49,25 +49,34 @@ subroutine RGF2_ppBSE_static_kernel_B(ispin,eta,nBas,nC,nO,nV,nR,nOO,nVV,lambda,
do j=i,nO do j=i,nO
ij = ij + 1 ij = ij + 1
do k=nC+1,nO do m=nC+1,nO
do c=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(k) - eGF(c) dem = eGF(m) - eGF(e)
num = 2d0*ERI(a,k,i,c)*ERI(b,c,j,k) - ERI(a,k,i,c)*ERI(b,c,k,j) & num = 2d0*ERI(a,m,i,e)*ERI(e,b,m,j) - ERI(a,m,i,e)*ERI(e,b,j,m) &
- ERI(a,k,c,i)*ERI(b,c,j,k) - ERI(a,k,c,i)*ERI(b,c,k,j) - ERI(a,m,e,i)*ERI(e,b,m,j) - ERI(a,m,e,i)*ERI(e,b,j,m)
KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2) KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
dem = eGF(k) - eGF(c) num = 2d0*ERI(a,e,i,m)*ERI(m,b,e,j) - ERI(a,e,i,m)*ERI(m,b,j,e) &
num = 2d0*ERI(b,k,i,c)*ERI(a,c,j,k) - ERI(b,k,i,c)*ERI(a,c,k,j) & - ERI(a,e,m,i)*ERI(m,b,e,j) - ERI(a,e,m,i)*ERI(m,b,j,e)
- ERI(b,k,c,i)*ERI(a,c,j,k) - ERI(b,k,c,i)*ERI(a,c,k,j)
KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,m,i,e)*ERI(e,a,m,j) - ERI(b,m,i,e)*ERI(e,a,j,m) &
- ERI(b,m,e,i)*ERI(e,a,m,j) - ERI(b,m,e,i)*ERI(e,a,j,m)
KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,e,i,m)*ERI(m,a,e,j) - ERI(b,e,i,m)*ERI(m,a,j,e) &
- ERI(b,e,m,i)*ERI(m,a,e,j) - ERI(b,e,m,i)*ERI(m,a,j,e)
KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2) KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
end do end do
end do end do
KB_sta(ab,ij) = 2d0*lambda*KB_sta(ab,ij)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(i,j))) KB_sta(ab,ij) = lambda*KB_sta(ab,ij)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(i,j)))
end do end do
end do end do
@ -91,20 +100,29 @@ subroutine RGF2_ppBSE_static_kernel_B(ispin,eta,nBas,nC,nO,nV,nR,nOO,nVV,lambda,
do j=i+1,nO do j=i+1,nO
ij = ij + 1 ij = ij + 1
do k=nC+1,nO do m=nC+1,nO
do c=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(k) - eGF(c) dem = eGF(m) - eGF(e)
num = 2d0*ERI(a,k,i,c)*ERI(b,c,j,k) - ERI(a,k,i,c)*ERI(b,c,k,j) & num = 2d0*ERI(a,m,i,e)*ERI(e,b,m,j) - ERI(a,m,i,e)*ERI(e,b,j,m) &
- ERI(a,k,c,i)*ERI(b,c,j,k) + ERI(a,k,c,i)*ERI(b,c,k,j) - ERI(a,m,e,i)*ERI(e,b,m,j) + ERI(a,m,e,i)*ERI(e,b,j,m)
KB_sta(ab,ij) = KB_sta(ab,ij) + 2d0*num*dem/(dem**2 + eta**2) KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
dem = eGF(k) - eGF(c) num = 2d0*ERI(a,e,i,m)*ERI(m,b,e,j) - ERI(a,e,i,m)*ERI(m,b,j,e) &
num = 2d0*ERI(b,k,i,c)*ERI(a,c,j,k) - ERI(b,k,i,c)*ERI(a,c,k,j) & - ERI(a,e,m,i)*ERI(m,b,e,j) + ERI(a,e,m,i)*ERI(m,b,j,e)
- ERI(b,k,c,i)*ERI(a,c,j,k) + ERI(b,k,c,i)*ERI(a,c,k,j)
KB_sta(ab,ij) = KB_sta(ab,ij) - 2d0*num*dem/(dem**2 + eta**2) KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,m,i,e)*ERI(e,a,m,j) - ERI(b,m,i,e)*ERI(e,a,j,m) &
- ERI(b,m,e,i)*ERI(e,a,m,j) + ERI(b,m,e,i)*ERI(e,a,j,m)
KB_sta(ab,ij) = KB_sta(ab,ij) - num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,e,i,m)*ERI(m,a,e,j) - ERI(b,e,i,m)*ERI(m,a,j,e) &
- ERI(b,e,m,i)*ERI(m,a,e,j) + ERI(b,e,m,i)*ERI(m,a,j,e)
KB_sta(ab,ij) = KB_sta(ab,ij) - num*dem/(dem**2 + eta**2)
end do end do
end do end do
@ -131,20 +149,15 @@ subroutine RGF2_ppBSE_static_kernel_B(ispin,eta,nBas,nC,nO,nV,nR,nOO,nVV,lambda,
do j=i+1,nO do j=i+1,nO
ij = ij + 1 ij = ij + 1
do k=nC+1,nO do m=nC+1,nO
do c=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(k) - eGF(c) dem = eGF(m) - eGF(e)
num = ERI(a,k,i,c)*ERI(b,c,j,k) - ERI(a,k,i,c)*ERI(b,c,k,j) & num = (ERI(a,m,i,e) - ERI(a,m,e,i)) * (ERI(e,b,m,j) - ERI(e,b,j,m))
- ERI(a,k,c,i)*ERI(b,c,j,k) + ERI(a,k,c,i)*ERI(b,c,k,j) num = num + (ERI(a,e,i,m) - ERI(a,e,m,i)) * (ERI(m,b,e,j) - ERI(m,b,j,e))
num = num - (ERI(b,m,i,e) - ERI(b,m,e,i)) * (ERI(e,a,m,j) - ERI(e,a,j,m))
KB_sta(ab,ij) = KB_sta(ab,ij) + 2d0*num*dem/(dem**2 + eta**2) num = num - (ERI(b,e,i,m) - ERI(b,e,m,i)) * (ERI(m,a,e,j) - ERI(m,a,j,e))
KB_sta(ab,ij) = KB_sta(ab,ij) + num*dem/(dem**2 + eta**2)
dem = eGF(k) - eGF(c)
num = ERI(b,k,i,c)*ERI(a,c,j,k) - ERI(b,k,i,c)*ERI(a,c,k,j) &
- ERI(b,k,c,i)*ERI(a,c,j,k) + ERI(b,k,c,i)*ERI(a,c,k,j)
KB_sta(ab,ij) = KB_sta(ab,ij) - 2d0*num*dem/(dem**2 + eta**2)
end do end do
end do end do

View File

@ -125,21 +125,30 @@ subroutine RGF2_ppBSE_static_kernel_C(ispin,eta,nBas,nC,nO,nV,nR,nVV,lambda,ERI,
do e=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(m) - eGF(e) dem = eGF(m) - eGF(e)
num = 2d0*ERI(a,m,c,e)*ERI(b,e,d,m) - ERI(a,m,c,e)*ERI(b,e,m,d) & num = 2d0*ERI(a,m,c,e)*ERI(e,b,m,d) - ERI(a,m,c,e)*ERI(e,b,d,m) &
- ERI(a,m,e,c)*ERI(b,e,d,m) - ERI(a,m,e,c)*ERI(b,e,m,d) - ERI(a,m,e,c)*ERI(e,b,m,d) - ERI(a,m,e,c)*ERI(e,b,d,m)
KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2) KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
dem = eGF(m) - eGF(e) num = 2d0*ERI(a,e,c,m)*ERI(m,b,e,d) - ERI(a,e,c,m)*ERI(m,b,d,e) &
num = 2d0*ERI(b,m,c,e)*ERI(a,e,d,m) - ERI(b,m,c,e)*ERI(a,e,m,d) & - ERI(a,e,m,c)*ERI(m,b,e,d) - ERI(a,e,m,c)*ERI(m,b,d,e)
- ERI(b,m,e,c)*ERI(a,e,d,m) - ERI(b,m,e,c)*ERI(a,e,m,d)
KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,m,c,e)*ERI(e,a,m,d) - ERI(b,m,c,e)*ERI(e,a,d,m) &
- ERI(b,m,e,c)*ERI(e,a,m,d) - ERI(b,m,e,c)*ERI(e,a,d,m)
KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,e,c,m)*ERI(m,a,e,d) - ERI(b,e,c,m)*ERI(m,a,d,e) &
- ERI(b,e,m,c)*ERI(m,a,e,d) - ERI(b,e,m,c)*ERI(m,a,d,e)
KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2) KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
end do end do
end do end do
KC_sta(ab,cd) = 2d0*lambda*KC_sta(ab,cd)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(c,d))) KC_sta(ab,cd) = lambda*KC_sta(ab,cd)/sqrt((1d0 + Kronecker_delta(a,b))*(1d0 + Kronecker_delta(c,d)))
end do end do
end do end do
@ -217,17 +226,26 @@ subroutine RGF2_ppBSE_static_kernel_C(ispin,eta,nBas,nC,nO,nV,nR,nVV,lambda,ERI,
do m=nC+1,nO do m=nC+1,nO
do e=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(m) - eGF(e) dem = eGF(m) - eGF(e)
num = 2d0*ERI(a,m,c,e)*ERI(b,e,d,m) - ERI(a,m,c,e)*ERI(b,e,m,d) & num = 2d0*ERI(a,m,c,e)*ERI(e,b,m,d) - ERI(a,m,c,e)*ERI(e,b,d,m) &
- ERI(a,m,e,c)*ERI(b,e,d,m) + ERI(a,m,e,c)*ERI(b,e,m,d) - ERI(a,m,e,c)*ERI(e,b,m,d) + ERI(a,m,e,c)*ERI(e,b,d,m)
KC_sta(ab,cd) = KC_sta(ab,cd) + 2d0*num*dem/(dem**2 + eta**2) KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
dem = eGF(m) - eGF(e) num = 2d0*ERI(a,e,c,m)*ERI(m,b,e,d) - ERI(a,e,c,m)*ERI(m,b,d,e) &
num = 2d0*ERI(b,m,c,e)*ERI(a,e,d,m) - ERI(b,m,c,e)*ERI(a,e,m,d) & - ERI(a,e,m,c)*ERI(m,b,e,d) + ERI(a,e,m,c)*ERI(m,b,d,e)
- ERI(b,m,e,c)*ERI(a,e,d,m) + ERI(b,m,e,c)*ERI(a,e,m,d)
KC_sta(ab,cd) = KC_sta(ab,cd) - 2d0*num*dem/(dem**2 + eta**2) KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,m,c,e)*ERI(e,a,m,d) - ERI(b,m,c,e)*ERI(e,a,d,m) &
- ERI(b,m,e,c)*ERI(e,a,m,d) + ERI(b,m,e,c)*ERI(e,a,d,m)
KC_sta(ab,cd) = KC_sta(ab,cd) - num*dem/(dem**2 + eta**2)
num = 2d0*ERI(b,e,c,m)*ERI(m,a,e,d) - ERI(b,e,c,m)*ERI(m,a,d,e) &
- ERI(b,e,m,c)*ERI(m,a,e,d) + ERI(b,e,m,c)*ERI(m,a,d,e)
KC_sta(ab,cd) = KC_sta(ab,cd) - num*dem/(dem**2 + eta**2)
end do end do
end do end do
@ -256,16 +274,12 @@ subroutine RGF2_ppBSE_static_kernel_C(ispin,eta,nBas,nC,nO,nV,nR,nVV,lambda,ERI,
do e=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(m) - eGF(e) dem = eGF(m) - eGF(e)
num = ERI(a,m,c,e)*ERI(b,e,d,m) - ERI(a,m,c,e)*ERI(b,e,m,d) & num = (ERI(a,m,c,e) - ERI(a,m,e,c)) * (ERI(e,b,m,d) - ERI(e,b,d,m))
- ERI(a,m,e,c)*ERI(b,e,d,m) + ERI(a,m,e,c)*ERI(b,e,m,d) num = num + (ERI(a,e,c,m) - ERI(a,e,m,c)) * (ERI(m,b,e,d) - ERI(m,b,d,e))
num = num - (ERI(b,m,c,e) - ERI(b,m,e,c)) * (ERI(e,a,m,d) - ERI(e,a,d,m))
num = num - (ERI(b,e,c,m) - ERI(b,e,m,c)) * (ERI(m,a,e,d) - ERI(m,a,d,e))
KC_sta(ab,cd) = KC_sta(ab,cd) + 2d0*num*dem/(dem**2 + eta**2) KC_sta(ab,cd) = KC_sta(ab,cd) + num*dem/(dem**2 + eta**2)
dem = eGF(m) - eGF(e)
num = ERI(b,m,c,e)*ERI(a,e,d,m) - ERI(b,m,c,e)*ERI(a,e,m,d) &
- ERI(b,m,e,c)*ERI(a,e,d,m) + ERI(b,m,e,c)*ERI(a,e,m,d)
KC_sta(ab,cd) = KC_sta(ab,cd) - 2d0*num*dem/(dem**2 + eta**2)
end do end do
end do end do

View File

@ -53,21 +53,30 @@ subroutine RGF2_ppBSE_static_kernel_D(ispin,eta,nBas,nC,nO,nV,nR,nOO,lambda,ERI,
do e=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = eGF(m) - eGF(e) dem = eGF(m) - eGF(e)
num = 2d0*ERI(i,e,k,m)*ERI(j,m,l,e) - ERI(i,e,k,m)*ERI(j,m,e,l) & num = 2d0*ERI(i,m,k,e)*ERI(e,j,m,l) - ERI(i,m,k,e)*ERI(e,j,l,m) &
- ERI(i,e,m,k)*ERI(j,m,l,e) - ERI(i,e,m,k)*ERI(j,m,e,l) - ERI(i,m,e,k)*ERI(e,j,m,l) - ERI(i,m,e,k)*ERI(e,j,l,m)
KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2) KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
dem = eGF(m) - eGF(e) num = 2d0*ERI(i,e,k,m)*ERI(m,j,e,l) - ERI(i,e,k,m)*ERI(m,j,l,e) &
num = 2d0*ERI(j,e,k,m)*ERI(i,m,l,e) - ERI(j,e,k,m)*ERI(i,m,e,l) & - ERI(i,e,m,k)*ERI(m,j,e,l) - ERI(i,e,m,k)*ERI(m,j,l,e)
- ERI(j,e,m,k)*ERI(i,m,l,e) - ERI(j,e,m,k)*ERI(i,m,e,l)
KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(j,m,k,e)*ERI(e,i,m,l) - ERI(j,m,k,e)*ERI(e,i,l,m) &
- ERI(j,m,e,k)*ERI(e,i,m,l) - ERI(j,m,e,k)*ERI(e,i,l,m)
KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(j,e,k,m)*ERI(m,i,e,l) - ERI(j,e,k,m)*ERI(m,i,l,e) &
- ERI(j,e,m,k)*ERI(m,i,e,l) - ERI(j,e,m,k)*ERI(m,i,l,e)
KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2) KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
end do end do
end do end do
KD_sta(ij,kl) = 2d0*lambda*KD_sta(ij,kl)/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(k,l))) KD_sta(ij,kl) = lambda*KD_sta(ij,kl)/sqrt((1d0 + Kronecker_delta(i,j))*(1d0 + Kronecker_delta(k,l)))
end do end do
end do end do
@ -94,17 +103,26 @@ subroutine RGF2_ppBSE_static_kernel_D(ispin,eta,nBas,nC,nO,nV,nR,nOO,lambda,ERI,
do m=nC+1,nO do m=nC+1,nO
do e=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = - eGF(e) + eGF(m) dem = eGF(m) - eGF(e)
num = 2d0*ERI(i,e,k,m)*ERI(j,m,l,e) - ERI(i,e,k,m)*ERI(j,m,e,l) & num = 2d0*ERI(i,m,k,e)*ERI(e,j,m,l) - ERI(i,m,k,e)*ERI(e,j,l,m) &
- ERI(i,e,m,k)*ERI(j,m,l,e) + ERI(i,e,m,k)*ERI(j,m,e,l) - ERI(i,m,e,k)*ERI(e,j,m,l) + ERI(i,m,e,k)*ERI(e,j,l,m)
KD_sta(ij,kl) = KD_sta(ij,kl) + 2d0*num*dem/(dem**2 + eta**2) KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
dem = - eGF(e) + eGF(m) num = 2d0*ERI(i,e,k,m)*ERI(m,j,e,l) - ERI(i,e,k,m)*ERI(m,j,l,e) &
num = 2d0*ERI(j,e,k,m)*ERI(i,m,l,e) - ERI(j,e,k,m)*ERI(i,m,e,l) & - ERI(i,e,m,k)*ERI(m,j,e,l) + ERI(i,e,m,k)*ERI(m,j,l,e)
- ERI(j,e,m,k)*ERI(i,m,l,e) + ERI(j,e,m,k)*ERI(i,m,e,l)
KD_sta(ij,kl) = KD_sta(ij,kl) - 2d0*num*dem/(dem**2 + eta**2) KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
num = 2d0*ERI(j,m,k,e)*ERI(e,i,m,l) - ERI(j,m,k,e)*ERI(e,i,l,m) &
- ERI(j,m,e,k)*ERI(e,i,m,l) + ERI(j,m,e,k)*ERI(e,i,l,m)
KD_sta(ij,kl) = KD_sta(ij,kl) - num*dem/(dem**2 + eta**2)
num = 2d0*ERI(j,e,k,m)*ERI(m,i,e,l) - ERI(j,e,k,m)*ERI(m,i,l,e) &
- ERI(j,e,m,k)*ERI(m,i,e,l) + ERI(j,e,m,k)*ERI(m,i,l,e)
KD_sta(ij,kl) = KD_sta(ij,kl) - num*dem/(dem**2 + eta**2)
end do end do
end do end do
@ -134,19 +152,14 @@ subroutine RGF2_ppBSE_static_kernel_D(ispin,eta,nBas,nC,nO,nV,nR,nOO,lambda,ERI,
do m=nC+1,nO do m=nC+1,nO
do e=nO+1,nBas-nR do e=nO+1,nBas-nR
dem = - eGF(e) + eGF(m) dem = eGF(m) - eGF(e)
num = ERI(i,e,k,m)*ERI(j,m,l,e) - ERI(i,e,k,m)*ERI(j,m,e,l) & num = (ERI(i,m,k,e) - ERI(i,m,e,k)) * (ERI(e,j,m,l) - ERI(e,j,l,m))
- ERI(i,e,m,k)*ERI(j,m,l,e) + ERI(i,e,m,k)*ERI(j,m,e,l) num = num + (ERI(i,e,k,m) - ERI(i,e,m,k)) * (ERI(m,j,e,l) - ERI(m,j,l,e))
num = num - (ERI(j,m,k,e) - ERI(j,m,e,k)) * (ERI(e,i,m,l) - ERI(e,i,l,m))
num = num - (ERI(j,e,k,m) - ERI(j,e,m,k)) * (ERI(m,i,e,l) - ERI(m,i,l,e))
KD_sta(ij,kl) = KD_sta(ij,kl) + 2d0*num*dem/(dem**2 + eta**2) KD_sta(ij,kl) = KD_sta(ij,kl) + num*dem/(dem**2 + eta**2)
end do
dem = - eGF(e) + eGF(m)
num = ERI(j,e,k,m)*ERI(i,m,l,e) - ERI(j,e,k,m)*ERI(i,m,e,l) &
- ERI(j,e,m,k)*ERI(i,m,l,e) + ERI(j,e,m,k)*ERI(i,m,e,l)
KD_sta(ij,kl) = KD_sta(ij,kl) - 2d0*num*dem/(dem**2 + eta**2)
end do
end do end do
end do end do