4
1
mirror of https://github.com/pfloos/quack synced 2024-12-22 20:35:36 +01:00

Merge branch 'master' of github.com:pfloos/QuAcK

This commit is contained in:
Antoine Marie 2023-09-06 13:34:12 +02:00
commit 69f9eaac94
5 changed files with 136 additions and 14 deletions

View File

@ -1,5 +1,5 @@
# RHF UHF ROHF RMOM UMOM KS
T F T F F F
F F T F F F
# MP2* MP3
F F
# CCD pCCD DCD CCSD CCSD(T)

View File

@ -238,7 +238,7 @@ subroutine ROHF(maxSCF,thresh,max_diis,guess_type,mix,level_shift,nNuc,ZNuc,rNuc
! Compute final UHF energy
! call dipole_moment(nBas,P(:,:,1)+P(:,:,2),nNuc,ZNuc,rNuc,dipole_int,dipole)
! call print_ROHF(nBas,nO,S,e,c,ENuc,ET,EV,EJ,Ex,EHF,dipole)
call dipole_moment(nBas,Ptot,nNuc,ZNuc,rNuc,dipole_int,dipole)
call print_ROHF(nBas,nO,S,e,c,ENuc,ET,EV,EJ,Ex,EHF,dipole)
end subroutine

View File

@ -1,6 +1,16 @@
subroutine ROHF_fock_matrix(nBas,nOa,nOb,S,c,Fa,Fb,F)
! Construct the ROHF Fock matrix
! Construct the ROHF Fock matrix in the AO basis
! For open shells, the ROHF Fock matrix in the MO basis reads
!
! | F-K | F + K/2 | F |
! |---------------------------------|
! | F + K/2 | F | F - K/2 |
! |---------------------------------|
! | F | F - K/2 | F + K |
!
! with F = 1/2 (Fa + Fb) and K = Fb - Fa
!
implicit none
include 'parameters.h'
@ -32,14 +42,14 @@ subroutine ROHF_fock_matrix(nBas,nOa,nOb,S,c,Fa,Fb,F)
! Roothan canonicalization parameters
aC = -0.5d0
bC = +1.5d0
aC = +1.5d0
bC = -0.5d0
aO = +0.5d0
bO = +0.5d0
aV = +1.5d0
bV = -0.5d0
aV = -0.5d0
bV = +1.5d0
! Number of closed, open, and virtual orbitals
@ -49,8 +59,8 @@ subroutine ROHF_fock_matrix(nBas,nOa,nOb,S,c,Fa,Fb,F)
! Block-by-block Fock matrix
! call AOtoMO_transform(nBas,c,Fa)
! call AOtoMO_transform(nBas,c,Fb)
call AOtoMO_transform(nBas,c,Fa)
call AOtoMO_transform(nBas,c,Fb)
F(1:nC, 1:nC ) = aC*Fa(1:nC, 1:nC ) + bC*Fb(1:nC, 1:nC )
F(1:nC, nC+1:nC+nO ) = Fb(1:nC, nC+1:nC+nO )
@ -64,8 +74,8 @@ subroutine ROHF_fock_matrix(nBas,nOa,nOb,S,c,Fa,Fb,F)
F(nO+nC+1:nC+nO+nV, nC+1:nC+nO ) = Fa(nO+nC+1:nC+nO+nV, nC+1:nC+nO )
F(nO+nC+1:nC+nO+nV,nO+nC+1:nC+nO+nV) = aV*Fa(nO+nC+1:nC+nO+nV,nO+nC+1:nC+nO+nV) + bV*Fb(nO+nC+1:nC+nO+nV,nO+nC+1:nC+nO+nV)
! call MOtoAO_transform(nBas,S,c,F)
! call MOtoAO_transform(nBas,S,c,Fa)
! call MOtoAO_transform(nBas,S,c,Fb)
call MOtoAO_transform(nBas,S,c,F)
call MOtoAO_transform(nBas,S,c,Fa)
call MOtoAO_transform(nBas,S,c,Fb)
end subroutine

112
src/HF/print_ROHF.f90 Normal file
View File

@ -0,0 +1,112 @@
subroutine print_ROHF(nBas,nO,Ov,e,c,ENuc,ET,EV,EJ,Ex,EHF,dipole)
! Print one- and two-electron energies and other stuff for RoHF calculation
implicit none
include 'parameters.h'
integer,intent(in) :: nBas
integer,intent(in) :: nO(nspin)
double precision,intent(in) :: Ov(nBas,nBas)
double precision,intent(in) :: e(nBas)
double precision,intent(in) :: c(nBas,nBas)
double precision,intent(in) :: ENuc
double precision,intent(in) :: ET(nspin)
double precision,intent(in) :: EV(nspin)
double precision,intent(in) :: EJ(nsp)
double precision,intent(in) :: Ex(nspin)
double precision,intent(in) :: EHF
double precision,intent(in) :: dipole(ncart)
integer :: ixyz
integer :: ispin
double precision :: HOMO(nspin)
double precision :: LUMO(nspin)
double precision :: Gap(nspin)
double precision :: S_exact,S2_exact
double precision :: S,S2
! HOMO and LUMO
do ispin=1,nspin
if(nO(ispin) > 0) then
HOMO(ispin) = e(nO(ispin))
if(nO(ispin) < nBas) then
LUMO(ispin) = e(nO(ispin)+1)
else
LUMO(ispin) = 0d0
end if
Gap(ispin) = LUMO(ispin) - HOMO(ispin)
else
HOMO(ispin) = 0d0
LUMO(ispin) = e(1)
Gap(ispin) = 0d0
end if
end do
S2 = dble(nO(1) - nO(2))/2d0*(dble(nO(1) - nO(2))/2d0 + 1d0)
S = 0.5d0*dble(nO(1) - nO(2))
! Dump results
write(*,*)
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40)') ' Summary '
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.10,A3)') ' One-electron energy: ',sum(ET(:)) + sum(EV(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' One-electron a energy: ',ET(1) + EV(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' One-electron b energy: ',ET(2) + EV(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Kinetic energy: ',sum(ET(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Kinetic a energy: ',ET(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Kinetic b energy: ',ET(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Potential energy: ',sum(EV(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Potential a energy: ',EV(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Potential b energy: ',EV(2),' au'
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron energy: ',sum(EJ(:)) + sum(Ex(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron aa energy: ',EJ(1) + Ex(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron ab energy: ',EJ(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Two-electron bb energy: ',EJ(3) + Ex(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree energy: ',sum(EJ(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree aa energy: ',EJ(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree ab energy: ',EJ(2),' au'
write(*,'(A40,1X,F16.10,A3)') ' Hartree bb energy: ',EJ(3),' au'
write(*,'(A40,1X,F16.10,A3)') ' Exchange energy: ',sum(Ex(:)),' au'
write(*,'(A40,1X,F16.10,A3)') ' Exchange a energy: ',Ex(1),' au'
write(*,'(A40,1X,F16.10,A3)') ' Exchange b energy: ',Ex(2),' au'
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.10,A3)') ' Electronic energy: ',EHF,' au'
write(*,'(A40,1X,F16.10,A3)') ' Nuclear repulsion: ',ENuc,' au'
write(*,'(A40,1X,F16.10,A3)') ' ROHF energy: ',EHF + ENuc,' au'
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.6,A3)') ' ROHF HOMO a energy:',HOMO(1)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' ROHF LUMO a energy:',LUMO(1)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' ROHF HOMOa-LUMOa gap:',Gap(1)*HatoeV,' eV'
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.6,A3)') ' ROHF HOMO b energy:',HOMO(2)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' ROHF LUMO b energy:',LUMO(2)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' ROHF HOMOb-LUMOb gap:',Gap(2)*HatoeV,' eV'
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.6)') ' S :',2d0*S + 1d0
write(*,'(A40,1X,F16.6)') ' <S**2> :',S2
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A45)') ' Dipole moment (Debye) '
write(*,'(19X,4A10)') 'X','Y','Z','Tot.'
write(*,'(19X,4F10.6)') (dipole(ixyz)*auToD,ixyz=1,ncart),norm2(dipole)*auToD
write(*,'(A60)') '-------------------------------------------------'
write(*,*)
! Print results
write(*,'(A50)') '-----------------------------------------'
write(*,'(A50)') 'ROHF orbital coefficients '
write(*,'(A50)') '-----------------------------------------'
call matout(nBas,nBas,c)
write(*,*)
write(*,'(A50)') '---------------------------------------'
write(*,'(A50)') ' ROHF orbital energies '
write(*,'(A50)') '---------------------------------------'
call matout(nBas,1,e)
write(*,*)
end subroutine

View File

@ -88,7 +88,7 @@ subroutine print_UHF(nBas,nO,Ov,e,c,ENuc,ET,EV,EJ,Ex,EUHF,dipole)
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.6,A3)') ' UHF HOMO b energy:',HOMO(2)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' UHF LUMO b energy:',LUMO(2)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' UHF HOMOb-LUMOb gap :',Gap(2)*HatoeV,' eV'
write(*,'(A40,1X,F16.6,A3)') ' UHF HOMOb-LUMOb gap:',Gap(2)*HatoeV,' eV'
write(*,'(A60)') '-------------------------------------------------'
write(*,'(A40,1X,F16.6)') ' S (exact) :',2d0*S_exact + 1d0
write(*,'(A40,1X,F16.6)') ' S :',2d0*S + 1d0