4
1
mirror of https://github.com/pfloos/quack synced 2024-06-02 03:15:31 +02:00
quack/src/QuAcK/QuAcK.f90

700 lines
24 KiB
Fortran
Raw Normal View History

2019-03-19 10:13:33 +01:00
program QuAcK
implicit none
include 'parameters.h'
2019-05-07 22:55:36 +02:00
logical :: doSph
2019-03-19 10:13:33 +01:00
logical :: doRHF,doUHF,doMOM
logical :: doMP2,doMP3,doMP2F12
logical :: doCCD,doCCSD,doCCSDT
2020-01-14 14:44:01 +01:00
logical :: do_ring_CCD,do_ladder_CCD
2020-01-13 23:08:03 +01:00
logical :: doCIS,doRPA,doTDHF
logical :: doppRPA,doADC
2019-03-19 10:13:33 +01:00
logical :: doGF2,doGF3
logical :: doG0W0,doevGW,doqsGW
2019-10-16 18:14:47 +02:00
logical :: doG0T0,doevGT,doqsGT
2019-03-19 10:13:33 +01:00
logical :: doMCMP2,doMinMCMP2
2019-07-09 23:09:32 +02:00
logical :: doBas
2019-03-19 10:13:33 +01:00
integer :: nNuc,nBas,nBasCABS
2019-10-16 18:14:47 +02:00
integer :: nEl(nspin),nC(nspin),nO(nspin),nV(nspin),nR(nspin)
2019-10-18 23:16:37 +02:00
integer :: nS(nspin)
2019-03-19 10:13:33 +01:00
double precision :: ENuc,ERHF,EUHF,Norm
double precision :: EcMP2(3),EcMP3,EcMP2F12(3),EcMCMP2(3),Err_EcMCMP2(3),Var_EcMCMP2(3)
double precision,allocatable :: ZNuc(:),rNuc(:,:)
double precision,allocatable :: cHF(:,:,:),eHF(:,:),PHF(:,:,:)
double precision,allocatable :: eG0W0(:)
2019-10-16 18:14:47 +02:00
double precision,allocatable :: eG0T0(:)
2019-03-19 10:13:33 +01:00
integer :: nShell
integer,allocatable :: TotAngMomShell(:),KShell(:)
double precision,allocatable :: CenterShell(:,:),DShell(:,:),ExpShell(:,:)
integer :: TrialType
double precision,allocatable :: cTrial(:),gradient(:),hessian(:,:)
2019-05-07 22:55:36 +02:00
double precision,allocatable :: S(:,:),T(:,:),V(:,:),Hc(:,:),H(:,:),X(:,:)
2019-03-19 10:13:33 +01:00
double precision,allocatable :: ERI_AO_basis(:,:,:,:),ERI_MO_basis(:,:,:,:)
double precision,allocatable :: F12(:,:,:,:),Yuk(:,:,:,:),FC(:,:,:,:,:,:)
2019-04-24 18:00:54 +02:00
double precision :: start_QuAcK ,end_QuAcK ,t_QuAcK
2019-05-07 22:55:36 +02:00
double precision :: start_int ,end_int ,t_int
2019-03-19 10:13:33 +01:00
double precision :: start_HF ,end_HF ,t_HF
double precision :: start_MOM ,end_MOM ,t_MOM
2019-05-07 22:55:36 +02:00
double precision :: start_AOtoMO ,end_AOtoMO ,t_AOtoMO
2019-03-19 10:13:33 +01:00
double precision :: start_CCD ,end_CCD ,t_CCD
double precision :: start_CCSD ,end_CCSD ,t_CCSD
double precision :: start_CIS ,end_CIS ,t_CIS
2020-01-13 23:08:03 +01:00
double precision :: start_RPA ,end_RPA ,t_RPA
2019-03-19 10:13:33 +01:00
double precision :: start_TDHF ,end_TDHF ,t_TDHF
2019-10-05 23:09:20 +02:00
double precision :: start_ppRPA ,end_ppRPA ,t_ppRPA
2019-03-19 10:13:33 +01:00
double precision :: start_ADC ,end_ADC ,t_ADC
double precision :: start_GF2 ,end_GF2 ,t_GF2
double precision :: start_GF3 ,end_GF3 ,t_GF3
double precision :: start_G0W0 ,end_G0W0 ,t_G0W0
double precision :: start_evGW ,end_evGW ,t_evGW
double precision :: start_qsGW ,end_qsGW ,t_qsGW
2019-10-16 18:14:47 +02:00
double precision :: start_G0T0 ,end_G0T0 ,t_G0T0
double precision :: start_evGT ,end_evGT ,t_evGT
double precision :: start_qsGT ,end_qsGT ,t_qsGT
2019-03-19 10:13:33 +01:00
double precision :: start_MP2 ,end_MP2 ,t_MP2
double precision :: start_MP3 ,end_MP3 ,t_MP3
double precision :: start_MP2F12 ,end_MP2F12 ,t_MP2F12
double precision :: start_MCMP2 ,end_MCMP2 ,t_MCMP2
double precision :: start_MinMCMP2,end_MinMCMP2,t_MinMCMP2
2019-07-09 23:09:32 +02:00
double precision :: start_Bas ,end_Bas ,t_Bas
2019-03-19 10:13:33 +01:00
integer :: maxSCF_HF,n_diis_HF
double precision :: thresh_HF
logical :: DIIS_HF,guess_type,ortho_type
integer :: maxSCF_CC,n_diis_CC
double precision :: thresh_CC
logical :: DIIS_CC
2019-09-22 21:15:53 +02:00
logical :: singlet_manifold
logical :: triplet_manifold
2019-03-19 10:13:33 +01:00
integer :: maxSCF_GF,n_diis_GF,renormalization
double precision :: thresh_GF
logical :: DIIS_GF
integer :: maxSCF_GW,n_diis_GW
double precision :: thresh_GW
logical :: DIIS_GW,COHSEX,SOSEX,BSE,TDA,G0W,GW0,linearize
2019-09-22 21:15:53 +02:00
double precision :: eta
2019-03-19 10:13:33 +01:00
integer :: nMC,nEq,nWalk,nPrint,iSeed
double precision :: dt
logical :: doDrift
! Hello World
write(*,*)
write(*,*) '******************************************************************************************'
write(*,*) '* QuAcK QuAcK QuAcK *'
write(*,*) '* __ __ __ __ __ __ __ __ __ *'
write(*,*) '* <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ *'
write(*,*) '* ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / *'
write(*,*) '*|--------------------------------------------------------------------------------------|*'
write(*,*) '******************************************************************************************'
write(*,*)
2019-05-07 22:55:36 +02:00
! Spherium calculation?
2019-05-23 09:53:23 +02:00
doSph = .false.
2019-05-07 22:55:36 +02:00
2019-04-24 18:00:54 +02:00
call cpu_time(start_QuAcK)
2019-03-19 10:13:33 +01:00
! Which calculations do you want to do?
2020-01-14 14:44:01 +01:00
call read_methods(doRHF,doUHF,doMOM, &
doMP2,doMP3,doMP2F12, &
doCCD,doCCSD,doCCSDT, &
do_ring_CCD,do_ladder_CCD, &
doCIS,doRPA,doTDHF, &
doppRPA,doADC, &
doGF2,doGF3, &
doG0W0,doevGW,doqsGW, &
doG0T0,doevGT,doqsGT, &
2019-03-19 10:13:33 +01:00
doMCMP2)
! Read options for methods
2019-09-22 21:15:53 +02:00
call read_options(maxSCF_HF,thresh_HF,DIIS_HF,n_diis_HF,guess_type,ortho_type, &
maxSCF_CC,thresh_CC,DIIS_CC,n_diis_CC, &
singlet_manifold,triplet_manifold, &
maxSCF_GF,thresh_GF,DIIS_GF,n_diis_GF,renormalization, &
maxSCF_GW,thresh_GW,DIIS_GW,n_diis_GW,COHSEX,SOSEX,BSE,TDA,G0W,GW0,linearize,eta, &
2019-03-19 10:13:33 +01:00
nMC,nEq,nWalk,dt,nPrint,iSeed,doDrift)
! Weird stuff
doMinMCMP2 = .false.
!------------------------------------------------------------------------
! Read input information
!------------------------------------------------------------------------
! Read number of atoms, number of electrons of the system
! nC = number of core orbitals
! nO = number of occupied orbitals
! nV = number of virtual orbitals (see below)
! nR = number of Rydberg orbitals
! nBas = number of basis functions (see below)
! = nO + nV
! nS = number of single excitation
! = nO*nV
2019-03-19 11:21:34 +01:00
call read_molecule(nNuc,nEl(:),nO(:),nC(:),nR(:))
2019-03-19 10:13:33 +01:00
allocate(ZNuc(nNuc),rNuc(nNuc,3))
! Read geometry
call read_geometry(nNuc,ZNuc,rNuc,ENuc)
allocate(CenterShell(maxShell,3),TotAngMomShell(maxShell),KShell(maxShell), &
DShell(maxShell,maxK),ExpShell(maxShell,maxK))
!------------------------------------------------------------------------
! Read basis set information
!------------------------------------------------------------------------
call read_basis(nNuc,rNuc,nBas,nO,nV,nShell,TotAngMomShell,CenterShell,KShell,DShell,ExpShell)
2019-09-22 21:15:53 +02:00
nS(:) = (nO(:) - nC(:))*nV(:)
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Read auxiliary basis set information
!------------------------------------------------------------------------
! call ReadAuxBasis(nNuc,rNuc,nShell,CenterShell,TotAngMomShell,KShell,DShell,ExpShell)
! Compute the number of basis functions
! call CalcNBasis(nShell,TotAngMomShell,nA)
! Number of virtual orbitals in complete space
! nBasCABS = nA - nBas
!------------------------------------------------------------------------
! Read one- and two-electron integrals
!------------------------------------------------------------------------
! Memory allocation for one- and two-electron integrals
2019-10-16 18:14:47 +02:00
allocate(cHF(nBas,nBas,nspin),eHF(nBas,nspin),eG0W0(nBas),eG0T0(nBas),PHF(nBas,nBas,nspin), &
2019-05-07 22:55:36 +02:00
S(nBas,nBas),T(nBas,nBas),V(nBas,nBas),Hc(nBas,nBas),H(nBas,nBas),X(nBas,nBas), &
2019-03-19 10:13:33 +01:00
ERI_AO_basis(nBas,nBas,nBas,nBas),ERI_MO_basis(nBas,nBas,nBas,nBas))
! Read integrals
2019-05-07 22:55:36 +02:00
call cpu_time(start_int)
if(doSph) then
call read_integrals_sph(nEl(:),nBas,S,T,V,Hc,ERI_AO_basis)
else
call read_integrals(nEl(:),nBas,S,T,V,Hc,ERI_AO_basis)
end if
call cpu_time(end_int)
t_int = end_int - start_int
write(*,*)
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for reading integrals = ',t_int,' seconds'
write(*,*)
2019-03-19 10:13:33 +01:00
! Compute orthogonalization matrix
call orthogonalization_matrix(ortho_type,nBas,S,X)
!------------------------------------------------------------------------
! Compute RHF energy
!------------------------------------------------------------------------
if(doRHF) then
call cpu_time(start_HF)
2019-03-19 11:21:34 +01:00
call RHF(maxSCF_HF,thresh_HF,n_diis_HF,guess_type,nBas,nO,S,T,V,Hc,ERI_AO_basis,X,ENuc,ERHF,eHF,cHF,PHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_HF)
t_HF = end_HF - start_HF
2019-05-07 22:55:36 +02:00
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for RHF = ',t_HF,' seconds'
2019-03-19 10:13:33 +01:00
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute RHF energy
!------------------------------------------------------------------------
if(doUHF) then
call cpu_time(start_HF)
2019-03-19 11:21:34 +01:00
call UHF(maxSCF_HF,thresh_HF,n_diis_HF,guess_type,nBas,nO,S,T,V,Hc,ERI_AO_basis,X,ENuc,EUHF,eHF,cHF,PHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_HF)
t_HF = end_HF - start_HF
2019-03-19 11:33:49 +01:00
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for UHF = ',t_HF,' seconds'
2019-03-19 10:13:33 +01:00
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Maximum overlap method
!------------------------------------------------------------------------
if(doMOM) then
call cpu_time(start_MOM)
call MOM(maxSCF_HF,thresh_HF,n_diis_HF, &
nBas,nO,S,T,V,Hc,ERI_AO_basis,X,ENuc,ERHF,cHF,eHF,PHF)
call cpu_time(end_MOM)
t_MOM = end_MOM - start_MOM
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for MOM = ',t_MOM,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! AO to MO integral transform for post-HF methods
!------------------------------------------------------------------------
2019-05-07 22:55:36 +02:00
! Compute Hartree Hamiltonian in the MO basis
call Hartree_matrix_MO_basis(nBas,cHF,PHF,Hc,ERI_AO_basis,H)
call cpu_time(start_AOtoMO)
if(doSph) then
ERI_MO_basis = ERI_AO_basis
print*,'!!! MO = AO !!!'
deallocate(ERI_AO_basis)
else
call AOtoMO_integral_transform(nBas,cHF,ERI_AO_basis,ERI_MO_basis)
end if
call cpu_time(end_AOtoMO)
t_AOtoMO = end_AOtoMO - start_AOtoMO
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for AO to MO transformation = ',t_AOtoMO,' seconds'
write(*,*)
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute MP2 energy
!------------------------------------------------------------------------
if(doMP2) then
call cpu_time(start_MP2)
call MP2(nBas,nC,nO,nV,nR,ERI_MO_basis,ENuc,ERHF,eHF,EcMP2)
call cpu_time(end_MP2)
t_MP2 = end_MP2 - start_MP2
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for MP2 = ',t_MP2,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute MP3 energy
!------------------------------------------------------------------------
if(doMP3) then
call cpu_time(start_MP3)
call MP3(nBas,nEl,ERI_MO_basis,eHF,ENuc,ERHF)
call cpu_time(end_MP3)
t_MP3 = end_MP3 - start_MP3
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for MP3 = ',t_MP3,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute MP2-F12 energy
!------------------------------------------------------------------------
if(doMP2F12) then
call cpu_time(start_MP2F12)
2019-03-19 23:02:22 +01:00
2019-03-19 10:13:33 +01:00
! Memory allocation for one- and two-electron integrals
2019-03-19 23:02:22 +01:00
2019-03-19 10:13:33 +01:00
allocate(F12(nBas,nBas,nBas,nBas),Yuk(nBas,nBas,nBas,nBas),FC(nBas,nBas,nBas,nBas,nBas,nBas))
2019-03-19 23:02:22 +01:00
2019-03-19 10:13:33 +01:00
! Read integrals
2019-03-19 23:02:22 +01:00
2019-03-19 10:13:33 +01:00
call read_F12_integrals(nBas,S,ERI_AO_basis,F12,Yuk,FC)
call MP2F12(nBas,nC,nO,nV,ERI_AO_basis,F12,Yuk,FC,ERHF,eHF,cHF)
call cpu_time(end_MP2F12)
t_MP2F12 = end_MP2F12 - start_MP2F12
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for MP2-F12 = ',t_MP2F12,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Perform CCD calculation
!------------------------------------------------------------------------
if(doCCD) then
call cpu_time(start_CCD)
2019-10-15 23:13:00 +02:00
call CCD(maxSCF_CC,thresh_CC,n_diis_CC,nBas,nEl,ERI_MO_basis,ENuc,ERHF,eHF)
2019-03-19 10:13:33 +01:00
t_CCD = end_CCD - start_CCD
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for CCD = ',t_CCD,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Perform CCSD or CCSD(T) calculation
!------------------------------------------------------------------------
2020-01-13 23:08:03 +01:00
if(doCCSDT) doCCSD = .true.
2019-03-19 10:13:33 +01:00
if(doCCSD) then
call cpu_time(start_CCSD)
call CCSD(maxSCF_CC,thresh_CC,n_diis_CC,doCCSDT,nBas,nEl,ERI_MO_basis,ENuc,ERHF,eHF)
call cpu_time(end_CCSD)
t_CCSD = end_CCSD - start_CCSD
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for CCSD or CCSD(T)= ',t_CCSD,' seconds'
write(*,*)
end if
2020-01-14 14:44:01 +01:00
!------------------------------------------------------------------------
! Perform ring CCD calculation
!------------------------------------------------------------------------
if(do_ring_CCD) then
call cpu_time(start_CCD)
call ring_CCD(maxSCF_CC,thresh_CC,n_diis_CC,nBas,nEl,ERI_MO_basis,ENuc,ERHF,eHF)
call cpu_time(end_CCD)
t_CCD = end_CCD - start_CCD
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for ring CCD = ',t_CCD,' seconds'
write(*,*)
end if
!------------------------------------------------------------------------
! Perform ladder CCD calculation
!------------------------------------------------------------------------
if(do_ladder_CCD) then
call cpu_time(start_CCD)
call ladder_CCD(maxSCF_CC,thresh_CC,n_diis_CC,nBas,nEl,ERI_MO_basis,ENuc,ERHF,eHF)
call cpu_time(end_CCD)
t_CCD = end_CCD - start_CCD
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for CCD = ',t_CCD,' seconds'
write(*,*)
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute CIS excitations
!------------------------------------------------------------------------
if(doCIS) then
call cpu_time(start_CIS)
2019-05-07 22:55:36 +02:00
call CIS(singlet_manifold,triplet_manifold,nBas,nC,nO,nV,nR,nS,ERI_MO_basis,eHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_CIS)
t_CIS = end_CIS - start_CIS
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for CIS = ',t_CIS,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
2020-01-13 23:08:03 +01:00
!------------------------------------------------------------------------
! Compute (direct) RPA excitations
!------------------------------------------------------------------------
if(doRPA) then
call cpu_time(start_RPA)
call RPA(singlet_manifold,triplet_manifold,nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI_MO_basis,eHF)
call cpu_time(end_RPA)
t_RPA = end_RPA - start_RPA
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for RPA = ',t_RPA,' seconds'
write(*,*)
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute TDHF excitations
!------------------------------------------------------------------------
if(doTDHF) then
call cpu_time(start_TDHF)
2019-05-23 09:53:23 +02:00
call TDHF(singlet_manifold,triplet_manifold,nBas,nC,nO,nV,nR,nS,ENuc,ERHF,ERI_MO_basis,eHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_TDHF)
t_TDHF = end_TDHF - start_TDHF
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for TDHF = ',t_TDHF,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
2019-10-05 23:09:20 +02:00
!------------------------------------------------------------------------
! Compute pp-RPA excitations
!------------------------------------------------------------------------
if(doppRPA) then
call cpu_time(start_ppRPA)
2019-10-06 22:35:36 +02:00
call ppRPA(singlet_manifold,triplet_manifold,nBas,nC,nO,nV,nR,ENuc,ERHF,ERI_MO_basis,eHF)
2019-10-05 23:09:20 +02:00
call cpu_time(end_ppRPA)
t_ppRPA = end_ppRPA - start_ppRPA
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for pp-RPA = ',t_ppRPA,' seconds'
write(*,*)
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute ADC excitations
!------------------------------------------------------------------------
if(doADC) then
call cpu_time(start_ADC)
2019-04-29 09:52:21 +02:00
call ADC(singlet_manifold,triplet_manifold,maxSCF_GF,thresh_GF,n_diis_GF,nBas,nC(1),nO(1),nV(1),nR(1),eHF,ERI_MO_basis)
2019-03-19 10:13:33 +01:00
call cpu_time(end_ADC)
t_ADC = end_ADC - start_ADC
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for ADC = ',t_ADC,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute GF2 electronic binding energies
!------------------------------------------------------------------------
if(doGF2) then
call cpu_time(start_GF2)
2019-10-18 23:16:37 +02:00
call GF2_diag(maxSCF_GF,thresh_GF,n_diis_GF,linearize,nBas,nC(1),nO(1),nV(1),nR(1),ERI_MO_basis,eHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_GF2)
t_GF2 = end_GF2 - start_GF2
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for GF2 = ',t_GF2,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute GF3 electronic binding energies
!------------------------------------------------------------------------
if(doGF3) then
call cpu_time(start_GF3)
2019-04-29 09:52:21 +02:00
call GF3_diag(maxSCF_GF,thresh_GF,n_diis_GF,renormalization,nBas,nC(1),nO(1),nV(1),nR(1),ERI_MO_basis,eHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_GF3)
t_GF3 = end_GF3 - start_GF3
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for GF3 = ',t_GF3,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Perform G0W0 calculatiom
!------------------------------------------------------------------------
eG0W0(:) = eHF(:,1)
if(doG0W0) then
call cpu_time(start_G0W0)
2019-09-22 21:15:53 +02:00
call G0W0(COHSEX,SOSEX,BSE,TDA,singlet_manifold,triplet_manifold,eta, &
2019-05-07 22:55:36 +02:00
nBas,nC(1),nO(1),nV(1),nR(1),nS(1),ENuc,ERHF,Hc,H,ERI_MO_basis,PHF,cHF,eHF,eG0W0)
2019-03-19 10:13:33 +01:00
call cpu_time(end_G0W0)
t_G0W0 = end_G0W0 - start_G0W0
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for G0W0 = ',t_G0W0,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Perform evGW calculation
!------------------------------------------------------------------------
if(doevGW) then
call cpu_time(start_evGW)
2019-09-22 21:15:53 +02:00
call evGW(maxSCF_GW,thresh_GW,n_diis_GW,COHSEX,SOSEX,BSE,TDA,G0W,GW0,singlet_manifold,triplet_manifold,linearize,eta, &
2019-05-07 22:55:36 +02:00
nBas,nC(1),nO(1),nV(1),nR(1),nS(1),ENuc,ERHF,Hc,H,ERI_MO_basis,PHF,cHF,eHF,eG0W0)
2019-03-19 10:13:33 +01:00
call cpu_time(end_evGW)
t_evGW = end_evGW - start_evGW
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for evGW = ',t_evGW,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Perform qsGW calculation
!------------------------------------------------------------------------
if(doqsGW) then
call cpu_time(start_qsGW)
call qsGW(maxSCF_GW,thresh_GW,n_diis_GW, &
2019-09-22 21:15:53 +02:00
COHSEX,SOSEX,BSE,TDA,G0W,GW0,singlet_manifold,triplet_manifold,eta, &
2019-10-30 10:31:05 +01:00
nBas,nC(1),nO(1),nV(1),nR(1),nS(1),ENuc,ERHF,S,X,T,V,Hc,ERI_AO_basis,ERI_MO_basis,PHF,cHF,eHF)
2019-03-19 10:13:33 +01:00
call cpu_time(end_qsGW)
t_qsGW = end_qsGW - start_qsGW
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for qsGW = ',t_qsGW,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
2019-10-16 18:14:47 +02:00
! Perform G0T0 calculatiom
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
2019-10-16 18:14:47 +02:00
eG0T0(:) = eHF(:,1)
2019-03-19 10:13:33 +01:00
2019-10-16 18:14:47 +02:00
if(doG0T0) then
call cpu_time(start_G0T0)
2019-10-28 16:34:09 +01:00
! call G0T0(BSE,singlet_manifold,triplet_manifold,eta, &
! nBas,nC(1),nO(1),nV(1),nR(1),ENuc,ERHF,ERI_MO_basis,eHF,eG0T0)
2019-10-22 23:03:01 +02:00
call soG0T0(eta,nBas,nC(1),nO(1),nV(1),nR(1),ENuc,ERHF,ERI_MO_basis,eHF)
2019-10-16 18:14:47 +02:00
call cpu_time(end_G0T0)
t_G0T0 = end_G0T0 - start_G0T0
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for G0T0 = ',t_G0T0,' seconds'
2019-03-19 10:13:33 +01:00
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Information for Monte Carlo calculations
!------------------------------------------------------------------------
if(doMCMP2 .or. doMinMCMP2) then
! Print simulation details
write(*,'(A32)') '----------------------'
write(*,'(A32,1X,I16)') 'Number of Monte Carlo steps',nMC
write(*,'(A32,1X,I16)') 'Number of equilibration steps',nEq
write(*,'(A32,1X,I16)') 'Number of walkers',nWalk
write(*,'(A32,1X,F16.10)') 'Initial time step',dt
write(*,'(A32,1X,I16)') 'Frequency of ouput',nPrint
write(*,'(A32,1X,I16)') 'Seed for random number generator',iSeed
write(*,'(A32)') '----------------------'
write(*,*)
! Initialize random number generator
call initialize_random_generator(iSeed)
!------------------------------------------------------------------------
! Type of weight function
!------------------------------------------------------------------------
! TrialType = 0 => HF density
! TrialType = 1 => Custom one-electron function
!------------------------------------------------------------------------
TrialType = 0
allocate(cTrial(nBas),gradient(nBas),hessian(nBas,nBas))
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Compute MC-MP2 energy
!------------------------------------------------------------------------
if(doMCMP2) then
call cpu_time(start_MCMP2)
call MCMP2(doDrift,nBas,nC,nO,nV,cHF,eHF,EcMP2, &
nMC,nEq,nWalk,dt,nPrint, &
nShell,CenterShell,TotAngMomShell,KShell,DShell,ExpShell, &
Norm,EcMCMP2,Err_EcMCMP2,Var_EcMCMP2)
call cpu_time(end_MCMP2)
t_MCMP2 = end_MCMP2 - start_MCMP2
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for MC-MP2 = ',t_MCMP2,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! Minimize MC-MP2 variance
!------------------------------------------------------------------------
if(doMinMCMP2) then
call cpu_time(start_MinMCMP2)
! call MinMCMP2(nBas,nEl,nC,nO,nV,cHF,eHF,EcMP2, &
! nMC,nEq,nWalk,dt,nPrint, &
! nShell,CenterShell,TotAngMomShell,KShell,DShell,ExpShell, &
! TrialType,Norm,cTrial,gradient,hessian)
call cpu_time(end_MinMCMP2)
t_MinMCMP2 = end_MinMCMP2 - start_MinMCMP2
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for MC-MP2 variance minimization = ',t_MinMCMP2,' seconds'
write(*,*)
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
2019-07-09 16:17:10 +02:00
!------------------------------------------------------------------------
! Basis set correction
!------------------------------------------------------------------------
2019-09-20 22:28:01 +02:00
doBas = .false.
2019-07-09 16:17:10 +02:00
2019-07-09 23:09:32 +02:00
if(doBas) then
2019-07-09 16:17:10 +02:00
2019-07-09 23:09:32 +02:00
call cpu_time(start_Bas)
call basis_correction(nBas,nO,nShell,CenterShell,TotAngMomShell,KShell,DShell,ExpShell, &
ERI_MO_basis,eHF,cHF,PHF,eG0W0)
call cpu_time(end_Bas)
2019-07-09 16:17:10 +02:00
2019-07-09 23:09:32 +02:00
t_Bas = end_Bas - start_Bas
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for basis set correction = ',t_Bas,' seconds'
write(*,*)
2019-07-09 16:17:10 +02:00
2019-07-09 23:09:32 +02:00
end if
2019-03-19 10:13:33 +01:00
!------------------------------------------------------------------------
! End of QuAcK
!------------------------------------------------------------------------
2019-04-24 18:00:54 +02:00
call cpu_time(end_QuAcK)
t_QuAcK = end_QuAcK - start_QuAcK
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for QuAcK = ',t_QuAcK,' seconds'
write(*,*)
2019-03-19 10:13:33 +01:00
end program QuAcK