From 6455b281ffc4a866f2f22232e2961105316a5c64 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Jun 2019 11:42:55 +0200 Subject: [PATCH] Compiles --- src/cipsi/pt2_stoch_routines.irp.f | 2 +- src/cipsi/selection.irp.f | 24 +++++++++++++----------- src/cipsi/zmq_selection.irp.f | 14 ++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/cipsi/pt2_stoch_routines.irp.f b/src/cipsi/pt2_stoch_routines.irp.f index 994b98f3..d101c6e0 100644 --- a/src/cipsi/pt2_stoch_routines.irp.f +++ b/src/cipsi/pt2_stoch_routines.irp.f @@ -333,7 +333,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) pt2(k) = 0.d0 enddo - call update_pt2_and_variance_weights(pt2, variance, norm) + call update_pt2_and_variance_weights(pt2, variance, norm, N_states) end subroutine diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index ba2caa1b..4b527874 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -6,7 +6,7 @@ BEGIN_PROVIDER [ double precision, pt2_match_weight, (N_states) ] ! Weights adjusted along the selection to make the PT2 contributions ! of each state coincide. END_DOC - pt2_match_weight = 1.d0 + pt2_match_weight(:) = 1.d0 END_PROVIDER BEGIN_PROVIDER [ double precision, variance_match_weight, (N_states) ] @@ -15,10 +15,10 @@ BEGIN_PROVIDER [ double precision, variance_match_weight, (N_states) ] ! Weights adjusted along the selection to make the variances ! of each state coincide. END_DOC - variance_match_weight = 1.d0 + variance_match_weight(:) = 1.d0 END_PROVIDER -subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_states) +subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st) implicit none BEGIN_DOC ! Updates the rPT2- and Variance- matching weights. @@ -36,12 +36,12 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_states) enddo avg = sum(rpt2(1:N_st)) / dble(N_st) - do k=1,N_states + do k=1,N_st pt2_match_weight(k) *= (rpt2(k)/avg)**2 enddo avg = sum(variance(1:N_st)) / dble(N_st) - do k=1,N_states + do k=1,N_st variance_match_weight(k) *= (variance(k)/avg)**2 enddo @@ -54,10 +54,10 @@ BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ] BEGIN_DOC ! Weights used in the selection criterion END_DOC - select (weight_selection) + select case (weight_selection) case (0) - selection_weight(1:N_states) = weight_one_e_dm(1:N_states) + selection_weight(1:N_states) = state_average_weight(1:N_states) case (1) selection_weight(1:N_states) = c0_weight(1:N_states) @@ -682,11 +682,13 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d variance(istate) = variance(istate) + alpha_h_psi * alpha_h_psi norm(istate) = norm(istate) + coef * coef -! if (h0_type == "Variance") then -! sum_e_pert = sum_e_pert - alpha_h_psi * alpha_h_psi * selection_weight(istate) -! else + if (weight_selection /= 5) then + ! Energy selection sum_e_pert = sum_e_pert + e_pert * selection_weight(istate) -! endif + else + ! Variance selection + sum_e_pert = sum_e_pert - alpha_h_psi * alpha_h_psi * selection_weight(istate) + endif end do if(pseudo_sym)then if(dabs(mat(1, p1, p2)).lt.thresh_sym)then diff --git a/src/cipsi/zmq_selection.irp.f b/src/cipsi/zmq_selection.irp.f index c7c11eec..b9bd1d02 100644 --- a/src/cipsi/zmq_selection.irp.f +++ b/src/cipsi/zmq_selection.irp.f @@ -85,7 +85,11 @@ subroutine ZMQ_selection(N_in, pt2, variance, norm) endif integer :: nproc_target - nproc_target = nproc + if (N_det < 3*nproc) then + nproc_target = N_det/3 + else + nproc_target = nproc + endif double precision :: mem mem = 8.d0 * N_det * (N_int * 2.d0 * 3.d0 + 3.d0 + 5.d0) / (1024.d0**3) call write_double(6,mem,'Estimated memory/thread (Gb)') @@ -131,13 +135,7 @@ subroutine ZMQ_selection(N_in, pt2, variance, norm) norm(k) = norm(k) * f(k) enddo - ! Adjust PT2 weights for next selection - double precision :: pt2_avg - pt2_avg = sum(pt2) / dble(N_states) - do k=1,N_states - pt2_match_weight(k) *= (pt2(k)/pt2_avg)**2 - enddo - SOFT_TOUCH pt2_match_weight + call update_pt2_and_variance_weights(pt2, variance, norm, N_states) end subroutine