From 66930be4c42d2e8d5c69bc078ec353e2d3001c96 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 21 Nov 2017 17:20:18 +0100 Subject: [PATCH] Print --- .../dump_fci_iterations_value.irp.f | 50 ++++++++++++------- plugins/Full_CI_ZMQ/fci_zmq.irp.f | 26 ++++------ plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 8 ++- plugins/Full_CI_ZMQ/zmq_selection.irp.f | 3 ++ src/Determinants/H_apply.irp.f | 2 +- 5 files changed, 53 insertions(+), 36 deletions(-) diff --git a/plugins/Full_CI_ZMQ/dump_fci_iterations_value.irp.f b/plugins/Full_CI_ZMQ/dump_fci_iterations_value.irp.f index 515cd8ff..16a646b4 100644 --- a/plugins/Full_CI_ZMQ/dump_fci_iterations_value.irp.f +++ b/plugins/Full_CI_ZMQ/dump_fci_iterations_value.irp.f @@ -65,26 +65,40 @@ subroutine dump_fci_iterations_value(n_determinants,energy,pt2) energy_list(:,N_iterations) = energy(:) pt2_list(:,N_iterations) = pt2(:) - print *, 'Extrapolation' - 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 *, '------------------' + if (N_iterations > 2) then 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) + print *, 'Extrapolated energies' + print *, '=====================' + + 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 - 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 call ezfio_set_full_ci_zmq_n_iter(N_iterations) diff --git a/plugins/Full_CI_ZMQ/fci_zmq.irp.f b/plugins/Full_CI_ZMQ/fci_zmq.irp.f index d282a18f..667e8342 100644 --- a/plugins/Full_CI_ZMQ/fci_zmq.irp.f +++ b/plugins/Full_CI_ZMQ/fci_zmq.irp.f @@ -14,7 +14,7 @@ program fci_zmq relative_error=PT2_relative_error absolute_error=PT2_absolute_error - pt2 = -huge(1.d0) + pt2 = -huge(1.e0) threshold_davidson_in = threshold_davidson threshold_davidson = threshold_davidson_in * 100.d0 SOFT_TOUCH threshold_davidson @@ -40,12 +40,9 @@ program fci_zmq print *, 'N_states = ', N_states do k=1,N_states print*,'State ',k - print *, 'PT2 = ', pt2(k) print *, 'E = ', CI_energy(k) - print *, 'E+PT2 = ', CI_energy(k) + pt2(k) print *, '-----' enddo - call dump_fci_iterations_value(N_det,CI_energy,pt2) ! This call automatically appends data endif @@ -89,12 +86,11 @@ program fci_zmq correlation_energy_ratio = min(1.d0,correlation_energy_ratio) - print *, 'N_det = ', N_det print *, 'N_states = ', N_states print*, 'correlation_ratio = ', correlation_energy_ratio - do k=1, N_states + do k=1, min(N_states,N_det) print*,'State ',k print *, 'PT2 = ', pt2(k) print *, 'E = ', CI_energy(k) @@ -103,17 +99,16 @@ program fci_zmq print *, '-----' if(N_states.gt.1)then - print*,'Variational Energy difference (au | eV)' - do i = 2, N_states + print *, 'Variational Energy difference (au | eV)' + do i=2, min(N_states,N_det) 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 - endif - if(N_states.gt.1)then - print*,'Variational + perturbative Energy difference (au | eV)' - do i = 2, N_states + print *, '-----' + print*, 'Variational + perturbative Energy difference (au | eV)' + do i=2, min(N_states,N_det) 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 endif 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*, 'correlation_ratio = ', correlation_energy_ratio - do k=1, N_states + do k=1, min(N_states,N_det) print*,'State ',k print *, 'PT2 = ', pt2(k) print *, 'E = ', CI_energy(k) @@ -174,4 +169,5 @@ program fci_zmq + end diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index a4510e1f..f371598a 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -28,9 +28,10 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) double precision :: time 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) - return + error(:) = 0.d0 else 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) SOFT_TOUCH psi_average_norm_contrib endif + do i=N_det+1,N_states + pt2(i) = 0.d0 + enddo end subroutine diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 2628fb5a..700ee0e7 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -55,6 +55,9 @@ subroutine ZMQ_selection(N_in, pt2) endif !$OMP END PARALLEL 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 call fill_H_apply_buffer_no_selection(b%cur,b%det,N_int,0) call copy_H_apply_buffer_to_wf() diff --git a/src/Determinants/H_apply.irp.f b/src/Determinants/H_apply.irp.f index f2243d25..ef396f9c 100644 --- a/src/Determinants/H_apply.irp.f +++ b/src/Determinants/H_apply.irp.f @@ -303,7 +303,7 @@ subroutine fill_H_apply_buffer_no_selection(n_selected,det_buffer,Nint,iproc) enddo do j=1,N_states 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 H_apply_buffer(iproc)%N_det = new_size