10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-22 18:57:31 +02:00

Even better selection

This commit is contained in:
Anthony Scemama 2014-06-02 16:42:33 +02:00
parent a451a89e5a
commit dc3d433d30
6 changed files with 22 additions and 94 deletions

View File

@ -159,7 +159,7 @@ class H_apply(object):
double precision, intent(inout):: norm_pert(N_st)
double precision, intent(inout):: H_pert_diag(N_st)
double precision :: delta_pt2(N_st), norm_psi(N_st), pt2_old(N_st)
PROVIDE CI_electronic_energy N_det_generators key_pattern_not_in_ref
PROVIDE CI_electronic_energy N_det_generators
do k=1,N_st
pt2(k) = 0.d0
norm_pert(k) = 0.d0

View File

@ -1,2 +1,2 @@
AOs BiInts Bitmask Dets Electrons Ezfio_files Hartree_Fock MonoInts MOs Nuclei Output SingleRefMethod Utils
AOs BiInts Bitmask Dets Electrons Ezfio_files Hartree_Fock MonoInts MOs Nuclei Output SingleRefMethod Utils Selectors_full

View File

@ -28,6 +28,7 @@ Needed Modules
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `SingleRefMethod <http://github.com/LCPQ/quantum_package/tree/master/src/SingleRefMethod>`_
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_
* `Selectors_full <http://github.com/LCPQ/quantum_package/tree/master/src/Selectors_full>`_
Documentation
=============

View File

@ -26,7 +26,6 @@ Needed Modules
* `BiInts <http://github.com/LCPQ/quantum_package/tree/master/src/BiInts>`_
* `Bitmask <http://github.com/LCPQ/quantum_package/tree/master/src/Bitmask>`_
* `CISD <http://github.com/LCPQ/quantum_package/tree/master/src/CISD>`_
* `CISD_SC2 <http://github.com/LCPQ/quantum_package/tree/master/src/CISD_SC2>`_
* `Dets <http://github.com/LCPQ/quantum_package/tree/master/src/Dets>`_
* `Electrons <http://github.com/LCPQ/quantum_package/tree/master/src/Electrons>`_
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_

View File

@ -1,8 +1,7 @@
logical function is_in_wavefunction(key,keys,Nint,N_past_in,Ndet)
logical function is_in_wavefunction(key,Nint,Ndet)
implicit none
integer, intent(in) :: Nint, N_past_in, Ndet
integer(bit_kind), intent(in) :: keys(Nint,2,Ndet)
integer, intent(in) :: Nint, Ndet
integer(bit_kind), intent(in) :: key(Nint,2)
integer :: i, ibegin, iend, istep, l
@ -11,18 +10,17 @@ logical function is_in_wavefunction(key,keys,Nint,N_past_in,Ndet)
is_in_wavefunction = .False.
ibegin = 1
iend = N_det
iend = N_det+1
ASSERT (N_past > 0)
ASSERT (N_det >= N_past)
det_ref = det_search_key(key,Nint)
det_search = det_search_key(psi_det_sorted_bit(1,1,1),Nint)
istep = ishft(iend-ibegin+1,-1)
istep = ishft(iend-ibegin,-1)
i=ibegin+istep
do while (istep > 1)
i = ibegin + istep
do while (istep > 0)
det_search = det_search_key(psi_det_sorted_bit(1,1,i),Nint)
! print *, istep, det_ref, det_search
if ( det_search > det_ref ) then
iend = i
else if ( det_search == det_ref ) then
@ -30,10 +28,13 @@ logical function is_in_wavefunction(key,keys,Nint,N_past_in,Ndet)
else
ibegin = i
endif
istep = ishft(iend-ibegin+1,-1)
i = ibegin + istep
istep = ishft(iend-ibegin,-1)
i = ibegin + istep
end do
! pause
! if (det_search /= det_ref) then
! return
! endif
do while (det_search_key(psi_det_sorted_bit(1,1,i),Nint) == det_ref)
i = i-1
@ -61,6 +62,9 @@ logical function is_in_wavefunction(key,keys,Nint,N_past_in,Ndet)
endif
endif
i += 1
if (i > N_det) then
exit
endif
enddo
@ -105,27 +109,8 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet)
endif
enddo
!DIR$ FORCEINLINE
t = det_is_not_or_may_be_in_ref(key,Nint)
if ( t ) then
return
endif
logical, external :: is_in_wavefunction
if (is_in_wavefunction(key,keys,Nint,N_past_in,Ndet)) then
connected_to_ref = -1
endif
return
! do i=N_past,Ndet
! if ( (key(1,1) /= keys(1,1,i)).or. &
! (key(1,2) /= keys(1,2,i)) ) then
! cycle
! endif
! connected_to_ref = -i
! return
! enddo
! return
else if (Nint==2) then
@ -146,23 +131,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet)
endif
enddo
!DIR$ FORCEINLINE
t = det_is_not_or_may_be_in_ref(key,Nint)
if ( t ) then
return
endif
!DIR$ LOOP COUNT (1000)
do i=N_past,Ndet
if ( (key(1,1) /= keys(1,1,i)).or. &
(key(1,2) /= keys(1,2,i)).or. &
(key(2,1) /= keys(2,1,i)).or. &
(key(2,2) /= keys(2,2,i)) ) then
cycle
endif
connected_to_ref = -i
return
enddo
return
else if (Nint==3) then
@ -186,24 +154,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet)
endif
enddo
!DIR$ FORCEINLINE
t = det_is_not_or_may_be_in_ref(key,Nint)
if ( t ) then
return
endif
do i=N_past,Ndet
if ( (key(1,1) /= keys(1,1,i)).or. &
(key(1,2) /= keys(1,2,i)).or. &
(key(2,1) /= keys(2,1,i)).or. &
(key(2,2) /= keys(2,2,i)).or. &
(key(3,1) /= keys(3,1,i)).or. &
(key(3,2) /= keys(3,2,i)) ) then
cycle
endif
connected_to_ref = -i
return
enddo
return
else
@ -228,32 +178,6 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet)
endif
enddo
!DIR$ FORCEINLINE
t = det_is_not_or_may_be_in_ref(key,Nint)
if ( t ) then
return
endif
do i=N_past,Ndet
if ( (key(1,1) /= keys(1,1,i)).or. &
(key(1,2) /= keys(1,2,i)) ) then
cycle
else
connected_to_ref = -1
!DEC$ LOOP COUNT MIN(3)
do l=2,Nint
if ( (key(l,1) /= keys(l,1,i)).or. &
(key(l,2) /= keys(l,2,i)) ) then
connected_to_ref = 0
exit
endif
enddo
if (connected_to_ref /= 0) then
return
endif
endif
enddo
endif
end

View File

@ -16,6 +16,7 @@ subroutine perturb_buffer_$PERT(i_generator,buffer,buffer_size,e_2_pert_buffer,c
double precision :: c_pert(N_st), e_2_pert(N_st), H_pert_diag(N_st)
integer :: i,k, c_ref
integer, external :: connected_to_ref
logical, external :: is_in_wavefunction
ASSERT (Nint > 0)
ASSERT (Nint == N_int)
@ -24,6 +25,9 @@ subroutine perturb_buffer_$PERT(i_generator,buffer,buffer_size,e_2_pert_buffer,c
ASSERT (N_st > 0)
do i = 1,buffer_size
if (is_in_wavefunction(buffer(1,1,i),Nint,N_det)) then
cycle
endif
c_ref = connected_to_ref(buffer(1,1,i),psi_generators,Nint,i_generator,N_det)
if (c_ref /= 0) then