10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-23 11:17:33 +02:00

L3 weight

This commit is contained in:
Anthony Scemama 2018-05-25 15:03:12 +02:00
parent de1791f9d6
commit 50b12bcacb
4 changed files with 43 additions and 32 deletions

View File

@ -1,26 +1,4 @@
use bitmasks
BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ]
implicit none
BEGIN_DOC
! Weight of the states in the selection : 1/(sum_i c_i^4)
END_DOC
integer :: i,k
double precision :: c
print *, 'Selection weights'
print *, '-----------------'
do i=1,N_states
selection_weight(i) = 0.d0
do k=1,N_det
c = psi_coef(k,i)*psi_coef(k,i)
selection_weight(i) = selection_weight(i) + c*abs(psi_coef(k,i))
enddo
selection_weight(i) = 1.d0/selection_weight(i)
print *, i, selection_weight(i)
enddo
print *, '-----------------'
END_PROVIDER
BEGIN_PROVIDER [ integer, fragment_count ]
implicit none
@ -654,7 +632,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
endif
e_pert = 0.5d0 * (tmp - delta_E)
pt2(istate) = pt2(istate) + e_pert
sum_e_pert = sum_e_pert + e_pert * selection_weight(istate)
sum_e_pert = sum_e_pert + e_pert * state_average_weight(istate)
end do
if(sum_e_pert <= buf%mini) then

View File

@ -40,6 +40,13 @@ doc: Force the wave function to be an eigenfunction of S^2
interface: ezfio,provider,ocaml
default: True
[use_l3_weight]
type: logical
doc: If true, set the state-averaged weight to 1/(Norm_L3(Psi))
interface: ezfio,provider,ocaml
default: False
[threshold_generators]
type: Threshold
doc: Thresholds on generators (fraction of the norm)

View File

@ -361,6 +361,28 @@ subroutine save_natural_mos
end
BEGIN_PROVIDER [ double precision, l3_weight, (N_states) ]
implicit none
BEGIN_DOC
! Weight of the states in the selection : 1/(sum_i c_i^4)
END_DOC
integer :: i,k
double precision :: c
do i=1,N_states
l3_weight(i) = 1.d-31
do k=1,N_det
c = psi_coef(k,i)*psi_coef(k,i)
l3_weight(i) = l3_weight(i) + c*abs(psi_coef(k,i))
enddo
l3_weight(i) = min(1.d0/l3_weight(i), 100.d0)
enddo
print *, 'L3 weights'
print *, '----------'
print *, l3_weight(1:N_states)
END_PROVIDER
BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ]
implicit none
BEGIN_DOC
@ -368,13 +390,17 @@ BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ]
END_DOC
logical :: exists
state_average_weight(:) = 1.d0
call ezfio_has_determinants_state_average_weight(exists)
if (exists) then
call ezfio_get_determinants_state_average_weight(state_average_weight)
if (use_l3_weight) then
state_average_weight(:) = l3_weight(:)
else
state_average_weight(:) = 1.d0
call ezfio_has_determinants_state_average_weight(exists)
if (exists) then
call ezfio_get_determinants_state_average_weight(state_average_weight)
endif
state_average_weight(:) = state_average_weight(:)+1.d-31
state_average_weight(:) = state_average_weight(:)/(sum(state_average_weight(:)))
endif
state_average_weight(:) = state_average_weight(:)+1.d-31
state_average_weight(:) = state_average_weight(:)/(sum(state_average_weight(:)))
END_PROVIDER

View File

@ -367,13 +367,13 @@ end
j = psi_bilinear_matrix_columns(k)
f = 0.d0
do l=1,N_states
f += psi_bilinear_matrix_values(k,l)*psi_bilinear_matrix_values(k,l)
f += psi_bilinear_matrix_values(k,l)*psi_bilinear_matrix_values(k,l) * state_average_weight(l)
enddo
det_alpha_norm(i) += f
det_beta_norm(j) += f
enddo
det_alpha_norm = det_alpha_norm / dble(N_states)
det_beta_norm = det_beta_norm / dble(N_states)
det_alpha_norm = det_alpha_norm
det_beta_norm = det_beta_norm
END_PROVIDER