9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-07-11 13:43:34 +02:00

Merge pull request #100 from QuantumPackage/dev

Dev
This commit is contained in:
Emmanuel Giner 2020-04-06 00:52:26 +02:00 committed by GitHub
commit 659d095a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 27 deletions

View File

@ -32,7 +32,7 @@ OPENMP : 1 ; Append OpenMP flags
# #
[OPT] [OPT]
FC : -traceback FC : -traceback
FCFLAGS : -mavx -axAVX -O2 -ip -ftz -g FCFLAGS : -mavx -O2 -ip -ftz -g
# Profiling flags # Profiling flags
################# #################

View File

@ -885,7 +885,9 @@ let run ~port =
Zmq.Socket.send pair_socket @@ string_of_pub_state Stopped; Zmq.Socket.send pair_socket @@ string_of_pub_state Stopped;
Thread.join pub_thread; Thread.join pub_thread;
Zmq.Socket.close rep_socket Zmq.Socket.close pair_socket;
Zmq.Socket.close rep_socket;
Zmq.Context.terminate zmq_context

View File

@ -115,6 +115,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull
integer, intent(in) :: N_in integer, intent(in) :: N_in
! integer, intent(inout) :: N_in
double precision, intent(in) :: relative_error, E(N_states) double precision, intent(in) :: relative_error, E(N_states)
double precision, intent(out) :: pt2(N_states),error(N_states) double precision, intent(out) :: pt2(N_states),error(N_states)
double precision, intent(out) :: variance(N_states),norm(N_states) double precision, intent(out) :: variance(N_states),norm(N_states)
@ -136,7 +137,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
PROVIDE psi_occ_pattern_hii det_to_occ_pattern PROVIDE psi_occ_pattern_hii det_to_occ_pattern
endif endif
if (N_det <= max(4,N_states)) then if (N_det <= max(4,N_states) .or. pt2_N_teeth < 2) then
pt2=0.d0 pt2=0.d0
variance=0.d0 variance=0.d0
norm=0.d0 norm=0.d0

View File

@ -99,6 +99,17 @@ subroutine run_selection_slave(thread,iproc,energy)
ctask = ctask + 1 ctask = ctask + 1
end do end do
if(ctask > 0) then
call sort_selection_buffer(buf)
! call merge_selection_buffers(buf,buf2)
call push_selection_results(zmq_socket_push, pt2, variance, norm, buf, task_id(1), ctask)
! buf%mini = buf2%mini
pt2(:) = 0d0
variance(:) = 0d0
norm(:) = 0d0
buf%cur = 0
end if
ctask = 0
integer, external :: disconnect_from_taskserver integer, external :: disconnect_from_taskserver
if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then

View File

@ -52,7 +52,7 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st)
rpt2(k) = pt2(k)/(1.d0 + norm(k)) rpt2(k) = pt2(k)/(1.d0 + norm(k))
enddo enddo
avg = sum(rpt2(1:N_st)) / dble(N_st) avg = sum(rpt2(1:N_st)) / dble(N_st) - 1.d-32 ! Avoid future division by zero
do k=1,N_st do k=1,N_st
element = exp(dt*(rpt2(k)/avg -1.d0)) element = exp(dt*(rpt2(k)/avg -1.d0))
element = min(1.5d0 , element) element = min(1.5d0 , element)
@ -61,7 +61,7 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st)
pt2_match_weight(k) = product(memo_pt2(k,:)) pt2_match_weight(k) = product(memo_pt2(k,:))
enddo enddo
avg = sum(variance(1:N_st)) / dble(N_st) avg = sum(variance(1:N_st)) / dble(N_st) + 1.d-32 ! Avoid future division by zero
do k=1,N_st do k=1,N_st
element = exp(dt*(variance(k)/avg -1.d0)) element = exp(dt*(variance(k)/avg -1.d0))
element = min(1.5d0 , element) element = min(1.5d0 , element)
@ -325,7 +325,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
i = psi_bilinear_matrix_rows(l_a) i = psi_bilinear_matrix_rows(l_a)
if (nt + exc_degree(i) <= 4) then if (nt + exc_degree(i) <= 4) then
idx = psi_det_sorted_order(psi_bilinear_matrix_order(l_a)) idx = psi_det_sorted_order(psi_bilinear_matrix_order(l_a))
if (psi_average_norm_contrib_sorted(idx) > 1.d-12) then if (psi_average_norm_contrib_sorted(idx) > 0.d0) then
indices(k) = idx indices(k) = idx
k=k+1 k=k+1
endif endif
@ -349,7 +349,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
idx = psi_det_sorted_order( & idx = psi_det_sorted_order( &
psi_bilinear_matrix_order( & psi_bilinear_matrix_order( &
psi_bilinear_matrix_transp_order(l_a))) psi_bilinear_matrix_transp_order(l_a)))
if (psi_average_norm_contrib_sorted(idx) > 1.d-12) then if (psi_average_norm_contrib_sorted(idx) > 0.d0) then
indices(k) = idx indices(k) = idx
k=k+1 k=k+1
endif endif