Skip to content

Commit

Permalink
int8 in J and K
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdAmmar committed Dec 12, 2024
1 parent a8b51ab commit 26d09cc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 60 deletions.
40 changes: 13 additions & 27 deletions src/AOtoMO/Hartree_matrix_AO_basis.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,27 @@ subroutine Hartree_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, H)
double precision, intent(in) :: ERI_chem(ERI_size)
double precision, intent(out) :: H(nBas,nBas)

integer :: mu, nu, la, si
integer :: nunu, lala, nula, lasi, numu
integer :: nunu0, lala0
integer*8 :: mu, nu, la, si, nBas8
integer*8 :: nunu, lala, nula, lasi, numu
integer*8 :: nunu0, lala0
integer*8 :: nunununu, nunulala, nununula, nunulasi
integer*8 :: lalanunu, lasinunu, numulala, lalanumu
integer*8 :: numunula, numulasi, lasinumu, nununumu
integer*8 :: nunununu0, numunumu0

! integer*8 :: munusila
! integer*8, external :: Yoshimine_4ind
!
! do nu = 1, nBas
! do mu = 1, nu
! H(mu,nu) = 0.d0
! do la = 1, nBas
! do si = 1, nBas
! munusila = Yoshimine_4ind(int(mu, kind=8), &
! int(nu, kind=8), &
! int(si, kind=8), &
! int(la, kind=8))
! H(mu,nu) = H(mu,nu) + P(si,la) * ERI_chem(munusila)
! enddo
! enddo
! enddo
! enddo


nBas8 = int(nBas, kind=8)

!$OMP PARALLEL DEFAULT(NONE) &
!$OMP PRIVATE (nu, la, si, mu, &
!$OMP nunu0, nunu, nula, lala0, lala, lasi, numu, &
!$OMP nunununu0, nunununu, nununula, numulala, numunula, &
!$OMP nunulala, lalanunu, lalanumu, nunulasi, lasinunu, &
!$OMP numunumu0, nununumu, numulasi, lasinumu) &
!$OMP SHARED (nBas, H, P, ERI_chem)
!$OMP SHARED (nBas8, H, P, ERI_chem)
!$OMP DO
do nu = 1, nBas
do nu = 1, nBas8

nunu0 = shiftr(nu * (nu - 1), 1)
nunu = nunu0 + nu
Expand Down Expand Up @@ -107,7 +93,7 @@ subroutine Hartree_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, H)
enddo
enddo

do la = nu + 1, nBas
do la = nu + 1, nBas8

lala0 = shiftr(la * (la - 1), 1)

Expand Down Expand Up @@ -137,7 +123,7 @@ subroutine Hartree_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, H)
H(mu,nu) = H(mu,nu) + p(la,la) * ERI_chem(numulala)
enddo

do la = nu + 1, nBas
do la = nu + 1, nBas8
lala = shiftr(la * (la - 1), 1) + la
lalanumu = shiftr(lala * (lala - 1), 1) + numu
H(mu,nu) = H(mu,nu) + p(la,la) * ERI_chem(lalanumu)
Expand All @@ -164,7 +150,7 @@ subroutine Hartree_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, H)
enddo
enddo

do la = nu + 1, nBas
do la = nu + 1, nBas8
lala0 = shiftr(la * (la - 1), 1)
do si = 1, la - 1
lasi = lala0 + si
Expand All @@ -178,8 +164,8 @@ subroutine Hartree_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, H)
!$OMP END DO
!$OMP END PARALLEL

do nu = 1, nBas
do mu = nu+1, nBas
do nu = 1, nBas8
do mu = nu+1, nBas8
H(mu,nu) = H(nu,mu)
enddo
enddo
Expand Down
51 changes: 18 additions & 33 deletions src/AOtoMO/exchange_matrix_AO_basis.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,20 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
double precision, intent(in) :: ERI_chem(ERI_size)
double precision, intent(out) :: K(nBas,nBas)

integer :: mu, nu, la, si
integer :: nunu, nula, lanu, lasi, nusi, sinu
integer :: numu, mumu, mula, lamu, musi, simu
integer :: nunu0, lala0, mumu0
integer*8 :: mu, nu, la, si, nBas8
integer*8 :: nunu, nula, lanu, lasi, nusi, sinu
integer*8 :: numu, mumu, mula, lamu, musi, simu
integer*8 :: nunu0, lala0, mumu0
integer*8 :: nunununu, nulanula, lanulanu, nulanusi
integer*8 :: munulasi, lanunusi, lanusinu, numumumu
integer*8 :: nulamula, nulalamu, lanulamu, nulamusi
integer*8 :: nulasimu, lanumusi, lanusimu, simunula
integer*8 :: simulanu, nulanula0, lanulanu0

! integer*8 :: munusila
! integer*8, external :: Yoshimine_4ind
!
! do nu = 1, nBas
! do mu = 1, nu
! K(mu,nu) = 0.d0
! do la = 1, nBas
! do si = 1, nBas
! munusila = Yoshimine_4ind(int(mu, kind=8), &
! int(si, kind=8), &
! int(la, kind=8), &
! int(nu, kind=8))
! K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(munusila)
! enddo
! enddo
! enddo
! enddo


nBas8 = int(nBas, kind=8)


!$OMP PARALLEL DEFAULT (NONE) &
!$OMP PRIVATE (nu, si, la, mu, &
Expand All @@ -81,9 +66,9 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
!$OMP nulanusi, lanulamu, lanunusi, lanusinu , numumumu, &
!$OMP nulamula, nulalamu, lanumusi, lanusimu, nulamusi, &
!$OMP nulasimu, simunula, simulanu) &
!$OMP SHARED (nBas, P, ERI_chem, K)
!$OMP SHARED (nBas8, P, ERI_chem, K)
!$OMP DO
do nu = 1, nBas
do nu = 1, nBas8

nunu0 = shiftr(nu * (nu - 1), 1)
nunu = nunu0 + nu
Expand All @@ -97,7 +82,7 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
K(nu,nu) = K(nu,nu) - P(la,la) * ERI_chem(nulanula)
enddo

do la = nu + 1, nBas
do la = nu + 1, nBas8
lanu = shiftr(la * (la - 1), 1) + nu
lanulanu = shiftr(lanu * (lanu - 1), 1) + lanu
K(nu,nu) = K(nu,nu) - P(la,la) * ERI_chem(lanulanu)
Expand All @@ -112,7 +97,7 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
enddo
enddo

do la = nu + 1, nBas
do la = nu + 1, nBas8
lanu = shiftr(la * (la - 1), 1) + nu
lanulanu0 = shiftr(lanu * (lanu - 1), 1)
do si = 1, nu
Expand Down Expand Up @@ -144,7 +129,7 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
nulalamu = shiftr(nula * (nula - 1), 1) + shiftr(la * (la - 1), 1) + mu
K(mu,nu) = K(mu,nu) - P(la,la) * ERI_chem(nulalamu)
enddo
do la = nu + 1, nBas
do la = nu + 1, nBas8
lala0 = shiftr(la * (la - 1), 1)
lanu = lala0 + nu
lanulamu = shiftr(lanu * (lanu - 1), 1) + lala0 + mu
Expand All @@ -171,7 +156,7 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(nulasimu)
enddo
enddo
do la = nu + 1, nBas
do la = nu + 1, nBas8
lanu = shiftr(la * (la - 1), 1) + nu
lanulanu0 = shiftr(lanu * (lanu - 1), 1)
do si = 1, mu
Expand All @@ -195,7 +180,7 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
nulasimu = nulanula0 + shiftr(si * (si - 1), 1) + mu
K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(nulasimu)
enddo
do si = nu, nBas
do si = nu, nBas8
simu = shiftr(si * (si - 1), 1) + mu
simunula = shiftr(simu * (simu - 1), 1) + nula
K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(simunula)
Expand All @@ -208,15 +193,15 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
nulasimu = nulanula0 + shiftr(si * (si - 1), 1) + mu
K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(nulasimu)
enddo
do si = nu + 1, nBas
do si = nu + 1, nBas8
simu = shiftr(si * (si - 1), 1) + mu
simunula = shiftr(simu * (simu - 1), 1) + nula
K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(simunula)
enddo
enddo
do la = nu + 1, nBas
do la = nu + 1, nBas8
lanu = shiftr(la * (la - 1), 1) + nu
do si = la + 1, nBas
do si = la + 1, nBas8
simu = shiftr(si * (si - 1), 1) + mu
simulanu = shiftr(simu * (simu - 1), 1) + lanu
K(mu,nu) = K(mu,nu) - P(si,la) * ERI_chem(simulanu)
Expand All @@ -229,8 +214,8 @@ subroutine exchange_matrix_AO_basis_hpc(nBas, ERI_size, P, ERI_chem, K)
!$OMP END PARALLEL


do nu = 1, nBas
do mu = nu+1, nBas
do nu = 1, nBas8
do mu = nu+1, nBas8
K(mu,nu) = K(nu,mu)
enddo
enddo
Expand Down

0 comments on commit 26d09cc

Please sign in to comment.