10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-26 06:14:43 +01:00

Merge branch 'alpha_factory' of https://github.com/garniron/quantum_package into garniron-alpha_factory

This commit is contained in:
Anthony Scemama 2018-05-23 13:18:48 +02:00
commit e09660ad34
5 changed files with 39 additions and 15 deletions

View File

@ -323,7 +323,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_
eqt = 0.d0 eqt = 0.d0
endif endif
call wall_time(time) call wall_time(time)
if ( (dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error) .and. Nabove(tooth) >= 30) then if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 30) then
! Termination ! Termination
pt2(pt2_stoch_istate) = avg pt2(pt2_stoch_istate) = avg
error(pt2_stoch_istate) = eqt error(pt2_stoch_istate) = eqt

View File

@ -13,7 +13,7 @@ BEGIN_PROVIDER [ integer, N_det_generators ]
N_det_generators = N_det N_det_generators = N_det
do i=1,N_det do i=1,N_det
norm = norm + psi_average_norm_contrib_sorted(i) norm = norm + psi_average_norm_contrib_sorted(i)
if (norm >= threshold_generators) then if (norm > threshold_generators+1d-10) then
N_det_generators = i N_det_generators = i
exit exit
endif endif

View File

@ -229,6 +229,7 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2,
pullLoop : do while (loop) pullLoop : do while (loop)
call pull_dress_results(zmq_socket_pull, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, dress_mwen) call pull_dress_results(zmq_socket_pull, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, dress_mwen)
!print *, cur_cp, ind
if(floop) then if(floop) then
call wall_time(time) call wall_time(time)
print *, "first_pull", time-time0 print *, "first_pull", time-time0
@ -439,7 +440,7 @@ END_PROVIDER
end if end if
!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!
if(.FALSE.) then if(.TRUE.) then
do l=first_suspect,N_det_generators do l=first_suspect,N_det_generators
if((.not. computed(l))) then if((.not. computed(l))) then
N_dress_jobs+=1 N_dress_jobs+=1
@ -629,7 +630,6 @@ subroutine add_comb(com, computed, cp, N, tbc)
!DIR$ FORCEINLINE !DIR$ FORCEINLINE
call get_comb(com, dets) call get_comb(com, dets)
k=N+1 k=N+1
do i = 1, comb_teeth do i = 1, comb_teeth
l = dets(i) l = dets(i)
@ -690,10 +690,11 @@ END_PROVIDER
norm_left = 1d0 norm_left = 1d0
comb_step = 1d0/dfloat(comb_teeth) comb_step = 1d0/dfloat(comb_teeth)
!print *, "comb_step", comb_step
first_det_of_comb = 1 first_det_of_comb = 1
do i=1,min(100,N_det_generators) do i=1,N_det_generators ! min(100,N_det_generators)
first_det_of_comb = i
if(dress_weight(i)/norm_left < comb_step) then if(dress_weight(i)/norm_left < comb_step) then
first_det_of_comb = i
exit exit
end if end if
norm_left -= dress_weight(i) norm_left -= dress_weight(i)

View File

@ -137,3 +137,22 @@ subroutine sort_selection_buffer(b)
b%cur = nmwen b%cur = nmwen
end subroutine end subroutine
subroutine truncate_to_mini(b)
use selection_types
implicit none
type(selection_buffer), intent(inout) :: b
do
if(b%cur == 0) exit
if(b%val(b%cur) <= b%mini) exit
b%cur -= 1
end do
end subroutine

View File

@ -54,22 +54,26 @@ subroutine generator_done(i_gen, int_buf, double_buf, det_buf, N_buf, iproc)
int_buf(:) = 0 int_buf(:) = 0
call sort_selection_buffer(sb(iproc)) call sort_selection_buffer(sb(iproc))
det_buf(:,:,:sb(iproc)%cur) = sb(iproc)%det(:,:,:sb(iproc)%cur)
double_buf(:sb(iproc)%cur) = sb(iproc)%val(:sb(iproc)%cur)
double_buf(sb(iproc)%cur+1:sb(iproc)%cur+N_states) = slave_sum_alpha2(:,iproc)
N_buf(1) = 1
N_buf(2) = sb(iproc)%cur+N_states
N_buf(3) = sb(iproc)%cur
if(sb(iproc)%cur > 0) then if(sb(iproc)%cur > 0) then
!$OMP CRITICAL !$OMP CRITICAL
call merge_selection_buffers(sb(iproc), mini_sb) call merge_selection_buffers(sb(iproc), mini_sb)
!call sort_selection_buffer(mini_sb) !call sort_selection_buffer(mini_sb)
do i=1,Nproc do i=1,Nproc
sb(i)%mini = min(sb(i)%mini, mini_sb%mini) mini_sb%mini = min(sb(i)%mini, mini_sb%mini)
end do
do i=1,Nproc
sb(i)%mini = mini_sb%mini
end do end do
!$OMP END CRITICAL !$OMP END CRITICAL
end if end if
call truncate_to_mini(sb(iproc))
det_buf(:,:,:sb(iproc)%cur) = sb(iproc)%det(:,:,:sb(iproc)%cur)
double_buf(:sb(iproc)%cur) = sb(iproc)%val(:sb(iproc)%cur)
double_buf(sb(iproc)%cur+1:sb(iproc)%cur+N_states) = slave_sum_alpha2(:,iproc)
N_buf(1) = 1
N_buf(2) = sb(iproc)%cur+N_states
N_buf(3) = sb(iproc)%cur
sb(iproc)%cur = 0 sb(iproc)%cur = 0
slave_sum_alpha2(:,iproc) = 0d0 slave_sum_alpha2(:,iproc) = 0d0