From c15ea00351c35f55db7870c6aa1a380c39d35bbf Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Fri, 2 Oct 2020 13:42:21 +0200 Subject: [PATCH] CIS(D) sligntly faster --- input/options | 4 +-- src/ADC/Makefile | 3 +- src/AOtoMO/Makefile | 3 +- src/BasCor/Makefile | 3 +- src/CC/Makefile | 3 +- src/CI/D_correction.f90 | 67 ++++++++++++++++++++++++++++++++++++----- src/CI/Makefile | 3 +- src/HF/Makefile | 3 +- src/MBPT/Makefile | 3 +- src/MC/Makefile | 3 +- src/MP/Makefile | 3 +- src/Makefile | 4 ++- src/QuAcK/Makefile | 3 +- src/RPA/Makefile | 3 +- src/eDFT/Makefile | 3 +- src/utils/Makefile | 3 +- 16 files changed, 91 insertions(+), 23 deletions(-) diff --git a/input/options b/input/options index e47f07d..488a820 100644 --- a/input/options +++ b/input/options @@ -11,8 +11,8 @@ # GW/GT: maxSCF thresh DIIS n_diis lin eta COHSEX SOSEX TDA_W G0W GW0 256 0.00001 T 5 T 0.0 F F F F F # ACFDT: AC Kx XBS - F F T + T F T # BSE: BSE dBSE dTDA evDyn - T T T F + T F T F # MCMP2: nMC nEq nWalk dt nPrint iSeed doDrift 1000000 100000 10 0.3 10000 1234 T diff --git a/src/ADC/Makefile b/src/ADC/Makefile index 00821e8..d729abe 100644 --- a/src/ADC/Makefile +++ b/src/ADC/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=ADC.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/AOtoMO/Makefile b/src/AOtoMO/Makefile index ae75223..496724d 100644 --- a/src/AOtoMO/Makefile +++ b/src/AOtoMO/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=AOtoMO.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/BasCor/Makefile b/src/BasCor/Makefile index 4997d71..f5f92a6 100644 --- a/src/BasCor/Makefile +++ b/src/BasCor/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=BasCor.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/CC/Makefile b/src/CC/Makefile index af03903..59bdcb4 100644 --- a/src/CC/Makefile +++ b/src/CC/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=CC.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/CI/D_correction.f90 b/src/CI/D_correction.f90 index 9fb2b4b..ee2a7d2 100644 --- a/src/CI/D_correction.f90 +++ b/src/CI/D_correction.f90 @@ -42,6 +42,9 @@ subroutine D_correction(ispin,nBasin,nCin,nOin,nVin,nRin,nSin,maxS,eHF,ERI,w,X) double precision,allocatable :: OOOV(:,:,:,:) double precision,allocatable :: OOVV(:,:,:,:) double precision,allocatable :: OVVV(:,:,:,:) + double precision,allocatable :: X1(:,:) + double precision,allocatable :: X2(:,:) + double precision,allocatable :: X3(:,:) double precision,allocatable :: u(:,:,:,:) double precision,allocatable :: v(:,:) @@ -98,6 +101,8 @@ subroutine D_correction(ispin,nBasin,nCin,nOin,nVin,nRin,nSin,maxS,eHF,ERI,w,X) allocate(t(nO,nO,nV,nV),r(nO,nV),u(nO,nO,nV,nV),v(nO,nV)) + allocate(X1(nV,nV),X2(nO,nO),X3(nO,nV)) + ! MP2 guess amplitudes t(:,:,:,:) = -OOVV(:,:,:,:)/delta(:,:,:,:) @@ -173,21 +178,69 @@ subroutine D_correction(ispin,nBasin,nCin,nOin,nVin,nRin,nSin,maxS,eHF,ERI,w,X) end do end do + ! Compute intermediate arrays + + X1(:,:) = 0d0 + + do j=nC+1,nO + do k=nC+1,nO + do a=1,nV-nR + do b=1,nV-nR + do c=1,nV-nR + X1(a,b) = X1(a,b) + OOVV(j,k,b,c)*t(j,k,c,a) + end do + end do + end do + end do + end do + + X2(:,:) = 0d0 + + do i=nC+1,nO + do j=nC+1,nO + do k=nC+1,nO + do b=1,nV-nR + do c=1,nV-nR + X2(i,j) = X2(i,j) + OOVV(j,k,b,c)*t(i,k,c,b) + end do + end do + end do + end do + end do + + X3(:,:) = 0d0 + + do j=nC+1,nO + do k=nC+1,nO + do b=1,nV-nR + do c=1,nV-nR + X3(k,c) = X3(k,c) + 2d0*OOVV(j,k,b,c)*r(j,b) + end do + end do + end do + end do + ! Compute v array v(:,:) = 0d0 do i=nC+1,nO - do j=nC+1,nO + do a=1,nV-nR + + do b=1,nV-nR + v(i,a) = v(i,a) + r(i,b)*X1(a,b) + end do + + do j=nC+1,nO + v(i,a) = v(i,a) + r(j,a)*X2(i,j) + end do + do k=nC+1,nO - do a=1,nV-nR - do b=1,nV-nR - do c=1,nV-nR - v(i,a) = v(i,a) + OOVV(j,k,b,c)*(r(i,b)*t(j,k,c,a) + r(j,a)*t(i,k,c,b) + 2d0*r(j,b)*t(i,k,a,c)) - end do - end do + do c=1,nV-nR + v(i,a) = v(i,a) + X3(k,c)*t(i,k,a,c) end do end do + end do end do diff --git a/src/CI/Makefile b/src/CI/Makefile index 3331af2..0c8379f 100644 --- a/src/CI/Makefile +++ b/src/CI/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=CI.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/HF/Makefile b/src/HF/Makefile index fa8a68e..273c893 100644 --- a/src/HF/Makefile +++ b/src/HF/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=HF.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/MBPT/Makefile b/src/MBPT/Makefile index c4ae474..0901b11 100644 --- a/src/MBPT/Makefile +++ b/src/MBPT/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=MBPT.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/MC/Makefile b/src/MC/Makefile index dbaece1..a4d87f5 100644 --- a/src/MC/Makefile +++ b/src/MC/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=MC.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/MP/Makefile b/src/MP/Makefile index a423b1b..2c6b1ea 100644 --- a/src/MP/Makefile +++ b/src/MP/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=MP.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/Makefile b/src/Makefile index e9c9dc7..31d8569 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,7 +19,9 @@ LIB_DIRS=$(filter-out $(MAIN_DIRS), $(ALL_DIRS)) FORCE: $(SDIR)/%/Makefile: FORCE - @(echo TARGET=$*.a > $*/Makefile && echo include $$QUACK_ROOT/src/Makefile.include >> $@) + @(echo QUACK_ROOT=$(QUACK_ROOT) > $@) + @(echo TARGET=$*.a >> $@) + @(echo 'include $$(QUACK_ROOT)/src/Makefile.include' >> $@) $(LDIR)/%.a: FORCE $(SDIR)/%/Makefile $(MOD_DIRS) $(MAKE) -C $(SDIR)/$* lib diff --git a/src/QuAcK/Makefile b/src/QuAcK/Makefile index 2d30ace..bd7e38f 100644 --- a/src/QuAcK/Makefile +++ b/src/QuAcK/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=QuAcK.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/RPA/Makefile b/src/RPA/Makefile index cd01025..f64de04 100644 --- a/src/RPA/Makefile +++ b/src/RPA/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=RPA.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/eDFT/Makefile b/src/eDFT/Makefile index 7367a3c..17de0e7 100644 --- a/src/eDFT/Makefile +++ b/src/eDFT/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=eDFT.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include diff --git a/src/utils/Makefile b/src/utils/Makefile index 07c28c6..a400790 100644 --- a/src/utils/Makefile +++ b/src/utils/Makefile @@ -1,2 +1,3 @@ +QUACK_ROOT=/Users/loos/Dropbox/quack TARGET=utils.a -include /Users/loos/Dropbox/quack/src/Makefile.include +include $(QUACK_ROOT)/src/Makefile.include