10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 20:35:19 +01:00
This commit is contained in:
Anthony Scemama 2017-11-21 17:20:18 +01:00
parent 32614df72b
commit 66930be4c4
5 changed files with 53 additions and 36 deletions

View File

@ -65,25 +65,39 @@ subroutine dump_fci_iterations_value(n_determinants,energy,pt2)
energy_list(:,N_iterations) = energy(:) energy_list(:,N_iterations) = energy(:)
pt2_list(:,N_iterations) = pt2(:) pt2_list(:,N_iterations) = pt2(:)
print *, 'Extrapolation' if (N_iterations > 2) then
print *, '============='
do i=1,N_states
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,N_states
print *, 'State ', i
print *, '------------------'
print *, '' print *, ''
write(*,*) '=========== ', '===================' print *, 'Extrapolated energies'
write(*,*) 'minimum PT2 ', 'Extrapolated energy' print *, '====================='
write(*,*) '=========== ', '==================='
do k=2,min(N_iterations,8) do i=1, min(N_states,N_det)
write(*,'(F11.4,2X,F18.8)') pt2_list(i,N_iterations+1-k), extrapolated_energy(k,i) call extrapolate_data(N_iterations, energy_list(i,1:N_iterations), pt2_list(i,1:N_iterations), extrapolated_energy(1:N_iterations,i))
enddo enddo
write(*,*) '=========== ', '==================='
enddo do i=1, min(N_states,N_det)
print *, ''
print *, 'State ', i, ' : ', extrapolated_energy(min(N_iterations,3),i)
print *, '------------------'
print *, ''
write(*,*) '=========== ', '==================='
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
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)
enddo
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
! Reset the iteration number ! Reset the iteration number

View File

@ -14,7 +14,7 @@ program fci_zmq
relative_error=PT2_relative_error relative_error=PT2_relative_error
absolute_error=PT2_absolute_error absolute_error=PT2_absolute_error
pt2 = -huge(1.d0) pt2 = -huge(1.e0)
threshold_davidson_in = threshold_davidson threshold_davidson_in = threshold_davidson
threshold_davidson = threshold_davidson_in * 100.d0 threshold_davidson = threshold_davidson_in * 100.d0
SOFT_TOUCH threshold_davidson SOFT_TOUCH threshold_davidson
@ -40,12 +40,9 @@ program fci_zmq
print *, 'N_states = ', N_states print *, 'N_states = ', N_states
do k=1,N_states do k=1,N_states
print*,'State ',k print*,'State ',k
print *, 'PT2 = ', pt2(k)
print *, 'E = ', CI_energy(k) print *, 'E = ', CI_energy(k)
print *, 'E+PT2 = ', CI_energy(k) + pt2(k)
print *, '-----' print *, '-----'
enddo enddo
call dump_fci_iterations_value(N_det,CI_energy,pt2) ! This call automatically appends data
endif endif
@ -89,12 +86,11 @@ program fci_zmq
correlation_energy_ratio = min(1.d0,correlation_energy_ratio) correlation_energy_ratio = min(1.d0,correlation_energy_ratio)
print *, 'N_det = ', N_det print *, 'N_det = ', N_det
print *, 'N_states = ', N_states print *, 'N_states = ', N_states
print*, 'correlation_ratio = ', correlation_energy_ratio print*, 'correlation_ratio = ', correlation_energy_ratio
do k=1, N_states do k=1, min(N_states,N_det)
print*,'State ',k print*,'State ',k
print *, 'PT2 = ', pt2(k) print *, 'PT2 = ', pt2(k)
print *, 'E = ', CI_energy(k) print *, 'E = ', CI_energy(k)
@ -103,17 +99,16 @@ program fci_zmq
print *, '-----' print *, '-----'
if(N_states.gt.1)then if(N_states.gt.1)then
print*,'Variational Energy difference (au | eV)' print *, 'Variational Energy difference (au | eV)'
do i = 2, N_states do i=2, min(N_states,N_det)
print*,'Delta E = ', (CI_energy(i) - CI_energy(1)), & print*,'Delta E = ', (CI_energy(i) - CI_energy(1)), &
(CI_energy(i) - CI_energy(1)) * 27.2107362681d0 (CI_energy(i) - CI_energy(1)) * 27.211396641308d0
enddo enddo
endif print *, '-----'
if(N_states.gt.1)then print*, 'Variational + perturbative Energy difference (au | eV)'
print*,'Variational + perturbative Energy difference (au | eV)' do i=2, min(N_states,N_det)
do i = 2, N_states
print*,'Delta E = ', (CI_energy(i)+ pt2(i) - (CI_energy(1) + pt2(1))), & print*,'Delta E = ', (CI_energy(i)+ pt2(i) - (CI_energy(1) + pt2(1))), &
(CI_energy(i)+ pt2(i) - (CI_energy(1) + pt2(1))) * 27.2107362681d0 (CI_energy(i)+ pt2(i) - (CI_energy(1) + pt2(1))) * 27.211396641308d0
enddo enddo
endif endif
call ezfio_set_full_ci_zmq_energy_pt2(CI_energy(1)+pt2(1)) call ezfio_set_full_ci_zmq_energy_pt2(CI_energy(1)+pt2(1))
@ -162,7 +157,7 @@ program fci_zmq
print *, 'N_states = ', N_states print *, 'N_states = ', N_states
print*, 'correlation_ratio = ', correlation_energy_ratio print*, 'correlation_ratio = ', correlation_energy_ratio
do k=1, N_states do k=1, min(N_states,N_det)
print*,'State ',k print*,'State ',k
print *, 'PT2 = ', pt2(k) print *, 'PT2 = ', pt2(k)
print *, 'E = ', CI_energy(k) print *, 'E = ', CI_energy(k)
@ -174,4 +169,5 @@ program fci_zmq
end end

View File

@ -28,9 +28,10 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error)
double precision :: time double precision :: time
double precision :: w(N_states) double precision :: w(N_states)
if (N_det < 10) then if (N_det < max(10,N_states)) then
pt2=0.d0
call ZMQ_selection(0, pt2) call ZMQ_selection(0, pt2)
return error(:) = 0.d0
else else
do pt2_stoch_istate=1,N_states do pt2_stoch_istate=1,N_states
@ -120,6 +121,9 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error)
call update_psi_average_norm_contrib(w) call update_psi_average_norm_contrib(w)
SOFT_TOUCH psi_average_norm_contrib SOFT_TOUCH psi_average_norm_contrib
endif endif
do i=N_det+1,N_states
pt2(i) = 0.d0
enddo
end subroutine end subroutine

View File

@ -55,6 +55,9 @@ subroutine ZMQ_selection(N_in, pt2)
endif endif
!$OMP END PARALLEL !$OMP END PARALLEL
call end_parallel_job(zmq_to_qp_run_socket, 'selection') call end_parallel_job(zmq_to_qp_run_socket, 'selection')
do i=N_det+1,N_states
pt2(i) = 0.d0
enddo
if (N_in > 0) then if (N_in > 0) then
call fill_H_apply_buffer_no_selection(b%cur,b%det,N_int,0) call fill_H_apply_buffer_no_selection(b%cur,b%det,N_int,0)
call copy_H_apply_buffer_to_wf() call copy_H_apply_buffer_to_wf()

View File

@ -303,7 +303,7 @@ subroutine fill_H_apply_buffer_no_selection(n_selected,det_buffer,Nint,iproc)
enddo enddo
do j=1,N_states do j=1,N_states
do i=1,N_selected do i=1,N_selected
H_apply_buffer(iproc)%coef(i+H_apply_buffer(iproc)%N_det,j) = 1.e-8 H_apply_buffer(iproc)%coef(i+H_apply_buffer(iproc)%N_det,j) = 0.d0
enddo enddo
enddo enddo
H_apply_buffer(iproc)%N_det = new_size H_apply_buffer(iproc)%N_det = new_size