10
1
mirror of https://github.com/pfloos/quack synced 2024-12-22 12:23:42 +01:00

saving cRHF

This commit is contained in:
Pierre-Francois Loos 2024-04-22 15:59:02 +02:00
parent 7e633ed6da
commit a2a63862c1
13 changed files with 87 additions and 33 deletions

View File

@ -1,5 +1,5 @@
subroutine cRHF(dotest,maxSCF,thresh,max_diis,guess_type,level_shift,nNuc,ZNuc,rNuc,ENuc, &
nBas,nO,S,T,V,Hc,ERI,dipole_int,X,ERHF,eHF,c,P)
nBas,nO,S,T,V,ERI,dipole_int,X,ERHF,eHF,c,P)
! Perform complex restricted Hartree-Fock calculation
@ -25,7 +25,6 @@ subroutine cRHF(dotest,maxSCF,thresh,max_diis,guess_type,level_shift,nNuc,ZNuc,r
double precision,intent(in) :: S(nBas,nBas)
double precision,intent(in) :: T(nBas,nBas)
double precision,intent(in) :: V(nBas,nBas)
double precision,intent(in) :: Hc(nBas,nBas)
double precision,intent(in) :: X(nBas,nBas)
double precision,intent(in) :: ERI(nBas,nBas,nBas,nBas)
double precision,intent(in) :: dipole_int(nBas,nBas,ncart)
@ -44,23 +43,25 @@ subroutine cRHF(dotest,maxSCF,thresh,max_diis,guess_type,level_shift,nNuc,ZNuc,r
double precision :: Conv
double precision :: rcond
double precision,external :: trace_matrix
double precision,allocatable :: err(:,:)
double precision,allocatable :: err_diis(:,:)
double precision,allocatable :: F_diis(:,:)
double precision,allocatable :: J(:,:)
double precision,allocatable :: K(:,:)
double precision,allocatable :: cp(:,:)
double precision,allocatable :: F(:,:)
double precision,allocatable :: Fp(:,:)
complex*16,allocatable :: W(:,:)
double precision :: eta
double precision,allocatable :: W(:,:)
complex*16,allocatable :: Hc(:,:)
complex*16,allocatable :: J(:,:)
complex*16,allocatable :: K(:,:)
complex*16,allocatable :: cp(:,:)
complex*16,allocatable :: F(:,:)
complex*16,allocatable :: Fp(:,:)
complex*16,allocatable :: err(:,:)
complex*16,allocatable :: err_diis(:,:)
complex*16,allocatable :: F_diis(:,:)
! Output variables
double precision,intent(out) :: ERHF
double precision,intent(out) :: eHF(nBas)
double precision,intent(inout):: c(nBas,nBas)
double precision,intent(out) :: P(nBas,nBas)
complex*16,intent(out) :: ERHF
complex*16,intent(out) :: eHF(nBas)
complex*16,intent(out) :: c(nBas,nBas)
complex*16,intent(out) :: P(nBas,nBas)
! Hello world
@ -73,16 +74,23 @@ subroutine cRHF(dotest,maxSCF,thresh,max_diis,guess_type,level_shift,nNuc,ZNuc,r
! Useful quantities
nBasSq = nBas*nBas
eta = 0.01d0
! Memory allocation
allocate(J(nBas,nBas),K(nBas,nBas),err(nBas,nBas),cp(nBas,nBas),F(nBas,nBas), &
Fp(nBas,nBas),err_diis(nBasSq,max_diis),F_diis(nBasSq,max_diis), &
W(nBas,nBas))
Hc(nBas,nBas),W(nBas,nBas))
! Read CAP integrals from file
! call read_CAP_integrals()
call read_CAP_integrals(nBas,W)
W(:,:) = eta*W(:,:)
! Define core Hamiltonian
Hc(:,:) = dcmplx(T+V,W)
! Guess coefficients and density matrix
@ -205,10 +213,10 @@ subroutine cRHF(dotest,maxSCF,thresh,max_diis,guess_type,level_shift,nNuc,ZNuc,r
if(dotest) then
call dump_test_value('R','RHF energy',ERHF)
call dump_test_value('R','RHF HOMO energy',eHF(nO))
call dump_test_value('R','RHF LUMO energy',eHF(nO+1))
call dump_test_value('R','RHF dipole moment',norm2(dipole))
! call dump_test_value('R','RHF energy',ERHF)
! call dump_test_value('R','RHF HOMO energy',eHF(nO))
! call dump_test_value('R','RHF LUMO energy',eHF(nO+1))
! call dump_test_value('R','RHF dipole moment',norm2(dipole))
end if

View File

@ -175,5 +175,4 @@ function element_covalent_radius(zatom)
element_covalent_radius = element_covalent_radius*pmtoau
end function element_covalent_radius
end function

View File

@ -116,4 +116,4 @@ subroutine orthogonalization_matrix(nBas,S,X)
end if
end subroutine orthogonalization_matrix
end subroutine

View File

@ -0,0 +1,47 @@
subroutine read_CAP_integrals(nBas,W)
! Read one- and two-electron integrals from files
implicit none
include 'parameters.h'
! Input variables
integer,intent(in) :: nBas
! Local variables
logical :: debug
integer :: mu,nu
double precision :: wx,wy,wz
! Output variables
double precision,intent(out) :: W(nBas,nBas)
! Open file with integrals
debug = .false.
open(unit=31,file='int/CAP.dat')
! Read CAP integrals
W(:,:) = 0d0
do
read(31,*,end=31) mu,nu,wx,wy,wz
W(mu,nu) = wx + wy + wz
W(nu,mu) = wx + wy + wz
end do
31 close(unit=31)
! Print results
if(debug) then
write(*,'(A28)') '----------------------'
write(*,'(A28)') 'CAP integrals'
write(*,'(A28)') '----------------------'
call matout(nBas,nBas,W)
write(*,*)
end if
end subroutine

View File

@ -173,4 +173,4 @@ subroutine read_auxiliary_basis(NAtoms,XYZAtoms,nShell,CenterShell, &
close(unit=3)
end subroutine read_auxiliary_basis
end subroutine

View File

@ -182,4 +182,4 @@ subroutine read_basis(nNuc,rNuc,nBas,nO,nV,nShell,TotAngMomShell,CenterShell,KSh
nV(:) = nBas - nO(:)
end subroutine read_basis
end subroutine

View File

@ -68,4 +68,4 @@ subroutine read_dipole_integrals(nBas,R)
call matout(nBas,nBas,R(:,:,3))
end if
end subroutine read_dipole_integrals
end subroutine

View File

@ -73,4 +73,4 @@ subroutine read_geometry(nNuc,ZNuc,rNuc,ENuc)
write(*,'(A28)') '------------------'
write(*,*)
end subroutine read_geometry
end subroutine

View File

@ -130,4 +130,4 @@ subroutine read_integrals(nBas,S,T,V,Hc,G)
write(*,*)
end if
end subroutine read_integrals
end subroutine

View File

@ -59,4 +59,4 @@ subroutine read_molecule(nNuc,nO,nC,nR)
close(unit=1)
end subroutine read_molecule
end subroutine

View File

@ -32,4 +32,4 @@ subroutine spatial_to_spin_ERI(nBas,ERI,nBas2,sERI)
end do
end do
end subroutine spatial_to_spin_ERI
end subroutine

View File

@ -26,4 +26,4 @@ subroutine spatial_to_spin_MO_energy(nBas,e,nBas2,se)
! print*,'MO energies in spinorbital basis'
! call matout(nBas2,1,se)
end subroutine spatial_to_spin_MO_energy
end subroutine

View File

@ -26,4 +26,4 @@ subroutine spatial_to_spin_fock(nBas,F,nBas2,sF)
end do
end do
end subroutine spatial_to_spin_fock
end subroutine