10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-08-25 05:51:46 +02:00

Cleaning in determinants

This commit is contained in:
Anthony Scemama 2014-11-28 22:32:21 +01:00
parent 4f630520d1
commit dce39c7dd1
4 changed files with 72 additions and 47 deletions

View File

@ -28,11 +28,11 @@ EZFIO: bin/irpf90
bin/irpf90: bin/irpf90:
$(info $(BLUE)===== Fetching IRPF90 from the web ===== $(BLACK)) $(info $(BLUE)===== Fetching IRPF90 from the web ===== $(BLACK))
@sleep 1 @sleep 1
#@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \ @$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \
# (echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1) (echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1)
#tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ) tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ)
#$(MAKE) -C irpf90 | tee install_irpf90.log $(MAKE) -C irpf90 | tee install_irpf90.log
#rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman
echo $$PWD/irpf90/bin/irpf90 $$\@ > $$PWD/bin/irpf90 echo $$PWD/irpf90/bin/irpf90 $$\@ > $$PWD/bin/irpf90
echo $$PWD/irpf90/bin/irpman $$\@ > $$PWD/bin/irpman echo $$PWD/irpf90/bin/irpman $$\@ > $$PWD/bin/irpman
chmod +x $$PWD/bin/irpf90 $$PWD/bin/irpman chmod +x $$PWD/bin/irpf90 $$PWD/bin/irpman

View File

@ -147,7 +147,7 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states_diag) ]
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, psi_average_norm_contrib, (N_det) ] BEGIN_PROVIDER [ double precision, psi_average_norm_contrib, (psi_det_size) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Contribution of determinants to the state-averaged density ! Contribution of determinants to the state-averaged density
@ -218,7 +218,7 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta, (N_int,psi_det_size) ]
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha_unique, (N_int,N_det) ] BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_alpha_unique ] &BEGIN_PROVIDER [ integer, N_det_alpha_unique ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
@ -255,7 +255,7 @@ END_PROVIDER
deallocate (iorder, bit_tmp) deallocate (iorder, bit_tmp)
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta_unique, (N_int,N_det) ] BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_beta_unique ] &BEGIN_PROVIDER [ integer, N_det_beta_unique ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
@ -300,9 +300,9 @@ END_PROVIDER
!==============================================================================! !==============================================================================!
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted, (N_int,2,N_det) ] BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted, (N_det,N_states) ] &BEGIN_PROVIDER [ double precision, psi_coef_sorted, (psi_det_size,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_average_norm_contrib_sorted, (N_det) ] &BEGIN_PROVIDER [ double precision, psi_average_norm_contrib_sorted, (psi_det_size) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Wave function sorted by determinants contribution to the norm (state-averaged) ! Wave function sorted by determinants contribution to the norm (state-averaged)
@ -331,8 +331,8 @@ END_PROVIDER
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,N_det) ] BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (N_det,N_states) ] &BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (psi_det_size,N_states) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Determinants on which we apply <i|H|psi> for perturbation. ! Determinants on which we apply <i|H|psi> for perturbation.
@ -429,10 +429,10 @@ subroutine filter_3_highest_electrons( det_in, det_out, Nint )
enddo enddo
enddo enddo
end end
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_ab, (N_int,2,N_det) ] BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_ab, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted_ab, (N_det,N_states) ] &BEGIN_PROVIDER [ double precision, psi_coef_sorted_ab, (N_det,N_states) ]
&BEGIN_PROVIDER [ integer, psi_det_sorted_next_ab, (2,N_det) ] &BEGIN_PROVIDER [ integer, psi_det_sorted_next_ab, (2,psi_det_size) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Determinants on which we apply <i|H|j>. ! Determinants on which we apply <i|H|j>.
@ -440,31 +440,58 @@ end
! then by the 3 highest electrons in the beta part to accelerate ! then by the 3 highest electrons in the beta part to accelerate
! the research of connected determinants. ! the research of connected determinants.
END_DOC END_DOC
call sort_dets_by_3_highest_electrons( &
psi_det, &
psi_coef, &
psi_det_sorted_ab, &
psi_coef_sorted_ab, &
psi_det_sorted_next_ab, &
N_det, N_states, N_int, &
psi_det_size )
END_PROVIDER
subroutine sort_dets_by_3_highest_electrons(det_in,coef_in,det_out,coef_out, &
det_next, Ndet, Nstates, Nint, LDA)
implicit none
integer, intent(in) :: Ndet, Nstates, Nint, LDA
integer(bit_kind), intent(in) :: det_in (Nint,2,Ndet)
integer(bit_kind), intent(out) :: det_out (Nint,2,Ndet)
integer, intent(out) :: det_next (2,Ndet)
double precision, intent(in) :: coef_in (LDA,Nstates)
double precision, intent(out) :: coef_out (LDA,Nstates)
BEGIN_DOC
! Determinants on which we apply <i|H|j>.
! They are sorted by the 3 highest electrons in the alpha part,
! then by the 3 highest electrons in the beta part to accelerate
! the research of connected determinants.
END_DOC
integer :: i,j,k integer :: i,j,k
integer, allocatable :: iorder(:) integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:) integer*8, allocatable :: bit_tmp(:)
integer*8, external :: det_search_key integer*8, external :: det_search_key
allocate ( iorder(N_det), bit_tmp(N_det) ) allocate ( iorder(Ndet), bit_tmp(Ndet) )
! Sort alpha dets ! Sort alpha dets
! --------------- ! ---------------
integer(bit_kind) :: det_tmp(N_int) integer(bit_kind) :: det_tmp(Nint)
do i=1,N_det do i=1,Ndet
iorder(i) = i iorder(i) = i
call int_of_3_highest_electrons(psi_det(1,1,i),bit_tmp(i),N_int) call int_of_3_highest_electrons(psi_det(1,1,i),bit_tmp(i),N_int)
enddo enddo
call i8sort(bit_tmp,iorder,N_det) call i8sort(bit_tmp,iorder,Ndet)
!DIR$ IVDEP !DIR$ IVDEP
do i=1,N_det do i=1,Ndet
do j=1,N_int do j=1,N_int
psi_det_sorted_ab(j,1,i) = psi_det(j,1,iorder(i)) det_out(j,1,i) = psi_det(j,1,iorder(i))
psi_det_sorted_ab(j,2,i) = psi_det(j,2,iorder(i)) det_out(j,2,i) = psi_det(j,2,iorder(i))
enddo enddo
do k=1,N_states do k=1,Nstates
psi_coef_sorted_ab(i,k) = psi_coef(iorder(i),k) coef_out(i,k) = psi_coef(iorder(i),k)
enddo enddo
enddo enddo
@ -473,60 +500,60 @@ end
integer :: next integer :: next
next = N_det+1 next = Ndet+1
psi_det_sorted_next_ab(1,N_det) = next det_next(1,Ndet) = next
do i=N_det-1,1,-1 do i=Ndet-1,1,-1
if (bit_tmp(i) /= bit_tmp(i+1)) then if (bit_tmp(i) /= bit_tmp(i+1)) then
next = i+1 next = i+1
endif endif
psi_det_sorted_next_ab(1,i) = next det_next(1,i) = next
enddo enddo
! Sort beta dets ! Sort beta dets
! -------------- ! --------------
integer :: istart, iend integer :: istart, iend
integer(bit_kind), allocatable :: psi_det_sorted_ab_temp (:,:) integer(bit_kind), allocatable :: det_sorted_temp (:,:)
allocate ( psi_det_sorted_ab_temp (N_int,N_det) ) allocate ( det_sorted_temp (N_int,Ndet) )
do i=1,N_det do i=1,Ndet
do j=1,N_int do j=1,N_int
psi_det_sorted_ab_temp(j,i) = psi_det_sorted_ab(j,2,i) det_sorted_temp(j,i) = det_out(j,2,i)
enddo enddo
iorder(i) = i iorder(i) = i
call int_of_3_highest_electrons(psi_det_sorted_ab_temp(1,i),bit_tmp(i),N_int) call int_of_3_highest_electrons(det_sorted_temp(1,i),bit_tmp(i),N_int)
enddo enddo
istart=1 istart=1
do while ( istart<N_det ) do while ( istart<Ndet )
iend = psi_det_sorted_next_ab(1,istart) iend = det_next(1,istart)
call i8sort(bit_tmp(istart),iorder(istart),iend-istart) call i8sort(bit_tmp(istart),iorder(istart),iend-istart)
!DIR$ IVDEP !DIR$ IVDEP
do i=istart,iend-1 do i=istart,iend-1
do j=1,N_int do j=1,N_int
psi_det_sorted_ab(j,2,i) = psi_det_sorted_ab_temp(j,iorder(i)) det_out(j,2,i) = det_sorted_temp(j,iorder(i))
enddo enddo
do k=1,N_states do k=1,Nstates
psi_coef_sorted_ab(i,k) = psi_coef(iorder(i),k) coef_out(i,k) = psi_coef(iorder(i),k)
enddo enddo
enddo enddo
next = iend next = iend
psi_det_sorted_next_ab(2,iend-1) = next det_next(2,iend-1) = next
do i=iend-2,1,-1 do i=iend-2,1,-1
if (bit_tmp(i) /= bit_tmp(i+1)) then if (bit_tmp(i) /= bit_tmp(i+1)) then
next = i+1 next = i+1
endif endif
psi_det_sorted_next_ab(2,i) = next det_next(2,i) = next
enddo enddo
istart = iend istart = iend
enddo enddo
deallocate(iorder, bit_tmp, psi_det_sorted_ab_temp) deallocate(iorder, bit_tmp, det_sorted_temp)
END_PROVIDER end
!==============================================================================! !==============================================================================!
! ! ! !

View File

@ -165,14 +165,12 @@ subroutine filter_connected_davidson(key1,key2,Nint,sze,idx)
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Filters out the determinants that are not connected by H ! Filters out the determinants that are not connected by H
!
! returns the array idx which contains the index of the ! returns the array idx which contains the index of the
!
! determinants in the array key1 that interact ! determinants in the array key1 that interact
!
! via the H operator with key2. ! via the H operator with key2.
! !
! idx(0) is the number of determinants that interact with key1 ! idx(0) is the number of determinants that interact with key1
! key1 should come from psi_det_sorted_ab.
END_DOC END_DOC
integer, intent(in) :: Nint, sze integer, intent(in) :: Nint, sze
integer(bit_kind), intent(in) :: key1(Nint,2,sze) integer(bit_kind), intent(in) :: key1(Nint,2,sze)

View File

@ -207,7 +207,7 @@ end
endif endif
enddo enddo
j+=1 j+=1
if (j>N_det) then if (j>=N_det) then
exit exit
endif endif
enddo enddo