From 20900979c4eef5ec4042be9e0b158e8ad5c32a0c Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Sun, 1 Dec 2024 11:38:55 +0100 Subject: [PATCH] opt memory access in Aph & Bph --- src/LR/phLR_A.f90 | 40 ++++++++++++++++++++-------------------- src/LR/phLR_B.f90 | 22 +++++++++++----------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/LR/phLR_A.f90 b/src/LR/phLR_A.f90 index 4b44aa7..708799a 100644 --- a/src/LR/phLR_A.f90 +++ b/src/LR/phLR_A.f90 @@ -7,31 +7,31 @@ subroutine phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,e,ERI,Aph) ! Input variables - logical,intent(in) :: dRPA - integer,intent(in) :: ispin - integer,intent(in) :: nBas - integer,intent(in) :: nC - integer,intent(in) :: nO - integer,intent(in) :: nV - integer,intent(in) :: nR - integer,intent(in) :: nS - double precision,intent(in) :: lambda - double precision,intent(in) :: e(nBas) - double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas) + logical,intent(in) :: dRPA + integer,intent(in) :: ispin + integer,intent(in) :: nBas + integer,intent(in) :: nC + integer,intent(in) :: nO + integer,intent(in) :: nV + integer,intent(in) :: nR + integer,intent(in) :: nS + double precision,intent(in) :: lambda + double precision,intent(in) :: e(nBas) + double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas) ! Local variables - double precision :: delta_dRPA - double precision,external :: Kronecker_delta + double precision :: delta_dRPA + double precision,external :: Kronecker_delta - integer :: i,j,a,b,ia,jb - integer :: nn,jb0 - logical :: i_eq_j - double precision :: ct1,ct2 + integer :: i,j,a,b,ia,jb + integer :: nn,jb0 + logical :: i_eq_j + double precision :: ct1,ct2 ! Output variables - double precision,intent(out) :: Aph(nS,nS) + double precision,intent(out) :: Aph(nS,nS) ! Direct RPA @@ -60,7 +60,7 @@ subroutine phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,e,ERI,Aph) do b = nO+1, nBas-nR jb = b + jb0 - Aph(ia,jb) = ct1 * ERI(i,b,a,j) + ct2 * ERI(i,b,j,a) + Aph(ia,jb) = ct1 * ERI(b,i,j,a) + ct2 * ERI(b,j,a,i) if(i_eq_j) then if(a == b) Aph(ia,jb) = Aph(ia,jb) + e(a) - e(i) endif @@ -109,7 +109,7 @@ subroutine phLR_A(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,e,ERI,Aph) do b = nO+1, nBas-nR jb = b + jb0 - Aph(ia,jb) = ct2 * ERI(i,b,j,a) + Aph(ia,jb) = ct2 * ERI(b,j,a,i) if(i_eq_j) then if(a == b) Aph(ia,jb) = Aph(ia,jb) + e(a) - e(i) endif diff --git a/src/LR/phLR_B.f90 b/src/LR/phLR_B.f90 index 954065a..9645952 100644 --- a/src/LR/phLR_B.f90 +++ b/src/LR/phLR_B.f90 @@ -7,22 +7,22 @@ subroutine phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,ERI,Bph) ! Input variables - logical,intent(in) :: dRPA - integer,intent(in) :: ispin,nBas,nC,nO,nV,nR,nS - double precision,intent(in) :: lambda - double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas) + logical,intent(in) :: dRPA + integer,intent(in) :: ispin,nBas,nC,nO,nV,nR,nS + double precision,intent(in) :: lambda + double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas) ! Local variables - double precision :: delta_dRPA + double precision :: delta_dRPA - integer :: i,j,a,b,ia,jb - integer :: nn,jb0 - double precision :: ct1,ct2 + integer :: i,j,a,b,ia,jb + integer :: nn,jb0 + double precision :: ct1,ct2 ! Output variables - double precision,intent(out) :: Bph(nS,nS) + double precision,intent(out) :: Bph(nS,nS) ! Direct RPA @@ -50,7 +50,7 @@ subroutine phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,ERI,Bph) do b = nO+1, nBas-nR jb = b + jb0 - Bph(ia,jb) = ct1 * ERI(i,j,a,b) + ct2 * ERI(i,j,b,a) + Bph(ia,jb) = ct1 * ERI(b,i,j,a) + ct2 * ERI(b,j,i,a) enddo enddo enddo @@ -94,7 +94,7 @@ subroutine phLR_B(ispin,dRPA,nBas,nC,nO,nV,nR,nS,lambda,ERI,Bph) do b = nO+1, nBas-nR jb = b + jb0 - Bph(ia,jb) = ct2 * ERI(i,j,b,a) + Bph(ia,jb) = ct2 * ERI(b,j,i,a) enddo enddo enddo