10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00

Minor changes in Hartree-Fock

This commit is contained in:
Anthony Scemama 2014-04-24 12:31:15 +02:00
parent 6ad651c46c
commit c03132b4f9
8 changed files with 146 additions and 6 deletions

View File

@ -194,6 +194,7 @@ BEGIN_PROVIDER [ logical, ao_bielec_integrals_in_map ]
use map_module use map_module
BEGIN_DOC BEGIN_DOC
! Map of Atomic integrals ! Map of Atomic integrals
! i(r1) j(r2) 1/r12 k(r1) l(r2)
END_DOC END_DOC
integer :: i,j,k,l integer :: i,j,k,l

View File

@ -1,4 +1,4 @@
BEGIN_PROVIDER [ double precision, Fock_matrix_mo, (mo_tot_num,mo_tot_num) ] BEGIN_PROVIDER [ double precision, Fock_matrix_mo, (mo_tot_num_align,mo_tot_num) ]
&BEGIN_PROVIDER [ double precision, Fock_matrix_diag_mo, (mo_tot_num)] &BEGIN_PROVIDER [ double precision, Fock_matrix_diag_mo, (mo_tot_num)]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
@ -17,7 +17,6 @@
! !
END_DOC END_DOC
integer :: i,j,n integer :: i,j,n
double precision :: get_mo_bielec_integral
if (elec_alpha_num == elec_beta_num) then if (elec_alpha_num == elec_beta_num) then
Fock_matrix_mo = Fock_matrix_alpha_mo Fock_matrix_mo = Fock_matrix_alpha_mo
else else

View File

@ -0,0 +1,87 @@
BEGIN_PROVIDER [ double precision, HF_density_matrix_ao_alpha, (ao_num_align,ao_num) ]
&BEGIN_PROVIDER [ double precision, HF_density_matrix_ao_beta, (ao_num_align,ao_num) ]
implicit none
BEGIN_DOC
! Alpha and Beta density matrix in the AO basis
END_DOC
integer :: i,j,k,l1,l2
integer, allocatable :: mo_occ(:,:)
allocate ( mo_occ(elec_alpha_num,2) )
call bitstring_to_list( HF_bitmask(1,1), mo_occ(1,1), j, N_int)
ASSERT ( j==elec_alpha_num )
call bitstring_to_list( HF_bitmask(1,2), mo_occ(1,2), j, N_int)
ASSERT ( j==elec_beta_num )
do j=1,ao_num
!DIR$ VECTOR ALIGNED
do i=1,ao_num_align
HF_density_matrix_ao_alpha(i,j) = 0.d0
HF_density_matrix_ao_beta (i,j) = 0.d0
enddo
do k=1,elec_beta_num
l1 = mo_occ(k,1)
l2 = mo_occ(k,2)
!DIR$ VECTOR ALIGNED
do i=1,ao_num
HF_density_matrix_ao_alpha(i,j) = HF_density_matrix_ao_alpha(i,j) +&
mo_coef(i,l1) * mo_coef(j,l1)
HF_density_matrix_ao_beta (i,j) = HF_density_matrix_ao_beta (i,j) +&
mo_coef(i,l2) * mo_coef(j,l2)
enddo
enddo
do k=elec_beta_num+1,elec_alpha_num
l1 = mo_occ(k,1)
!DIR$ VECTOR ALIGNED
do i=1,ao_num
HF_density_matrix_ao_alpha(i,j) = HF_density_matrix_ao_alpha(i,j) +&
mo_coef(i,l1) * mo_coef(j,l1)
enddo
enddo
enddo
deallocate(mo_occ)
END_PROVIDER
BEGIN_PROVIDER [ double precision, HF_density_matrix_ao, (ao_num_align,ao_num) ]
implicit none
BEGIN_DOC
! Density matrix in the AO basis
END_DOC
integer :: i,j,k,l1,l2
integer, allocatable :: mo_occ(:,:)
allocate ( mo_occ(elec_alpha_num,2) )
call bitstring_to_list( HF_bitmask(1,1), mo_occ(1,1), j, N_int)
ASSERT ( j==elec_alpha_num )
call bitstring_to_list( HF_bitmask(1,2), mo_occ(1,2), j, N_int)
ASSERT ( j==elec_beta_num )
do j=1,ao_num
!DIR$ VECTOR ALIGNED
do i=1,ao_num_align
HF_density_matrix_ao(i,j) = 0.d0
enddo
do k=1,elec_beta_num
l1 = mo_occ(k,1)
l2 = mo_occ(k,2)
!DIR$ VECTOR ALIGNED
do i=1,ao_num
HF_density_matrix_ao(i,j) = HF_density_matrix_ao(i,j) + &
mo_coef(i,l1) * mo_coef(j,l1) + &
mo_coef(i,l2) * mo_coef(j,l2)
enddo
enddo
do k=elec_beta_num+1,elec_alpha_num
l1 = mo_occ(k,1)
!DIR$ VECTOR ALIGNED
do i=1,ao_num
HF_density_matrix_ao(i,j) = HF_density_matrix_ao(i,j) + &
mo_coef(i,l1) * mo_coef(j,l1)
enddo
enddo
enddo
deallocate(mo_occ)
END_PROVIDER

View File

@ -1,4 +1,6 @@
hartree_fock hartree_fock
thresh_scf double precision thresh_scf double precision
n_it_scf_max integer n_it_scf_max integer
direct logical
diis logical

View File

@ -34,3 +34,40 @@ BEGIN_PROVIDER [ integer ,n_it_scf_max]
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ logical, do_direct_SCF ]
implicit none
BEGIN_DOC
! If True, compute integrals on the fly
END_DOC
logical :: has
PROVIDE ezfio_filename
call ezfio_has_Hartree_Fock_direct(has)
if (has) then
call ezfio_get_Hartree_Fock_direct(do_direct_SCF)
else
do_direct_SCF = .False.
call ezfio_set_Hartree_Fock_direct(do_direct_SCF)
endif
END_PROVIDER
BEGIN_PROVIDER [ logical, do_DIIS ]
implicit none
BEGIN_DOC
! If True, compute integrals on the fly
END_DOC
logical :: has
PROVIDE ezfio_filename
call ezfio_has_Hartree_Fock_DIIS(has)
if (has) then
call ezfio_get_Hartree_Fock_DIIS(do_DIIS)
else
do_DIIS = .False.
call ezfio_set_Hartree_Fock_DIIS(do_DIIS)
endif
END_PROVIDER

View File

@ -113,7 +113,7 @@ clean_links:
endif endif
LIB+=$(EZFIO) $(MKL) LIB+=$(EZFIO) $(MKL)
IRPF90+=$(patsubst %, -I %, $(INCLUDE_DIRS)) IRPF90+=$(patsubst %, -I %, $(INCLUDE_DIRS)) $(IRPF90_FLAGS)
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
$(IRPF90) $(IRPF90)

View File

@ -119,3 +119,17 @@ BEGIN_PROVIDER [ double precision, ao_overlap_abs,(ao_num_align,ao_num) ]
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_mono_elec_integral,(ao_num_align,ao_num)]
implicit none
integer :: i,j,n,l
BEGIN_DOC
! array of the mono electronic hamiltonian on the AOs basis
! : sum of the kinetic and nuclear electronic potential
END_DOC
do j = 1, ao_num
do i = 1, ao_num
ao_mono_elec_integral(i,j) = ao_nucl_elec_integral(i,j) + ao_kinetic_integral(i,j)
enddo
enddo
END_PROVIDER

View File

@ -39,8 +39,8 @@ BEGIN_PROVIDER [ double precision, mo_mono_elec_integral,(mo_tot_num_align,mo_to
! array of the mono electronic hamiltonian on the MOs basis ! array of the mono electronic hamiltonian on the MOs basis
! : sum of the kinetic and nuclear electronic potential ! : sum of the kinetic and nuclear electronic potential
END_DOC END_DOC
do i = 1, mo_tot_num
do j = 1, mo_tot_num do j = 1, mo_tot_num
do i = 1, mo_tot_num
mo_mono_elec_integral(i,j) = mo_nucl_elec_integral(i,j) + mo_kinetic_integral(i,j) mo_mono_elec_integral(i,j) = mo_nucl_elec_integral(i,j) + mo_kinetic_integral(i,j)
enddo enddo
enddo enddo