10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-29 16:34:50 +02:00

Introduced PT2stoch

This commit is contained in:
Anthony Scemama 2017-03-13 00:26:21 +01:00
parent 7c8201a950
commit fce537fea9
4 changed files with 23 additions and 13 deletions

View File

@ -104,8 +104,9 @@ program fci_zmq
E_CI_before(1:N_states) = CI_energy(1:N_states) E_CI_before(1:N_states) = CI_energy(1:N_states)
double precision :: relative_error double precision :: relative_error
relative_error=1.d-3 relative_error=1.d-3
!call ZMQ_pt2(pt2,relative_error) pt2 = 0.d0
call ZMQ_selection(0, pt2)! pour non-stochastic call ZMQ_pt2(pt2,relative_error)
!call ZMQ_selection(0, pt2)! pour non-stochastic
print *, 'Final step' print *, 'Final step'
print *, 'N_det = ', N_det print *, 'N_det = ', N_det
print *, 'N_states = ', N_states print *, 'N_states = ', N_states

View File

@ -25,6 +25,7 @@ subroutine run
SOFT_TOUCH pt2_e0_denominator read_wf SOFT_TOUCH pt2_e0_denominator read_wf
endif endif
allocate (pt2(N_states)) allocate (pt2(N_states))
pt2 = 0.d0
threshold_selectors = 1.d0 threshold_selectors = 1.d0
threshold_generators = 1d0 threshold_generators = 1d0

View File

@ -46,7 +46,7 @@ subroutine ZMQ_pt2(pt2,relative_error)
pt2_detail = 0d0 pt2_detail = 0d0
time0 = omp_get_wtime() time0 = omp_get_wtime()
print *, "grep - time - avg - err - n_combs" print *, "time - avg - err - n_combs"
generator_per_task = 1 generator_per_task = 1
do while(.true.) do while(.true.)
@ -270,13 +270,14 @@ subroutine pt2_collector(b, tbc, comb, Ncomb, computed, pt2_detail, sumabove, su
avg = E0 + (sumabove(tooth) / Nabove(tooth)) avg = E0 + (sumabove(tooth) / Nabove(tooth))
eqt = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) eqt = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2))
time = omp_get_wtime() time = omp_get_wtime()
print "(A, 4(E20.13), 4(I9))", "PT2stoch ", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth) print "(3(E22.13), 4(I9))", "PT2stoch ", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth)
if (dabs(eqt/avg) < relative_error) then if (dabs(eqt/avg) < relative_error) then
pt2(1) = avg pt2(1) = avg
exit pullLoop exit pullLoop
endif endif
end if end if
end do pullLoop end do pullLoop
print "(3(E22.13), 4(I9))", "PT2stoch ", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth)
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
@ -422,7 +423,6 @@ subroutine get_filling_teeth(computed, tbc)
tbc(k) = j tbc(k) = j
k=k+1 k=k+1
computed(j) = .true. computed(j) = .true.
! print *, "filled ", j, "to reach tooth", last_full, "ending at", first_det_of_teeth(last_full+1)
end if end if
end do end do
tbc(0) = k-1 tbc(0) = k-1

View File

@ -32,6 +32,7 @@ subroutine run_wf
zmq_context = f77_zmq_ctx_new () zmq_context = f77_zmq_ctx_new ()
states(1) = 'selection' states(1) = 'selection'
states(2) = 'davidson' states(2) = 'davidson'
states(3) = 'pt2'
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
force_update = .True. force_update = .True.
@ -54,7 +55,7 @@ subroutine run_wf
!$OMP PARALLEL PRIVATE(i) !$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num() i = omp_get_thread_num()
call selection_slave_tcp(i, energy) call run_selection_slave(0,i,energy)
!$OMP END PARALLEL !$OMP END PARALLEL
print *, 'Selection done' print *, 'Selection done'
@ -72,17 +73,24 @@ subroutine run_wf
!$OMP END PARALLEL !$OMP END PARALLEL
print *, 'Davidson done' print *, 'Davidson done'
else if (trim(zmq_state) == 'pt2') then
! Selection
! ---------
print *, 'PT2'
call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states)
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
call run_pt2_slave(0,i,energy)
!$OMP END PARALLEL
print *, 'PT2 done'
endif endif
end do end do
end end
subroutine selection_slave_tcp(i,energy)
implicit none
double precision, intent(in) :: energy(N_states)
integer, intent(in) :: i
call run_selection_slave(0,i,energy)
end