10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-21 12:42:17 +02:00

Dynamic weights for better selection

This commit is contained in:
Anthony Scemama 2019-05-15 12:29:39 +02:00
parent 89843eaf0b
commit 122650e6d9
3 changed files with 26 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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