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

trying to fix collinearity test

This commit is contained in:
Pierre-Francois Loos 2023-11-15 00:52:12 +01:00
parent d22ee6a560
commit 5ccb8ebdc5
8 changed files with 165 additions and 155 deletions

View File

@ -37,17 +37,17 @@ subroutine print_UG0F2(nBas,nO,eHF,ENuc,EUHF,SigC,Z,eGF2,Ec)
! Dump results
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)' Unrestricted one-shot G0F2 calculation (eV)'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
'|',' ','|','e_HF ','|','Sig_c ','|','Z ','|','e_QP ','|'
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
@ -55,17 +55,17 @@ subroutine print_UG0F2(nBas,nO,eHF,ENuc,EUHF,SigC,Z,eGF2,Ec)
Z(p,1),Z(p,2),'|',eGF2(p,1)*HaToeV,eGF2(p,2)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'UG0F2 HOMO energy:',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'UG0F2 LUMO energy:',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'UG0F2 HOMO-LUMO gap :',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') ' UG0F2 total energy :',ENuc + EUHF + sum(Ec(:)),' au'
write(*,'(2X,A30,F15.6,A3)') ' UG0F2 correlation energy:',sum(Ec(:)),' au'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)
end subroutine

View File

@ -39,21 +39,21 @@ subroutine print_evUGF2(nBas,nO,nSCF,Conv,eHF,ENuc,EUHF,SigC,Z,eGF2,Ec)
! Dump results
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
if(nSCF < 10) then
write(*,'(1X,A21,I1,A2,A12)')' Self-consistent evG',nSCF,'F2',' calculation'
else
write(*,'(1X,A21,I2,A2,A12)')' Self-consistent evG',nSCF,'F2',' calculation'
endif
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
'|',' ','|','e_HF ','|','Sig_c ','|','Z ','|','e_QP ','|'
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
@ -61,21 +61,21 @@ subroutine print_evUGF2(nBas,nO,nSCF,Conv,eHF,ENuc,EUHF,SigC,Z,eGF2,Ec)
Z(p,1),Z(p,2),'|',eGF2(p,1)*HaToeV,eGF2(p,2)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A10,I3)') 'Iteration ',nSCF
write(*,'(2X,A14,F15.5)')'Convergence = ',Conv
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'evGF2 HOMO energy:',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'evGF2 LUMO energy:',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'evGF2 HOMO-LUMO gap :',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') ' evGF2 total energy :',ENuc + EUHF + sum(Ec(:)),' au'
write(*,'(2X,A30,F15.6,A3)') ' evGF2 correlation energy:',sum(Ec(:)),' au'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)
end subroutine

View File

@ -66,21 +66,21 @@ subroutine print_qsUGF2(nBas,nO,nSCF,Conv,thresh,eHF,eGF2,cGF2,PGF2,Ov,T,V,J,K,
! Dump results
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
if(nSCF < 10) then
write(*,'(1X,A21,I1,A2,A12)')' Self-consistent qsG',nSCF,'F2',' calculation'
else
write(*,'(1X,A21,I2,A2,A12)')' Self-consistent qsG',nSCF,'F2',' calculation'
endif
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
'|',' ','|','e_HF ','|','Sig_c ','|','Z ','|','e_QP ','|'
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
@ -88,22 +88,22 @@ subroutine print_qsUGF2(nBas,nO,nSCF,Conv,thresh,eHF,eGF2,cGF2,PGF2,Ov,T,V,J,K,
Z(p,1),Z(p,2),'|',eGF2(p,1)*HaToeV,eGF2(p,2)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A10,I3)') 'Iteration ',nSCF
write(*,'(2X,A14,F15.5)')'Convergence = ',Conv
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'qsUGF2 HOMO energy:',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsUGF2 LUMO energy:',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsUGF2 HOMO-LUMO gap :',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') ' qsUGF2 total energy:',ENuc + EqsGF2,' au'
write(*,'(2X,A30,F15.6,A3)') ' qsUGF2 exchange energy:',sum(Ex(:)),' au'
write(*,'(2X,A30,F15.6,A3)') ' qsUGF2 correlation energy:',sum(Ec(:)),' au'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)
! Dump results for final iteration

View File

@ -38,17 +38,17 @@ subroutine print_UG0W0(nBas,nO,eHF,ENuc,EUHF,SigC,Z,eGW,EcRPA,EcGM)
! Dump results
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)' One-shot UG0W0 calculation (eV)'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
'|',' ','|','e_HF ','|','Sig_GW ','|','Z ','|','e_GW ','|'
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
@ -56,19 +56,19 @@ subroutine print_UG0W0(nBas,nO,eHF,ENuc,EUHF,SigC,Z,eGW,EcRPA,EcGM)
Z(p,1),Z(p,2),'|',eGW(p,1)*HaToeV,eGW(p,2)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A50,F15.6,A3)') 'UG0W0 HOMO energy = ',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A50,F15.6,A3)') 'UG0W0 LUMO energy = ',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A50,F15.6,A3)') 'UG0W0 HOMO-LUMO gap = ',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A50,F15.6,A3)') 'phRPA@UG0W0 total energy = ',ENuc + EUHF + EcRPA,' au'
write(*,'(2X,A50,F15.6,A3)') 'phRPA@UG0W0 correlation energy = ',EcRPA,' au'
write(*,'(2X,A50,F15.6,A3)') ' GM@UG0W0 total energy = ',ENuc + EUHF + sum(EcGM(:)),' au'
write(*,'(2X,A50,F15.6,A3)') ' GM@UG0W0 correlation energy = ',sum(EcGM(:)),' au'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)
end subroutine

View File

@ -40,8 +40,8 @@ subroutine print_evUGW(nBas,nO,nSCF,Conv,eHF,ENuc,EUHF,SigC,Z,eGW,EcRPA,EcGM)
! Dump results
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
if(nSCF < 10) then
write(*,'(1X,A22,I1,A1,I1,A12)')' Self-consistent evUG',nSCF,'W',nSCF,' calculation'
elseif(nSCF < 100) then
@ -49,14 +49,14 @@ subroutine print_evUGW(nBas,nO,nSCF,Conv,eHF,ENuc,EUHF,SigC,Z,eGW,EcRPA,EcGM)
else
write(*,'(1X,A22,I3,A1,I3,A12)')' Self-consistent evUG',nSCF,'W',nSCF,' calculation'
end if
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
'|',' ','|','e_HF ','|','Sig_GW ','|','Z ','|','e_GW ','|'
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
@ -64,23 +64,23 @@ subroutine print_evUGW(nBas,nO,nSCF,Conv,eHF,ENuc,EUHF,SigC,Z,eGW,EcRPA,EcGM)
Z(p,1),Z(p,2),'|',eGW(p,1)*HaToeV,eGW(p,2)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A10,I3)') 'Iteration ',nSCF
write(*,'(2X,A14,F15.5)')'Convergence = ',Conv
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'evUGW HOMO energy = ',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'evUGW LUMO energy = ',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'evUGW HOMO-LUMO gap = ',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'RPA@evUGW total energy = ',ENuc + EUHF + EcRPA,' au'
write(*,'(2X,A30,F15.6,A3)') 'RPA@evUGW correlation energy = ',EcRPA,' au'
write(*,'(2X,A30,F15.6,A3)') ' GM@evUGW total energy = ',ENuc + EUHF + sum(EcGM(:)),' au'
write(*,'(2X,A30,F15.6,A3)') ' GM@evUGW correlation energy = ',sum(EcGM(:)),' au'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)
end subroutine

View File

@ -62,8 +62,8 @@ subroutine print_qsUGW(nBas,nO,nSCF,Conv,thresh,eHF,eGW,cGW,Ov,ENuc,ET,EV,EJ,Ex,
! Dump results
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
if(nSCF < 10) then
write(*,'(1X,A22,I1,A1,I1,A12)')' Self-consistent qsUG',nSCF,'W',nSCF,' calculation'
elseif(nSCF < 100) then
@ -71,14 +71,14 @@ subroutine print_qsUGW(nBas,nO,nSCF,Conv,thresh,eHF,eGW,cGW,Ov,ENuc,ET,EV,EJ,Ex,
else
write(*,'(1X,A22,I3,A1,I3,A12)')' Self-consistent qsUG',nSCF,'W',nSCF,' calculation'
end if
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(A1,A3,A1,A30,A1,A30,A1,A30,A1,A30,A1)') &
'|',' ','|','e_HF ','|','Sig_GW ','|','Z ','|','e_GW ','|'
write(*,'(A1,A3,A1,2A15,A1,2A15,A1,2A15,A1,2A15,A1)') &
'|','#','|','up ','dw ','|','up ','dw ','|','up ','dw ','|','up ','dw ','|'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
do p=1,nBas
write(*,'(A1,I3,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1,2F15.6,A1)') &
@ -86,23 +86,23 @@ subroutine print_qsUGW(nBas,nO,nSCF,Conv,thresh,eHF,eGW,cGW,Ov,ENuc,ET,EV,EJ,Ex,
Z(p,1),Z(p,2),'|',eGW(p,1)*HaToeV,eGW(p,2)*HaToeV,'|'
enddo
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A10,I3)') 'Iteration ',nSCF
write(*,'(2X,A14,F15.5)')'Convergence = ',Conv
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') 'qsUGW HOMO energy = ',maxval(HOMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsUGW LUMO energy = ',minval(LUMO(:))*HaToeV,' eV'
write(*,'(2X,A30,F15.6,A3)') 'qsUGW HOMO-LUMO gap = ',(minval(LUMO(:))-maxval(HOMO(:)))*HaToeV,' eV'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,'(2X,A30,F15.6,A3)') ' qsUGW total energy = ',ENuc + EqsGW,' au'
write(*,'(2X,A30,F15.6,A3)') ' qsUGW exchange energy = ',sum(Ex(:)),' au'
write(*,'(2X,A30,F15.6,A3)') ' GM@qsUGW correlation energy = ',sum(EcGM(:)),' au'
write(*,'(2X,A30,F15.6,A3)') 'RPA@qsUGW correlation energy = ',EcRPA,' au'
write(*,*)'-------------------------------------------------------------------------------'&
'------------------------------------------------'
write(*,*)'----------------------------------------------------------------'// &
'----------------------------------------------------------------'
write(*,*)
! Dump results for final iteration

View File

@ -234,14 +234,14 @@ subroutine GHF(dotest,maxSCF,thresh,max_diis,guess_type,mix,level_shift,nNuc,ZNu
ET = ETaa + ETbb
! Potential energy
! Potential energy
EVaa = trace_matrix(nBas,matmul(Paa,V))
EVbb = trace_matrix(nBas,matmul(Pbb,V))
EVaa = trace_matrix(nBas,matmul(Paa,V))
EVbb = trace_matrix(nBas,matmul(Pbb,V))
EV = EVaa + EVbb
EV = EVaa + EVbb
! Hartree energy
! Hartree energy
EJaaaa = 0.5d0*trace_matrix(nBas,matmul(Paa,Jaa))
EJaabb = 0.5d0*trace_matrix(nBas,matmul(Paa,Jbb))
@ -294,7 +294,7 @@ subroutine GHF(dotest,maxSCF,thresh,max_diis,guess_type,mix,level_shift,nNuc,ZNu
! Compute final GHF energy
call print_GHF(nBas,nBas2,nO,eHF,C,P,ENuc,ET,EV,EJ,EK,EGHF,dipole)
call print_GHF(nBas,nBas2,nO,eHF,C,P,Ov,ENuc,ET,EV,EJ,EK,EGHF,dipole)
! Print test values

View File

@ -1,4 +1,4 @@
subroutine print_GHF(nBas,nBas2,nO,e,C,P,ENuc,ET,EV,EJ,EK,EHF,dipole)
subroutine print_GHF(nBas,nBas2,nO,eHF,C,P,S,ENuc,ET,EV,EJ,EK,EGHF,dipole)
! Print one-electron energies and other stuff for GHF
@ -10,15 +10,16 @@ subroutine print_GHF(nBas,nBas2,nO,e,C,P,ENuc,ET,EV,EJ,EK,EHF,dipole)
integer,intent(in) :: nBas
integer,intent(in) :: nBas2
integer,intent(in) :: nO
double precision,intent(in) :: e(nBas2)
double precision,intent(in) :: eHF(nBas2)
double precision,intent(in) :: C(nBas2,nBas2)
double precision,intent(in) :: P(nBas2,nBas2)
double precision,intent(in) :: S(nBas,nBas)
double precision,intent(in) :: ENuc
double precision,intent(in) :: ET
double precision,intent(in) :: EV
double precision,intent(in) :: EJ
double precision,intent(in) :: EK
double precision,intent(in) :: EHF
double precision,intent(in) :: EGHF
double precision,intent(in) :: dipole(ncart)
! Local variables
@ -28,7 +29,8 @@ subroutine print_GHF(nBas,nBas2,nO,e,C,P,ENuc,ET,EV,EJ,EK,EHF,dipole)
integer :: HOMO
integer :: LUMO
double precision :: Gap
double precision :: Sx2,Sy2,Sz2,S2
double precision :: Sx ,Sy ,Sz
double precision :: Sx2,Sy2,Sz2
double precision,allocatable :: Ca(:,:)
double precision,allocatable :: Cb(:,:)
@ -54,86 +56,86 @@ subroutine print_GHF(nBas,nBas2,nO,e,C,P,ENuc,ET,EV,EJ,EK,EHF,dipole)
HOMO = nO
LUMO = HOMO + 1
Gap = e(LUMO)-e(HOMO)
Gap = eHF(LUMO)-eHF(HOMO)
! Density matrices
allocate(Paa(nBas,nBas),Pab(nBas,nBas),Pba(nBas,nBas),Pbb(nBas,nBas))
allocate(Paa(nO,nO),Pab(nO,nO),Pba(nO,nO),Pbb(nO,nO))
Paa(:,:) = P( 1:nBas , 1:nBas )
Pab(:,:) = P( 1:nBas ,nBas+1:nBas2)
Pba(:,:) = P(nBas+1:nBas2, 1:nBas )
Pbb(:,:) = P(nBas+1:nBas2,nBas+1:nBas2)
! Paa(:,:) = P( 1:nBas , 1:nBas )
! Pab(:,:) = P( 1:nBas ,nBas+1:nBas2)
! Pba(:,:) = P(nBas+1:nBas2, 1:nBas )
! Pbb(:,:) = P(nBas+1:nBas2,nBas+1:nBas2)
! allocate(Ca(nBas,nBas2),Cb(nBas,nBas2))
allocate(Ca(nBas,nBas2),Cb(nBas,nBas2))
! Ca(:,:) = C( 1:nBas ,1:nBas2)
! Cb(:,:) = C(nBas+1:nBas2,1:nBas2)
Ca(:,:) = C( 1:nBas ,1:nO)
Cb(:,:) = C(nBas+1:nBas2,1:nO)
! Compute expectation values of S^2 (WRONG!)
Paa = matmul(transpose(Ca),matmul(S,Ca))
Pab = matmul(transpose(Ca),matmul(S,Cb))
Pba = matmul(transpose(Cb),matmul(S,Ca))
Pbb = matmul(transpose(Cb),matmul(S,Cb))
! Sx2 = 0.25d0*trace_matrix(nBas,Paa+Pbb) + 0.25d0*trace_matrix(nBas,Pab+Pba)**2
! do mu=1,nBas
! do nu=1,nBas
! Sx2 = Sx2 - 0.5d0*(Paa(mu,nu)*Pbb(nu,mu) + Pab(mu,nu)*Pab(nu,mu))
! end do
! end do
! Compute <S>
! Sy2 = 0.25d0*trace_matrix(nBas,Paa+Pbb) - 0.25d0*trace_matrix(nBas,Pab+Pba)**2
! do mu=1,nBas
! do nu=1,nBas
! Sy2 = Sy2 - 0.5d0*(Paa(mu,nu)*Pbb(nu,mu) - Pab(mu,nu)*Pab(nu,mu))
! end do
! end do
Sx = 0.5d0*(trace_matrix(nO,Pab) + trace_matrix(nO,Pba))
Sy = 0.5d0*(trace_matrix(nO,Pab) - trace_matrix(nO,Pba))
Sz = 0.5d0*(trace_matrix(nO,Paa) - trace_matrix(nO,Pbb))
! Sz2 = 0.25d0*trace_matrix(nBas,Paa+Pbb) + 0.25d0*trace_matrix(nBas,Pab-Pba)**2
! do mu=1,nBas
! do nu=1,nBas
! Sz2 = Sz2 - 0.25d0*(Paa(mu,nu)*Pbb(nu,mu) - Pab(mu,nu)*Pab(nu,mu))
! Sz2 = Sz2 + 0.25d0*(Pab(mu,nu)*Pba(nu,mu) - Pba(mu,nu)*Pab(nu,mu))
! end do
! end do
!
! S2 = Sx2 + Sy2 + Sz2
! Compute <S^2>
! Checl collinearity and coplanarity
Sx2 = 0.25d0*trace_matrix(nO,Paa+Pbb) + 0.25d0*trace_matrix(nO,Pab+Pba)**2 &
- 0.5d0*trace_matrix(nO,matmul(Paa,Pbb) + matmul(Pab,Pab))
allocate(PP(nBas,nBas),Mx(nBas,nBas),My(nBas,nBas),Mz(nBas,nBas))
Sy2 = 0.25d0*trace_matrix(nO,Paa+Pbb) - 0.25d0*trace_matrix(nO,Pab+Pba)**2 &
- 0.5d0*trace_matrix(nO,matmul(Paa,Pbb) - matmul(Pab,Pab))
Sz2 = 0.25d0*trace_matrix(nO,Paa+Pbb) + 0.25d0*trace_matrix(nO,Pab-Pba)**2 &
- 0.25d0*trace_matrix(nO,matmul(Paa,Paa) - matmul(Pbb,Pbb)) &
+ 0.25d0*trace_matrix(nO,matmul(Pab,Pba) - matmul(Pba,Pab))
! deallocate(Paa,Pab,Pba,Pbb)
! Check collinearity and coplanarity
allocate(PP(nO,nO),Mx(nO,nO),My(nO,nO),Mz(nO,nO))
PP(:,:) = 0.5d0*(Paa(:,:) + Pbb(:,:))
Mx(:,:) = 0.5d0*(Pba(:,:) + Pab(:,:))
My(:,:) = 0.5d0*(Pba(:,:) - Pab(:,:))
Mz(:,:) = 0.5d0*(Paa(:,:) - Pbb(:,:))
T(1,1) = trace_matrix(nBas,matmul(Mx,transpose(Mx)))
T(1,2) = trace_matrix(nBas,matmul(Mx,transpose(My)))
T(1,3) = trace_matrix(nBas,matmul(Mx,transpose(Mz)))
T(2,1) = trace_matrix(nBas,matmul(My,transpose(Mx)))
T(2,2) = trace_matrix(nBas,matmul(My,transpose(My)))
T(2,3) = trace_matrix(nBas,matmul(My,transpose(Mz)))
T(3,1) = trace_matrix(nBas,matmul(Mz,transpose(Mx)))
T(3,2) = trace_matrix(nBas,matmul(Mz,transpose(My)))
T(3,3) = trace_matrix(nBas,matmul(Mz,transpose(Mz)))
! T(1,1) = trace_matrix(nBas,matmul(Mx,transpose(Mx)))
! T(1,2) = - trace_matrix(nBas,matmul(Mx,transpose(My)))
! T(1,3) = trace_matrix(nBas,matmul(Mx,transpose(Mz)))
! T(2,1) = - trace_matrix(nBas,matmul(My,transpose(Mx)))
! T(2,2) = + trace_matrix(nBas,matmul(My,transpose(My)))
! T(2,3) = - trace_matrix(nBas,matmul(My,transpose(Mz)))
! T(3,1) = trace_matrix(nBas,matmul(Mz,transpose(Mx)))
! T(3,2) = - trace_matrix(nBas,matmul(Mz,transpose(My)))
! T(3,3) = trace_matrix(nBas,matmul(Mz,transpose(Mz)))
print*,'Value of Tr(P - P^2)'
lambda = trace_matrix(nBas,PP - matmul(PP,transpose(PP)))
print*,lambda
print*,2d0*trace_matrix(nO,PP)
! print*,'Value of Tr(P - P^2)'
! lambda = trace_matrix(nBas,PP - matmul(PP,transpose(PP)))
! print*,lambda
print*,'Eigenvalues of T'
vec(:,:) = T(:,:)
call diagonalize_matrix(3,vec,val)
print*,val
! print*,'Eigenvalues of T'
! vec(:,:) = T(:,:)
! call diagonalize_matrix(3,vec,val)
! print*,val
T(1,1) = - T(1,1) + lambda
T(2,2) = - T(2,2) + lambda
T(3,3) = - T(3,3) + lambda
! T(1,1) = - T(1,1) + lambda
! T(2,2) = - T(2,2) + lambda
! T(3,3) = - T(3,3) + lambda
print*,'Eigenvalues of A'
vec(:,:) = T(:,:)
call diagonalize_matrix(3,vec,val)
print*,val
! print*,'Eigenvalues of A'
! vec(:,:) = T(:,:)
! call diagonalize_matrix(3,vec,val)
! print*,val
deallocate(PP,Mx,My,Mz)
! deallocate(PP,Mx,My,Mz)
! Dump results
@ -149,16 +151,24 @@ subroutine print_GHF(nBas,nBas2,nO,e,C,P,ENuc,ET,EV,EJ,EK,EHF,dipole)
write(*,'(A33,1X,F16.10,A3)') ' Hartree energy = ',EJ,' au'
write(*,'(A33,1X,F16.10,A3)') ' Exchange energy = ',EK,' au'
write(*,'(A50)') '---------------------------------------'
write(*,'(A33,1X,F16.10,A3)') ' Electronic energy = ',EHF,' au'
write(*,'(A33,1X,F16.10,A3)') ' Electronic energy = ',EGHF,' au'
write(*,'(A33,1X,F16.10,A3)') ' Nuclear repulsion = ',ENuc,' au'
write(*,'(A33,1X,F16.10,A3)') ' GHF energy = ',EHF + ENuc,' au'
write(*,'(A33,1X,F16.10,A3)') ' GHF energy = ',EGHF + ENuc,' au'
write(*,'(A50)') '---------------------------------------'
write(*,'(A33,1X,F16.6,A3)') ' GHF HOMO energy = ',e(HOMO)*HaToeV,' eV'
write(*,'(A33,1X,F16.6,A3)') ' GHF LUMO energy = ',e(LUMO)*HaToeV,' eV'
write(*,'(A33,1X,F16.6,A3)') ' GHF HOMO energy = ',eHF(HOMO)*HaToeV,' eV'
write(*,'(A33,1X,F16.6,A3)') ' GHF LUMO energy = ',eHF(LUMO)*HaToeV,' eV'
write(*,'(A33,1X,F16.6,A3)') ' GHF HOMO-LUMO gap = ',Gap*HaToeV,' eV'
write(*,'(A50)') '---------------------------------------'
! write(*,'(A32,1X,F16.6)') ' <S**2> :',S2
! write(*,'(A50)') '---------------------------------------'
write(*,'(A33,1X,F16.6)') ' <Sx> = ',Sx
write(*,'(A33,1X,F16.6)') ' <Sy> = ',Sy
write(*,'(A33,1X,F16.6)') ' <Sz> = ',Sz
write(*,'(A33,1X,F16.6)') ' <S> = ',Sx+Sy+Sz
write(*,'(A50)') '---------------------------------------'
write(*,'(A33,1X,F16.6)') ' <Sx**2> = ',Sx2
write(*,'(A33,1X,F16.6)') ' <Sy**2> = ',Sy2
write(*,'(A33,1X,F16.6)') ' <Sz**2> = ',Sz2
write(*,'(A33,1X,F16.6)') ' <S**2> = ',Sx2+Sy2+Sz2
write(*,'(A50)') '---------------------------------------'
write(*,'(A36)') ' Dipole moment (Debye) '
write(*,'(10X,4A10)') 'X','Y','Z','Tot.'
write(*,'(10X,4F10.4)') (dipole(ixyz)*auToD,ixyz=1,ncart),norm2(dipole)*auToD
@ -171,13 +181,13 @@ subroutine print_GHF(nBas,nBas2,nO,e,C,P,ENuc,ET,EV,EJ,EK,EHF,dipole)
write(*,'(A50)') '---------------------------------------'
write(*,'(A50)') ' GHF orbital coefficients '
write(*,'(A50)') '---------------------------------------'
call matout(nBas2,nBas2,c)
call matout(nBas2,nBas2,C)
write(*,*)
end if
write(*,'(A50)') '---------------------------------------'
write(*,'(A50)') ' GHF orbital energies (au) '
write(*,'(A50)') '---------------------------------------'
call matout(nBas2,1,e)
call matout(nBas2,1,eHF)
write(*,*)
end subroutine