From 122650e6d9e7f5ff018c5fea7ad80310f6b687b1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 15 May 2019 12:29:39 +0200 Subject: [PATCH] Dynamic weights for better selection --- src/cipsi/pt2_stoch_routines.irp.f | 8 ++++++++ src/cipsi/selection.irp.f | 11 ++++++++++- src/cipsi/zmq_selection.irp.f | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/cipsi/pt2_stoch_routines.irp.f b/src/cipsi/pt2_stoch_routines.irp.f index bf78bb21..a8f34e03 100644 --- a/src/cipsi/pt2_stoch_routines.irp.f +++ b/src/cipsi/pt2_stoch_routines.irp.f @@ -333,6 +333,14 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in) pt2(k) = 0.d0 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 + end subroutine diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index 0603203d..eedcd67f 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -1,11 +1,20 @@ use bitmasks +BEGIN_PROVIDER [ double precision, pt2_match_weight, (N_states) ] + implicit none + BEGIN_DOC + ! Weights adjusted along the selection to make the PT2 contributions + ! of each state coincide. + END_DOC + pt2_match_weight = 1.d0 +END_PROVIDER + BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ] implicit none BEGIN_DOC ! Weights used in the selection criterion END_DOC - selection_weight(1:N_states) = c0_weight(1:N_states) + selection_weight(1:N_states) = c0_weight(1:N_states) * pt2_match_weight(1:N_states) END_PROVIDER diff --git a/src/cipsi/zmq_selection.irp.f b/src/cipsi/zmq_selection.irp.f index 1b9d6011..c7c11eec 100644 --- a/src/cipsi/zmq_selection.irp.f +++ b/src/cipsi/zmq_selection.irp.f @@ -131,6 +131,14 @@ 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 + end subroutine