4
1
mirror of https://github.com/pfloos/quack synced 2024-06-02 11:25:28 +02:00
quack/src/QuAcK/QuAcK.f90

261 lines
11 KiB
Fortran
Raw Normal View History

2019-03-19 10:13:33 +01:00
program QuAcK
implicit none
include 'parameters.h'
logical :: doRQuAcK,doUQuAcK,doGQuAcK
logical :: doRHF,doUHF,doGHF,doROHF
2023-11-03 19:48:12 +01:00
logical :: dostab,dosearch
logical :: doMP2,doMP3
logical :: doCCD,dopCCD,doDCD,doCCSD,doCCSDT
2023-07-23 11:16:42 +02:00
logical :: dodrCCD,dorCCD,docrCCD,dolCCD
logical :: doCIS,doCIS_D,doCID,doCISD,doFCI
logical :: dophRPA,dophRPAx,docrRPA,doppRPA
2023-12-03 21:07:30 +01:00
logical :: doG0F2,doevGF2,doqsGF2,doufG0F02,doG0F3,doevGF3
logical :: doG0W0,doevGW,doqsGW,doufG0W0,doufGW,doSRGqsGW
logical :: doG0T0pp,doevGTpp,doqsGTpp,doG0T0eh,doevGTeh,doqsGTeh
2019-07-09 23:09:32 +02:00
2023-07-17 13:51:52 +02:00
integer :: nNuc,nBas
2020-09-21 16:54:38 +02:00
integer :: nC(nspin)
integer :: nO(nspin)
integer :: nV(nspin)
integer :: nR(nspin)
double precision :: ENuc
2019-03-19 10:13:33 +01:00
double precision,allocatable :: ZNuc(:),rNuc(:,:)
2020-01-14 21:27:34 +01:00
double precision,allocatable :: S(:,:)
double precision,allocatable :: T(:,:)
double precision,allocatable :: V(:,:)
double precision,allocatable :: Hc(:,:)
double precision,allocatable :: X(:,:)
2020-10-21 12:58:37 +02:00
double precision,allocatable :: dipole_int_AO(:,:,:)
2020-04-16 17:02:01 +02:00
double precision,allocatable :: ERI_AO(:,:,:,:)
double precision :: start_QuAcK,end_QuAcK,t_QuAcK
double precision :: start_int ,end_int ,t_int
2019-03-19 10:13:33 +01:00
2023-07-23 11:58:18 +02:00
integer :: maxSCF_HF,max_diis_HF
double precision :: thresh_HF,level_shift,mix
2023-11-03 15:56:18 +01:00
integer :: guess_type
2019-03-19 10:13:33 +01:00
logical :: reg_MP
2023-07-23 11:58:18 +02:00
integer :: maxSCF_CC,max_diis_CC
2019-03-19 10:13:33 +01:00
double precision :: thresh_CC
2020-09-22 23:08:47 +02:00
logical :: spin_conserved
logical :: spin_flip
2020-06-15 23:04:07 +02:00
logical :: TDA
integer :: maxSCF_GF,max_diis_GF,renorm_GF
2019-03-19 10:13:33 +01:00
double precision :: thresh_GF
logical :: lin_GF,reg_GF
2020-06-03 12:06:16 +02:00
double precision :: eta_GF
2019-03-19 10:13:33 +01:00
2023-07-23 11:58:18 +02:00
integer :: maxSCF_GW,max_diis_GW
2019-03-19 10:13:33 +01:00
double precision :: thresh_GW
logical :: TDA_W,lin_GW,reg_GW
2020-06-03 12:06:16 +02:00
double precision :: eta_GW
2019-03-19 10:13:33 +01:00
2023-07-23 11:58:18 +02:00
integer :: maxSCF_GT,max_diis_GT
2021-12-17 11:41:40 +01:00
double precision :: thresh_GT
logical :: TDA_T,lin_GT,reg_GT
2021-12-17 11:41:40 +01:00
double precision :: eta_GT
2023-07-21 10:21:54 +02:00
logical :: dophBSE,dophBSE2,doppBSE,dBSE,dTDA
logical :: doACFDT,exchange_kernel,doXBS
2020-06-14 21:20:01 +02:00
2023-11-11 16:16:57 +01:00
logical :: dotest,doRtest,doUtest,doGtest
2023-11-11 10:21:00 +01:00
2023-07-29 09:24:55 +02:00
!-------------!
! Hello World !
!-------------!
2019-03-19 10:13:33 +01:00
write(*,*)
write(*,*) '******************************************************************************************'
write(*,*) '* QuAcK QuAcK QuAcK *'
write(*,*) '* __ __ __ __ __ __ __ __ __ *'
write(*,*) '* <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ <(o )___ *'
write(*,*) '* ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / ( ._> / *'
write(*,*) '*|--------------------------------------------------------------------------------------|*'
write(*,*) '******************************************************************************************'
write(*,*)
2023-07-29 09:24:55 +02:00
!-----------------------!
! Starting QuAcK timing !
!-----------------------!
2019-05-07 22:55:36 +02:00
2023-03-14 14:11:01 +01:00
call wall_time(start_QuAcK)
2019-04-24 18:00:54 +02:00
2023-07-29 09:24:55 +02:00
!------------------!
! Method selection !
!------------------!
2019-03-19 10:13:33 +01:00
call read_methods(doRHF,doUHF,doGHF,doROHF, &
doMP2,doMP3, &
doCCD,dopCCD,doDCD,doCCSD,doCCSDT, &
dodrCCD,dorCCD,docrCCD,dolCCD, &
doCIS,doCIS_D,doCID,doCISD,doFCI, &
dophRPA,dophRPAx,docrRPA,doppRPA, &
2023-12-03 21:07:30 +01:00
doG0F2,doevGF2,doqsGF2,doufG0F02, &
doG0F3,doevGF3, &
doG0W0,doevGW,doqsGW,doSRGqsGW, &
doufG0W0,doufGW, &
doG0T0pp,doevGTpp,doqsGTpp, &
2023-11-11 10:21:00 +01:00
doG0T0eh,doevGTeh,doqsGTeh, &
doRtest,doUtest,doGtest)
2019-03-19 10:13:33 +01:00
2023-07-29 09:24:55 +02:00
!--------------------------!
! Read options for methods !
!--------------------------!
2019-03-19 10:13:33 +01:00
2023-11-03 19:48:12 +01:00
call read_options(maxSCF_HF,thresh_HF,max_diis_HF,guess_type,mix,level_shift,dostab,dosearch, &
reg_MP, &
maxSCF_CC,thresh_CC,max_diis_CC, &
TDA,spin_conserved,spin_flip, &
maxSCF_GF,thresh_GF,max_diis_GF,lin_GF,eta_GF,renorm_GF,reg_GF, &
maxSCF_GW,thresh_GW,max_diis_GW,lin_GW,eta_GW,reg_GW,TDA_W, &
maxSCF_GT,thresh_GT,max_diis_GT,lin_GT,eta_GT,reg_GT,TDA_T, &
doACFDT,exchange_kernel,doXBS, &
2023-07-21 10:45:10 +02:00
dophBSE,dophBSE2,doppBSE,dBSE,dTDA)
2019-03-19 10:13:33 +01:00
2023-07-29 09:24:55 +02:00
!------------------------------------------------!
! Read input information !
!------------------------------------------------!
! 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) !
!------------------------------------------------!
2019-03-19 10:13:33 +01:00
call read_molecule(nNuc,nO,nC,nR)
2020-03-14 23:00:44 +01:00
allocate(ZNuc(nNuc),rNuc(nNuc,ncart))
2019-03-19 10:13:33 +01:00
! Read geometry
call read_geometry(nNuc,ZNuc,rNuc,ENuc)
2023-07-29 09:24:55 +02:00
!---------------------------------------!
! Read basis set information from PySCF !
!---------------------------------------!
2019-03-19 10:13:33 +01:00
2023-10-26 19:27:30 +02:00
call read_basis_pyscf(nBas,nO,nV)
2019-03-19 10:13:33 +01:00
2023-07-29 09:24:55 +02:00
!--------------------------------------!
! Read one- and two-electron integrals !
!--------------------------------------!
2019-03-19 10:13:33 +01:00
! Memory allocation for one- and two-electron integrals
allocate(S(nBas,nBas),T(nBas,nBas),V(nBas,nBas),Hc(nBas,nBas),X(nBas,nBas), &
ERI_AO(nBas,nBas,nBas,nBas),dipole_int_AO(nBas,nBas,ncart))
2019-03-19 10:13:33 +01:00
! Read integrals
2023-03-14 14:11:01 +01:00
call wall_time(start_int)
2019-05-07 22:55:36 +02:00
2023-07-17 13:35:24 +02:00
call read_integrals(nBas,S,T,V,Hc,ERI_AO)
call read_dipole_integrals(nBas,dipole_int_AO)
2019-05-07 22:55:36 +02:00
2023-03-14 14:11:01 +01:00
call wall_time(end_int)
2019-05-07 22:55:36 +02:00
2023-07-23 11:16:42 +02:00
t_int = end_int - start_int
write(*,*)
2023-10-24 17:03:41 +02:00
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for reading integrals = ',t_int,' seconds'
2023-07-23 11:16:42 +02:00
write(*,*)
2019-03-19 10:13:33 +01:00
! Compute orthogonalization matrix
call orthogonalization_matrix(nBas,S,X)
2019-03-19 10:13:33 +01:00
2023-07-29 09:24:55 +02:00
!---------------------!
! Choose QuAcK branch !
2023-07-29 09:24:55 +02:00
!---------------------!
2019-03-19 10:13:33 +01:00
doRQuAcK = .false.
2023-11-09 23:23:00 +01:00
if(doRHF .or. doROHF) doRQuAcK = .true.
2019-03-19 10:13:33 +01:00
doUQuAcK = .false.
if(doUHF) doUQuAcK = .true.
2019-05-07 22:55:36 +02:00
doGQuAcK = .false.
if(doGHF) doGQuAcK = .true.
2019-10-05 23:09:20 +02:00
2023-11-11 16:16:57 +01:00
!-----------------!
! Initialize Test !
!-----------------!
dotest = doRtest .or. doUtest .or. doGtest
if(dotest) call init_test(doRtest,doUtest,doGtest)
2023-07-29 09:24:55 +02:00
!-------------------------!
! Restricted QuAcK branch !
2023-07-29 09:24:55 +02:00
!-------------------------!
2019-03-19 10:13:33 +01:00
if(doRQuAcK) &
2023-11-11 10:21:00 +01:00
call RQuAcK(doRtest,doRHF,doROHF,dostab,dosearch,doMP2,doMP3,doCCD,dopCCD,doDCD,doCCSD,doCCSDT, &
2023-10-25 23:05:08 +02:00
dodrCCD,dorCCD,docrCCD,dolCCD,doCIS,doCIS_D,doCID,doCISD,doFCI,dophRPA,dophRPAx,docrRPA,doppRPA, &
2023-12-03 21:07:30 +01:00
doG0F2,doevGF2,doqsGF2,doufG0F02,doG0F3,doevGF3,doG0W0,doevGW,doqsGW,doufG0W0,doufGW,doSRGqsGW, &
2023-10-26 19:27:30 +02:00
doG0T0pp,doevGTpp,doqsGTpp,doG0T0eh,doevGTeh,doqsGTeh,nNuc,nBas,nC,nO,nV,nR,ENuc,ZNuc,rNuc, &
2023-10-25 23:05:08 +02:00
S,T,V,Hc,X,dipole_int_AO,ERI_AO,maxSCF_HF,max_diis_HF,thresh_HF,level_shift, &
guess_type,mix,reg_MP,maxSCF_CC,max_diis_CC,thresh_CC,spin_conserved,spin_flip,TDA, &
maxSCF_GF,max_diis_GF,renorm_GF,thresh_GF,lin_GF,reg_GF,eta_GF,maxSCF_GW,max_diis_GW,thresh_GW, &
TDA_W,lin_GW,reg_GW,eta_GW,maxSCF_GT,max_diis_GT,thresh_GT,TDA_T,lin_GT,reg_GT,eta_GT, &
dophBSE,dophBSE2,doppBSE,dBSE,dTDA,doACFDT,exchange_kernel,doXBS)
!---------------------------!
! Unrestricted QuAcK branch !
!---------------------------!
if(doUQuAcK) &
2023-11-11 10:21:00 +01:00
call UQuAcK(doUtest,doUHF,dostab,dosearch,doMP2,doMP3,doCCD,dopCCD,doDCD,doCCSD,doCCSDT, &
2023-10-25 23:05:08 +02:00
dodrCCD,dorCCD,docrCCD,dolCCD,doCIS,doCIS_D,doCID,doCISD,doFCI,dophRPA,dophRPAx,docrRPA,doppRPA, &
2023-12-03 21:07:30 +01:00
doG0F2,doevGF2,doqsGF2,doufG0F02,doG0F3,doevGF3,doG0W0,doevGW,doqsGW,doufG0W0,doufGW,doSRGqsGW, &
2023-10-26 19:27:30 +02:00
doG0T0pp,doevGTpp,doqsGTpp,doG0T0eh,doevGTeh,doqsGTeh,nNuc,nBas,nC,nO,nV,nR,ENuc,ZNuc,rNuc, &
2023-10-25 23:05:08 +02:00
S,T,V,Hc,X,dipole_int_AO,ERI_AO,maxSCF_HF,max_diis_HF,thresh_HF,level_shift, &
guess_type,mix,reg_MP,maxSCF_CC,max_diis_CC,thresh_CC,spin_conserved,spin_flip,TDA, &
maxSCF_GF,max_diis_GF,renorm_GF,thresh_GF,lin_GF,reg_GF,eta_GF,maxSCF_GW,max_diis_GW,thresh_GW, &
TDA_W,lin_GW,reg_GW,eta_GW,maxSCF_GT,max_diis_GT,thresh_GT,TDA_T,lin_GT,reg_GT,eta_GT, &
dophBSE,dophBSE2,doppBSE,dBSE,dTDA,doACFDT,exchange_kernel,doXBS)
2020-03-19 10:21:18 +01:00
!--------------------------!
! Generalized QuAcK branch !
!--------------------------!
2023-07-03 23:15:07 +02:00
2023-10-25 23:05:08 +02:00
if(doGQuAcK) &
2023-11-13 22:15:00 +01:00
call GQuAcK(doGtest,doGHF,dostab,dosearch,doMP2,doMP3,doCCD,dopCCD,doDCD,doCCSD,doCCSDT, &
2023-11-14 13:50:53 +01:00
dodrCCD,dorCCD,docrCCD,dolCCD,dophRPA,dophRPAx,docrRPA,doppRPA, &
2023-11-03 19:48:12 +01:00
doG0W0,doevGW,doqsGW,doG0F2,doevGF2,doqsGF2, &
nNuc,nBas,sum(nC),sum(nO),sum(nV),sum(nR),ENuc,ZNuc,rNuc,S,T,V,Hc,X,dipole_int_AO,ERI_AO, &
maxSCF_HF,max_diis_HF,thresh_HF,level_shift,guess_type,mix,reg_MP, &
2023-11-13 22:15:00 +01:00
maxSCF_CC,max_diis_CC,thresh_CC,TDA,maxSCF_GF,max_diis_GF,thresh_GF,lin_GF,reg_GF,eta_GF, &
2023-11-03 19:48:12 +01:00
maxSCF_GW,max_diis_GW,thresh_GW,TDA_W,lin_GW,reg_GW,eta_GW, &
2023-10-25 23:05:08 +02:00
dophBSE,dophBSE2,doppBSE,dBSE,dTDA,doACFDT,exchange_kernel,doXBS)
2023-07-03 23:15:07 +02:00
2023-11-11 16:16:57 +01:00
!-----------!
! Stop Test !
!-----------!
if(dotest) call stop_test(doRtest,doUtest,doGtest)
!--------------!
! Running Test !
!--------------!
if(dotest) call run_test(doRtest,doUtest,doGtest)
2023-07-29 09:24:55 +02:00
!--------------!
! End of QuAcK !
!--------------!
2019-04-24 18:00:54 +02:00
2023-03-14 14:11:01 +01:00
call wall_time(end_QuAcK)
2019-04-24 18:00:54 +02:00
t_QuAcK = end_QuAcK - start_QuAcK
2023-10-24 17:03:41 +02:00
write(*,'(A65,1X,F9.3,A8)') 'Total CPU time for QuAcK = ',t_QuAcK,' seconds'
2019-04-24 18:00:54 +02:00
write(*,*)
2023-07-20 12:37:54 +02:00
end program