10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00

FCI stops exactly at the required number of determinants

This commit is contained in:
Anthony Scemama 2016-11-22 12:55:42 +01:00
parent f326801e56
commit c2a7d25615
2 changed files with 11 additions and 8 deletions

View File

@ -5,6 +5,7 @@ program fci_zmq
double precision, allocatable :: pt2(:) double precision, allocatable :: pt2(:)
integer :: degree integer :: degree
integer :: n_det_before, to_select
allocate (pt2(N_states)) allocate (pt2(N_states))
@ -33,13 +34,15 @@ program fci_zmq
double precision :: E_CI_before(N_states) double precision :: E_CI_before(N_states)
integer :: n_det_before
print*,'Beginning the selection ...' print*,'Beginning the selection ...'
E_CI_before(1:N_states) = CI_energy(1:N_states) E_CI_before(1:N_states) = CI_energy(1:N_states)
n_det_before = 0
do while ( (N_det < N_det_max) .and. (maxval(abs(pt2(1:N_states))) > pt2_max) ) do while ( (N_det < N_det_max) .and. (maxval(abs(pt2(1:N_states))) > pt2_max) )
n_det_before = N_det n_det_before = N_det
call ZMQ_selection(max(1024-N_det, N_det), pt2) to_select = max(1024-N_det, N_det)
to_select = min(to_select, N_det_max-n_det_before)
call ZMQ_selection(to_select, pt2)
PROVIDE psi_coef PROVIDE psi_coef
PROVIDE psi_det PROVIDE psi_det

View File

@ -622,7 +622,7 @@ subroutine search_key_big_interval(key,X,sze,idx,ibegin_in,iend_in)
istep = ishft(iend-ibegin,-1) istep = ishft(iend-ibegin,-1)
idx = ibegin + istep idx = ibegin + istep
do while (istep > 16) do while (istep > 64)
idx = ibegin + istep idx = ibegin + istep
! TODO : Cache misses ! TODO : Cache misses
if (cache_key < X(idx)) then if (cache_key < X(idx)) then
@ -660,8 +660,8 @@ subroutine search_key_big_interval(key,X,sze,idx,ibegin_in,iend_in)
endif endif
enddo enddo
idx = ibegin idx = ibegin
if (min(iend_in,sze) > ibegin+16) then if (min(iend_in,sze) > ibegin+64) then
iend = ibegin+16 iend = ibegin+64
do while (cache_key > X(idx)) do while (cache_key > X(idx))
idx = idx+1 idx = idx+1
end do end do
@ -730,7 +730,7 @@ subroutine search_key_value_big_interval(key,value,X,Y,sze,idx,ibegin_in,iend_in
istep = ishft(iend-ibegin,-1) istep = ishft(iend-ibegin,-1)
idx = ibegin + istep idx = ibegin + istep
do while (istep > 16) do while (istep > 64)
idx = ibegin + istep idx = ibegin + istep
if (cache_key < X(idx)) then if (cache_key < X(idx)) then
iend = idx iend = idx
@ -771,8 +771,8 @@ subroutine search_key_value_big_interval(key,value,X,Y,sze,idx,ibegin_in,iend_in
enddo enddo
idx = ibegin idx = ibegin
value = Y(idx) value = Y(idx)
if (min(iend_in,sze) > ibegin+16) then if (min(iend_in,sze) > ibegin+64) then
iend = ibegin+16 iend = ibegin+64
do while (cache_key > X(idx)) do while (cache_key > X(idx))
idx = idx+1 idx = idx+1
value = Y(idx) value = Y(idx)