From 18d8d45cfc7c41809d20b8ed7c93c3dca7eda9ed Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 15 May 2020 15:20:54 +0200 Subject: [PATCH 1/3] Match PT2 instead of rPT2 --- src/cipsi/selection.irp.f | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index cf5b9965..551bd54f 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -29,7 +29,7 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st) double precision, intent(in) :: variance(N_st) double precision, intent(in) :: norm(N_st) - double precision :: avg, pt2_rpt2(N_st), element, dt, x + double precision :: avg, rpt2(N_st), element, dt, x integer :: k integer, save :: i_iter=0 integer, parameter :: i_itermax = 1 @@ -49,13 +49,13 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st) dt = 1.0d0 do k=1,N_st - ! PT2 + rPT2 - pt2_rpt2(k) = pt2(k)* (1.d0 + 1.d0/(1.d0 + norm(k))) + ! rPT2 + rpt2(k) = pt2(k)* (1.d0 + 1.d0/(1.d0 + norm(k))) enddo - avg = sum(pt2_rpt2(1:N_st)) / dble(N_st) - 1.d-32 ! Avoid future division by zero + avg = sum(pt2(1:N_st)) / dble(N_st) - 1.d-32 ! Avoid future division by zero do k=1,N_st - element = exp(dt*(pt2_rpt2(k)/avg -1.d0)) + element = exp(dt*(pt2(k)/avg -1.d0)) element = min(2.0d0 , element) element = max(0.5d0 , element) memo_pt2(k,i_iter) = element From 0776f88604250b6249e33066d528d542413b55c2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 15 May 2020 15:26:15 +0200 Subject: [PATCH 2/3] Put back psi_average_norm_contrib_sorted in selection, but with 1.d-20 --- src/cipsi/selection.irp.f | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index 551bd54f..a8646627 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -326,7 +326,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d i = psi_bilinear_matrix_rows(l_a) if (nt + exc_degree(i) <= 4) then idx = psi_det_sorted_order(psi_bilinear_matrix_order(l_a)) - if (psi_average_norm_contrib_sorted(idx) > 0.d0) then + if (psi_average_norm_contrib_sorted(idx) > 1.d-20) then indices(k) = idx k=k+1 endif @@ -350,7 +350,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d idx = psi_det_sorted_order( & psi_bilinear_matrix_order( & psi_bilinear_matrix_transp_order(l_a))) - if (psi_average_norm_contrib_sorted(idx) > 0.d0) then + if (psi_average_norm_contrib_sorted(idx) > 1.d-20) then indices(k) = idx k=k+1 endif From d4bebb07bc31e5d41d42cd794aa510dc77db353a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 15 May 2020 15:57:34 +0200 Subject: [PATCH 3/3] Tuned selection --- src/cipsi/selection.irp.f | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index a8646627..f6350a66 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -46,11 +46,11 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st) i_iter = 1 endif - dt = 1.0d0 + dt = 2.0d0 do k=1,N_st ! rPT2 - rpt2(k) = pt2(k)* (1.d0 + 1.d0/(1.d0 + norm(k))) + rpt2(k) = pt2(k)/(1.d0 + norm(k)) enddo avg = sum(pt2(1:N_st)) / dble(N_st) - 1.d-32 ! Avoid future division by zero @@ -71,6 +71,12 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st) variance_match_weight(k) *= product(memo_variance(k,:)) enddo + if (N_det < 100) then + ! For tiny wave functions, weights are 1.d0 + pt2_match_weight(:) = 1.d0 + variance_match_weight(:) = 1.d0 + endif + threshold_davidson_pt2 = min(1.d-6, & max(threshold_davidson, 1.e-1 * PT2_relative_error * minval(abs(pt2(1:N_states)))) )