10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 12:23:48 +01:00

Final print

This commit is contained in:
Anthony Scemama 2017-11-22 16:21:16 +01:00
parent 66930be4c4
commit 38831926db
3 changed files with 112 additions and 45 deletions

View File

@ -66,37 +66,42 @@ subroutine dump_fci_iterations_value(n_determinants,energy,pt2)
pt2_list(:,N_iterations) = pt2(:)
if (N_iterations > 2) then
print *, ''
print *, 'Extrapolated energies'
print *, '====================='
write(*,'(A)') ''
write(*,'(A)') 'Extrapolated energies'
write(*,'(A)') '------------------------'
write(*,'(A)') ''
do i=1, min(N_states,N_det)
call extrapolate_data(N_iterations, energy_list(i,1:N_iterations), pt2_list(i,1:N_iterations), extrapolated_energy(1:N_iterations,i))
enddo
do i=1, min(N_states,N_det)
print *, ''
print *, 'State ', 1
print *, ''
write(*,*) '=========== ', '==================='
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
write(*,*) '=========== ', '==================='
do k=2,min(N_iterations,8)
write(*,'(F11.4,2X,F18.8)') pt2_list(1,N_iterations+1-k), extrapolated_energy(k,1)
enddo
write(*,*) '=========== ', '==================='
do i=2, min(N_states,N_det)
print *, ''
print *, 'State ', i, ' : ', extrapolated_energy(min(N_iterations,3),i)
print *, '------------------'
print *, 'State ', i
print *, ''
write(*,*) '=========== ', '==================='
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
write(*,*) '=========== ', '==================='
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
write(*,*) 'minimum PT2 ', 'Extrapolated energy ', ' Excitation (a.u) ', ' Excitation (eV) '
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
do k=2,min(N_iterations,8)
write(*,'(F11.4,2X,F18.8)') pt2_list(i,N_iterations+1-k), extrapolated_energy(k,i)
write(*,'(F11.4,X,3(X,F18.8))') pt2_list(i,N_iterations+1-k), extrapolated_energy(k,i), &
extrapolated_energy(k,i) - extrapolated_energy(k,1), &
(extrapolated_energy(k,i) - extrapolated_energy(k,1) ) * 27.211396641308d0
enddo
write(*,*) '=========== ', '==================='
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
enddo
print *, ''
if(N_states.gt.1)then
print *, 'Extrapolated Energy differences (au | eV)'
do i=2, min(N_states,N_det)
print*,'Delta E = ', extrapolated_energy(3,i) - extrapolated_energy(3,1), &
(extrapolated_energy(3,i) - extrapolated_energy(3,1) ) * 27.211396641308d0
enddo
print *, ''
endif
endif

View File

@ -11,6 +11,8 @@ program fci_zmq
double precision :: hf_energy_ref
logical :: has
double precision :: relative_error, absolute_error
integer :: N_states_p
relative_error=PT2_relative_error
absolute_error=PT2_absolute_error
@ -36,17 +38,9 @@ program fci_zmq
soft_touch N_det psi_det psi_coef
call diagonalize_CI
call save_wavefunction
print *, 'N_det = ', N_det
print *, 'N_states = ', N_states
do k=1,N_states
print*,'State ',k
print *, 'E = ', CI_energy(k)
print *, '-----'
enddo
N_states_p = min(N_det,N_states)
endif
print*,'Beginning the selection ...'
n_det_before = 0
character*(8) :: pt2_string
@ -64,6 +58,7 @@ program fci_zmq
(maxval(abs(pt2(1:N_states))) > pt2_max) .and. &
(correlation_energy_ratio <= correlation_energy_ratio_max) &
)
write(*,'(A)') '--------------------------------------------------------------------------------'
if (do_pt2) then
@ -85,12 +80,47 @@ program fci_zmq
(CI_energy(1) + pt2(1) - hf_energy_ref)
correlation_energy_ratio = min(1.d0,correlation_energy_ratio)
! print *, ''
! print '(A,I12)', 'Summary at N_det = ', N_det
! print '(A)', '-----------------------------------'
! print *, ''
! call write_double(6,correlation_energy_ratio, 'Correlation ratio')
! print *, ''
!
! character*(512) :: fmt
! N_states_p = min(N_det,N_states)
! print *, ''
! write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=========================''))'
! write(*,fmt)
! write(fmt,*) '(12X,', N_states_p, '(6X,A5,1X,I6,8X))'
! write(*,fmt) ('State',k, k=1,N_states_p)
! write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=========================''))'
! write(*,fmt)
! write(fmt,*) '(A12,', N_states_p, '(1X,F12.8,13X))'
! write(*,fmt) '# E ', CI_energy(1:N_states_p)
! if (N_states_p > 1) then
! write(*,fmt) '# Excit. (au)', CI_energy(1:N_states_p)-CI_energy(1)
! write(*,fmt) '# Excit. (eV)', (CI_energy(1:N_states_p)-CI_energy(1))*27.211396641308d0
! endif
! write(fmt,*) '(A12,', 2*N_states_p, '(1X,F12.8))'
! write(*,fmt) '# PT2'//pt2_string, (pt2(k), error(k), k=1,N_states_p)
! write(*,*) '#'
! write(*,fmt) '# E+PT2 ', (CI_energy(k)+pt2(k),error(k), k=1,N_states_p)
! if (N_states_p > 1) then
! write(*,fmt) '# Excit. (au)', ( (CI_energy(k)+pt2(k)-CI_energy(1)-pt2(1)), &
! dsqrt(error(k)*error(k)+error(1)*error(1)), k=1,N_states_p)
! write(*,fmt) '# Excit. (eV)', ( (CI_energy(k)+pt2(k)-CI_energy(1)-pt2(1))*27.211396641308d0, &
! dsqrt(error(k)*error(k)+error(1)*error(1))*27.211396641308d0, k=1,N_states_p)
! endif
! write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=========================''))'
! write(*,fmt)
! print *, ''
print *, 'N_det = ', N_det
print *, 'N_states = ', N_states
print*, 'correlation_ratio = ', correlation_energy_ratio
do k=1, min(N_states,N_det)
do k=1, N_states_p
print*,'State ',k
print *, 'PT2 = ', pt2(k)
print *, 'E = ', CI_energy(k)
@ -100,13 +130,13 @@ program fci_zmq
print *, '-----'
if(N_states.gt.1)then
print *, 'Variational Energy difference (au | eV)'
do i=2, min(N_states,N_det)
do i=2, N_states_p
print*,'Delta E = ', (CI_energy(i) - CI_energy(1)), &
(CI_energy(i) - CI_energy(1)) * 27.211396641308d0
enddo
print *, '-----'
print*, 'Variational + perturbative Energy difference (au | eV)'
do i=2, min(N_states,N_det)
do i=2, N_states_p
print*,'Delta E = ', (CI_energy(i)+ pt2(i) - (CI_energy(1) + pt2(1))), &
(CI_energy(i)+ pt2(i) - (CI_energy(1) + pt2(1))) * 27.211396641308d0
enddo
@ -115,9 +145,15 @@ program fci_zmq
call dump_fci_iterations_value(N_det,CI_energy,pt2)
n_det_before = N_det
to_select = N_det
to_select = max(N_det, to_select)
to_select = min(to_select, N_det_max-n_det_before)
if (s2_eig) then
to_select = N_det/2+1
to_select = max(N_det/2+1, to_select)
to_select = min(to_select, N_det_max-n_det_before)
else
to_select = N_det
to_select = max(N_det, to_select)
to_select = min(to_select, N_det_max-n_det_before)
endif
call ZMQ_selection(to_select, pt2)
PROVIDE psi_coef
@ -157,16 +193,44 @@ program fci_zmq
print *, 'N_states = ', N_states
print*, 'correlation_ratio = ', correlation_energy_ratio
do k=1, min(N_states,N_det)
print*,'State ',k
print *, 'PT2 = ', pt2(k)
print *, 'E = ', CI_energy(k)
print *, 'E+PT2'//pt2_string//' = ', CI_energy(k)+pt2(k), ' +/- ', error(k)
enddo
print *, '-----'
call dump_fci_iterations_value(N_det,CI_energy,pt2)
print *, ''
print '(A,I12)', 'Summary at N_det = ', N_det
print '(A)', '-----------------------------------'
print *, ''
call write_double(6,correlation_energy_ratio, 'Correlation ratio')
print *, ''
N_states_p = min(N_det,N_states)
print *, ''
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=========================''))'
write(*,fmt)
write(fmt,*) '(12X,', N_states_p, '(6X,A5,1X,I6,8X))'
write(*,fmt) ('State',k, k=1,N_states_p)
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=========================''))'
write(*,fmt)
write(fmt,*) '(A12,', N_states_p, '(1X,F12.8,13X))'
write(*,fmt) '# E ', CI_energy(1:N_states_p)
if (N_states_p > 1) then
write(*,fmt) '# Excit. (au)', CI_energy(1:N_states_p)-CI_energy(1)
write(*,fmt) '# Excit. (eV)', (CI_energy(1:N_states_p)-CI_energy(1))*27.211396641308d0
endif
write(fmt,*) '(A12,', 2*N_states_p, '(1X,F12.8))'
write(*,fmt) '# PT2'//pt2_string, (pt2(k), error(k), k=1,N_states_p)
write(*,*) '#'
write(*,fmt) '# E+PT2 ', (CI_energy(k)+pt2(k),error(k), k=1,N_states_p)
if (N_states_p > 1) then
write(*,fmt) '# Excit. (au)', ( (CI_energy(k)+pt2(k)-CI_energy(1)-pt2(1)), &
dsqrt(error(k)*error(k)+error(1)*error(1)), k=1,N_states_p)
write(*,fmt) '# Excit. (eV)', ( (CI_energy(k)+pt2(k)-CI_energy(1)-pt2(1))*27.211396641308d0, &
dsqrt(error(k)*error(k)+error(1)*error(1))*27.211396641308d0, k=1,N_states_p)
endif
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=========================''))'
write(*,fmt)
print *, ''

View File

@ -35,9 +35,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error)
else
do pt2_stoch_istate=1,N_states
if (pt2_stoch_istate > 1) then
SOFT_TOUCH pt2_stoch_istate
endif
SOFT_TOUCH pt2_stoch_istate
w(:) = 0.d0
w(pt2_stoch_istate) = 1.d0
call update_psi_average_norm_contrib(w)