10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-14 01:53:49 +01:00

more printing for debugging

This commit is contained in:
Kevin Gasperich 2020-02-03 13:58:08 -06:00
parent a6a4e8ecac
commit 8b33c2b4b5
6 changed files with 241 additions and 5 deletions

View File

@ -15,7 +15,7 @@ BEGIN_PROVIDER [ complex*16, eigenvectors_Fock_matrix_mo_complex, (ao_num,mo_num
do j=1,mo_num
do i=1,mo_num
F(i,j) = Fock_matrix_mo_complex(i,j)
F(i,j) = fock_matrix_mo_complex(i,j)
enddo
enddo

View File

@ -0,0 +1,44 @@
subroutine print_debug_scf_complex
implicit none
BEGIN_DOC
! Build the MOs using the extended Huckel model
END_DOC
integer :: i,j
write(*,'(A)') 'mo_coef_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') mo_coef_complex(i,:)
enddo
write(*,'(A)') 'scf_density_matrix_ao_alpha_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') scf_density_matrix_ao_alpha_complex(i,:)
enddo
write(*,'(A)') 'scf_density_matrix_ao_beta_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') scf_density_matrix_ao_beta_complex(i,:)
enddo
write(*,'(A)') 'ao_two_e_integral_alpha_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') ao_two_e_integral_alpha_complex(i,:)
enddo
write(*,'(A)') 'ao_two_e_integral_beta_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') ao_two_e_integral_beta_complex(i,:)
enddo
write(*,'(A)') 'fock_matrix_ao_alpha_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') fock_matrix_ao_alpha_complex(i,:)
enddo
write(*,'(A)') 'fock_matrix_ao_beta_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') fock_matrix_ao_beta_complex(i,:)
enddo
end

View File

@ -100,8 +100,8 @@ END_DOC
max_error_DIIS = maxval(cdabs(FPS_SPF_Matrix_MO_complex))
! SCF energy
energy_SCF = SCF_energy
! call print_debug_scf_complex
energy_SCF = scf_energy
Delta_Energy_SCF = energy_SCF - energy_SCF_previous
if ( (SCF_algorithm == 'DIIS').and.(Delta_Energy_SCF > 0.d0) ) then
Fock_matrix_AO_complex(1:ao_num,1:ao_num) = Fock_matrix_DIIS (1:ao_num,1:ao_num,index_dim_DIIS)
@ -121,7 +121,7 @@ END_DOC
level_shift = level_shift * 3.0d0
endif
TOUCH mo_coef_complex level_shift
mo_coef_complex(1:ao_num,1:mo_num) = eigenvectors_Fock_matrix_MO_complex(1:ao_num,1:mo_num)
mo_coef_complex(1:ao_num,1:mo_num) = eigenvectors_fock_matrix_mo_complex(1:ao_num,1:mo_num)
if(frozen_orb_scf)then
call reorder_core_orb
call initialize_mo_coef_begin_iteration
@ -143,7 +143,7 @@ END_DOC
! Print results at the end of each iteration
write(6,'(I4, 1X, F16.10, 1X, F16.10, 1X, F16.10, 1X, F16.10, 1X, I3)') &
iteration_SCF, energy_SCF, Delta_energy_SCF, max_error_DIIS, level_shift, dim_DIIS
iteration_SCF, energy_scf, Delta_energy_SCF, max_error_DIIS, level_shift, dim_DIIS
if (Delta_energy_SCF < 0.d0) then
call save_mos

View File

@ -0,0 +1,118 @@
program print_2e_integrals_from_map
call run
end
subroutine run
use map_module
implicit none
BEGIN_DOC
! Alpha and Beta Fock matrices in AO basis set
END_DOC
!TODO: finish implementing this: see complex qp1 (different mapping)
integer :: i,j,k,l,k1,r,s
integer :: i0,j0,k0,l0
integer*8 :: p,q
complex*16 :: integral, c0
PROVIDE ao_two_e_integrals_in_map
integer(omp_lock_kind) :: lck(ao_num)
integer(map_size_kind) :: i8
integer :: ii(4), jj(4), kk(4), ll(4), k2
integer(cache_map_size_kind) :: n_elements_max, n_elements
integer(key_kind), allocatable :: keys(:)
double precision, allocatable :: values(:)
complex*16, parameter :: i_sign(4) = (/(0.d0,1.d0),(0.d0,1.d0),(0.d0,-1.d0),(0.d0,-1.d0)/)
integer(key_kind) :: key1
call get_cache_map_n_elements_max(ao_integrals_map,n_elements_max)
allocate(keys(n_elements_max), values(n_elements_max))
do i8=0_8,ao_integrals_map%map_size
n_elements = n_elements_max
call get_cache_map(ao_integrals_map,i8,keys,values,n_elements)
do k1=1,n_elements
! get original key
! reverse of 2*key (imag part) and 2*key-1 (real part)
key1 = shiftr(keys(k1)+1,1)
call two_e_integrals_index_reverse_complex_1(ii,jj,kk,ll,key1)
! i<=k, j<=l, ik<=jl
! ijkl, jilk, klij*, lkji*
if (shiftl(key1,1)==keys(k1)) then !imaginary part (even)
do k2=1,4
if (ii(k2)==0) then
cycle
endif
i = ii(k2)
j = jj(k2)
k = kk(k2)
l = ll(k2)
print'((A),4(I4),1(E15.7),2(I),2(E9.1))','imag1 ',i,j,k,l,values(k1),k1,k2,i_sign(k2)
!G_a(i,k) += D_{ab}(l,j)*(<ij|kl>)
!G_b(i,k) += D_{ab}(l,j)*(<ij|kl>)
!G_a(i,l) -= D_a (k,j)*(<ij|kl>)
!G_b(i,l) -= D_b (k,j)*(<ij|kl>)
enddo
else ! real part
do k2=1,4
if (ii(k2)==0) then
cycle
endif
i = ii(k2)
j = jj(k2)
k = kk(k2)
l = ll(k2)
print'((A),4(I4),1(E15.7),2(I))','real1 ',i,j,k,l,values(k1),k1,k2
enddo
endif
enddo
enddo
deallocate(keys,values)
call get_cache_map_n_elements_max(ao_integrals_map_2,n_elements_max)
allocate(keys(n_elements_max), values(n_elements_max))
do i8=0_8,ao_integrals_map_2%map_size
n_elements = n_elements_max
call get_cache_map(ao_integrals_map_2,i8,keys,values,n_elements)
do k1=1,n_elements
! get original key
! reverse of 2*key (imag part) and 2*key-1 (real part)
key1 = shiftr(keys(k1)+1,1)
call two_e_integrals_index_reverse_complex_2(ii,jj,kk,ll,key1)
! i>=k, j<=l, ik<=jl
! ijkl, jilk, klij*, lkji*
if (shiftl(key1,1)==keys(k1)) then !imaginary part
do k2=1,4
if (ii(k2)==0) then
cycle
endif
i = ii(k2)
j = jj(k2)
k = kk(k2)
l = ll(k2)
print'((A),4(I4),1(E15.7),2(I),2(E9.1))','imag2 ',i,j,k,l,values(k1),k1,k2,i_sign(k2)
enddo
else ! real part
do k2=1,4
if (ii(k2)==0) then
cycle
endif
i = ii(k2)
j = jj(k2)
k = kk(k2)
l = ll(k2)
print'((A),4(I4),1(E15.7),2(I))','real2 ',i,j,k,l,values(k1),k1,k2
enddo
endif
enddo
enddo
deallocate(keys,values)
end

View File

@ -0,0 +1,41 @@
program print_ao_1e_integrals
call run
end
subroutine run
use map_module
implicit none
integer :: i,j
write(*,'(A)') 'ao_one_e_integrals_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') ao_one_e_integrals_complex(i,:)
enddo
write(*,'(A)') 'ao_overlap_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') ao_overlap_complex(i,:)
enddo
write(*,'(A)') 's_inv_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') s_inv_complex(i,:)
enddo
write(*,'(A)') 's_half_inv_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') s_half_inv_complex(i,:)
enddo
write(*,'(A)') 's_half_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') s_half_complex(i,:)
enddo
write(*,'(A)') 'ao_ortho_canonical_coef_complex'
write(*,'(A)') '---------------'
do i=1,ao_num
write(*,'(200(E24.15))') ao_ortho_canonical_coef_complex(i,:)
enddo
end

View File

@ -0,0 +1,33 @@
program print_ao_2e_integrals
call run
end
subroutine run
use map_module
implicit none
integer ::i,j,k,l
provide ao_two_e_integrals_in_map
complex*16 :: get_ao_two_e_integral_periodic, tmp_cmplx
do i=1,ao_num
do j=1,ao_num
do k=1,ao_num
do l=1,ao_num
tmp_cmplx = get_ao_two_e_integral_periodic(i,j,k,l,ao_integrals_map,ao_integrals_map_2)
print'(4(I4),2(E15.7))',i,j,k,l,tmp_cmplx
enddo
enddo
enddo
enddo
print*,'map1'
do i=0,ao_integrals_map%map_size
print*,i,ao_integrals_map%map(i)%value(:)
print*,i,ao_integrals_map%map(i)%key(:)
enddo
print*,'map2'
do i=0,ao_integrals_map_2%map_size
print*,i,ao_integrals_map_2%map(i)%value(:)
print*,i,ao_integrals_map_2%map(i)%key(:)
enddo
end