10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-29 16:34:50 +02:00

Accelerated MRCC

This commit is contained in:
Anthony Scemama 2015-07-29 18:27:07 +02:00
parent e0c3507720
commit e23dba89ba
11 changed files with 179 additions and 69 deletions

View File

@ -28,4 +28,5 @@ Utils
ezfio_interface.irp.f ezfio_interface.irp.f
irpf90.make irpf90.make
irpf90_entities irpf90_entities
mrcc_cassd
tags tags

View File

@ -23,7 +23,7 @@ Documentation
.. Do not edit this section. It was auto-generated from the .. Do not edit this section. It was auto-generated from the
.. by the `update_README.py` script. .. by the `update_README.py` script.
`apply_excitation_operator <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_Utils_new/mrcc_dress.irp.f#L78>`_ `apply_excitation_operator <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_Utils_new/mrcc_dress.irp.f#L138>`_
Undocumented Undocumented
@ -108,27 +108,27 @@ Documentation
.br .br
excitation_operators(:,i) represents the holes and particles that excitation_operators(:,i) represents the holes and particles that
link the ith connected determinant to det_ref link the ith connected determinant to det_ref
if :: if ::
excitation_operators(5,i) = 2 :: double excitation alpha excitation_operators(5,i) = 2 :: double excitation alpha
excitation_operators(5,i) = -2 :: double excitation beta excitation_operators(5,i) = -2 :: double excitation beta
!! excitation_operators(1,i) :: hole 1 !! excitation_operators(1,i) :: hole 1
!! excitation_operators(2,i) :: particle 1 !! excitation_operators(2,i) :: particle 1
!! excitation_operators(3,i) :: hole 2 !! excitation_operators(3,i) :: hole 2
!! excitation_operators(4,i) :: particle 2 !! excitation_operators(4,i) :: particle 2
else if :: else if ::
excitation_operators(5,i) = 1 :: single excitation alpha excitation_operators(5,i) = 1 :: single excitation alpha
!! excitation_operators(1,i) :: hole 1 !! excitation_operators(1,i) :: hole 1
!! excitation_operators(2,i) :: particle 1 !! excitation_operators(2,i) :: particle 1
else if :: else if ::
excitation_operators(5,i) = -1 :: single excitation beta excitation_operators(5,i) = -1 :: single excitation beta
!! excitation_operators(3,i) :: hole 1 !! excitation_operators(3,i) :: hole 1
!! excitation_operators(4,i) :: particle 1 !! excitation_operators(4,i) :: particle 1
else if :: else if ::
!! excitation_operators(5,i) = 0 :: double excitation alpha/beta !! excitation_operators(5,i) = 0 :: double excitation alpha/beta
!! excitation_operators(1,i) :: hole 1 alpha !! excitation_operators(1,i) :: hole 1 alpha
!! excitation_operators(2,i) :: particle 1 alpha !! excitation_operators(2,i) :: particle 1 alpha
!! excitation_operators(3,i) :: hole 2 beta !! excitation_operators(3,i) :: hole 2 beta
!! excitation_operators(4,i) :: particle 2 beta !! excitation_operators(4,i) :: particle 2 beta
`h_matrix_dressed <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_Utils_new/mrcc_utils.irp.f#L58>`_ `h_matrix_dressed <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_Utils_new/mrcc_utils.irp.f#L58>`_

View File

@ -3,7 +3,7 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
implicit none implicit none
integer, intent(in) :: ndetref,nstates,ndetnonref integer, intent(in) :: ndetref,nstates,ndetnonref
double precision, intent(inout) :: delta_ii_(ndetref,nstates),delta_ij_(ndetref,ndetnonref,nstates) double precision, intent(inout) :: delta_ii_(ndetref,nstates),delta_ij_(ndetref,ndetnonref,nstates)
integer :: i,j,k,l integer :: i,j,k,l,m
integer :: i_state integer :: i_state
integer :: N_connect_ref integer :: N_connect_ref
integer*2,allocatable :: excitation_operators(:,:) integer*2,allocatable :: excitation_operators(:,:)
@ -12,13 +12,14 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
integer(bit_kind), allocatable :: key_test(:,:) integer(bit_kind), allocatable :: key_test(:,:)
integer, allocatable :: index_connected(:) integer, allocatable :: index_connected(:)
integer :: i_hole,i_particle,ispin,i_ok,connected_to_ref,index_wf integer :: i_hole,i_particle,ispin,i_ok,connected_to_ref,index_wf
integer, allocatable :: idx_vector(:), degree_vector(:) integer, allocatable :: idx_vector(:)
double precision :: phase_ij double precision :: phase_ij
double precision :: dij,phase_la double precision :: dij,phase_la
double precision :: hij,phase double precision :: hij,phase
integer :: exc(0:2,2,2),degree integer :: exc(0:2,2,2),degree
logical :: is_in_wavefunction logical :: is_in_wavefunction
double precision, allocatable :: delta_ij_tmp(:,:,:), delta_ii_tmp(:,:) double precision, allocatable :: delta_ij_tmp(:,:,:), delta_ii_tmp(:,:)
logical, external :: is_in_psi_ref
i_state = 1 i_state = 1
allocate(excitation_operators(5,N_det_non_ref)) allocate(excitation_operators(5,N_det_non_ref))
@ -29,15 +30,14 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
!$OMP SHARED(N_det_ref, N_det_non_ref, psi_ref, i_state, & !$OMP SHARED(N_det_ref, N_det_non_ref, psi_ref, i_state, &
!$OMP N_connect_ref,index_connected,psi_non_ref, & !$OMP N_connect_ref,index_connected,psi_non_ref, &
!$OMP excitation_operators,amplitudes_phase_less, & !$OMP excitation_operators,amplitudes_phase_less, &
!$OMP psi_non_ref_coef,N_int,lambda_mrcc,N_det, & !$OMP psi_non_ref_coef,N_int,lambda_mrcc, &
!$OMP delta_ii_,delta_ij_,psi_ref_coef,nstates, & !$OMP delta_ii_,delta_ij_,psi_ref_coef,nstates, &
!$OMP mo_integrals_threshold) & !$OMP mo_integrals_threshold,idx_non_ref_rev) &
!$OMP PRIVATE(i,j,k,l,hil,phase_il,exc,degree,t_il, & !$OMP PRIVATE(i,j,k,l,hil,phase_il,exc,degree,t_il, &
!$OMP key_test,i_ok,phase_la,hij,phase_ij, & !$OMP key_test,i_ok,phase_la,hij,phase_ij,m, &
!$OMP dij,degree_vector,idx_vector,delta_ij_tmp, & !$OMP dij,idx_vector,delta_ij_tmp, &
!$OMP delta_ii_tmp,phase) !$OMP delta_ii_tmp,phase)
allocate(idx_vector(0:N_det_non_ref)) allocate(idx_vector(0:N_det_non_ref))
allocate(degree_vector(N_det_non_ref))
allocate(key_test(N_int,2)) allocate(key_test(N_int,2))
allocate(delta_ij_tmp(size(delta_ij_,1),size(delta_ij_,2),nstates)) allocate(delta_ij_tmp(size(delta_ij_,1),size(delta_ij_,2),nstates))
allocate(delta_ii_tmp(size(delta_ij_,1),nstates)) allocate(delta_ii_tmp(size(delta_ij_,1),nstates))
@ -52,8 +52,9 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
!$OMP END SINGLE !$OMP END SINGLE
!$OMP BARRIER !$OMP BARRIER
!$OMP DO SCHEDULE(guided) !$OMP DO SCHEDULE(dynamic)
do l = 1, N_det_non_ref do l = 1, N_det_non_ref
! print *, l, '/', N_det_non_ref
double precision :: t_il,phase_il,hil double precision :: t_il,phase_il,hil
call i_H_j_phase_out(psi_ref(1,1,i),psi_non_ref(1,1,l),N_int,hil,phase_il,exc,degree) call i_H_j_phase_out(psi_ref(1,1,i),psi_non_ref(1,1,l),N_int,hil,phase_il,exc,degree)
t_il = hil * lambda_mrcc(i_state,l) t_il = hil * lambda_mrcc(i_state,l)
@ -75,7 +76,7 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
if(i_ok.ne.1)cycle if(i_ok.ne.1)cycle
! we check if such determinant is already in the wave function ! we check if such determinant is already in the wave function
if(is_in_wavefunction(key_test,N_int,N_det))cycle if(is_in_wavefunction(key_test,N_int))cycle
! we get the phase for psi_non_ref(l) -> T_I->j |psi_non_ref(l)> ! we get the phase for psi_non_ref(l) -> T_I->j |psi_non_ref(l)>
call get_excitation(psi_non_ref(1,1,l),key_test,exc,degree,phase_la,N_int) call get_excitation(psi_non_ref(1,1,l),key_test,exc,degree,phase_la,N_int)
@ -90,12 +91,14 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
endif endif
! we compute the interaction of such determinant with all the non_ref dets ! we compute the interaction of such determinant with all the non_ref dets
call get_excitation_degree_vector(psi_non_ref,key_test,degree_vector,N_int,N_det_non_ref,idx_vector) call filter_connected(psi_non_ref,key_test,N_int,N_det_non_ref,idx_vector)
do k = 1, idx_vector(0) do k = 1, idx_vector(0)
call i_H_j_phase_out(key_test,psi_non_ref(1,1,idx_vector(k)),N_int,hij,phase,exc,degree) m = idx_vector(k)
delta_ij_tmp(i,idx_vector(k),i_state) += hij * dij call i_H_j_phase_out(key_test,psi_non_ref(1,1,m),N_int,hij,phase,exc,degree)
delta_ij_tmp(i,m,i_state) += hij * dij
enddo enddo
enddo enddo
@ -117,7 +120,6 @@ subroutine mrcc_dress(ndetref,ndetnonref,nstates,delta_ij_,delta_ii_)
deallocate(delta_ii_tmp,delta_ij_tmp) deallocate(delta_ii_tmp,delta_ij_tmp)
deallocate(idx_vector) deallocate(idx_vector)
deallocate(key_test) deallocate(key_test)
deallocate(degree_vector)
!$OMP END PARALLEL !$OMP END PARALLEL
deallocate(excitation_operators) deallocate(excitation_operators)

View File

@ -31,7 +31,7 @@ subroutine perturb_buffer_$PERT(i_generator,buffer,buffer_size,e_2_pert_buffer,c
cycle cycle
endif endif
if (is_in_wavefunction(buffer(1,1,i),Nint,N_det)) then if (is_in_wavefunction(buffer(1,1,i),Nint)) then
cycle cycle
endif endif
@ -82,7 +82,7 @@ subroutine perturb_buffer_by_mono_$PERT(i_generator,buffer,buffer_size,e_2_pert_
cycle cycle
endif endif
if (is_in_wavefunction(buffer(1,1,i),Nint,N_det)) then if (is_in_wavefunction(buffer(1,1,i),Nint)) then
cycle cycle
endif endif

View File

@ -13,6 +13,10 @@ Documentation
.. Do not edit this section. It was auto-generated from the .. Do not edit this section. It was auto-generated from the
.. by the `update_README.py` script. .. by the `update_README.py` script.
`get_index_in_psi_ref_sorted_bit <http://github.com/LCPQ/quantum_package/tree/master/src/Psiref_Utils/psi_ref_utils.irp.f#L136>`_
Returns the index of the determinant in the ``psi_ref_sorted_bit`` array
`h_matrix_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Psiref_Utils/psi_ref_utils.irp.f#L70>`_ `h_matrix_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Psiref_Utils/psi_ref_utils.irp.f#L70>`_
Undocumented Undocumented
@ -30,6 +34,10 @@ Documentation
idx_non_ref gives the indice of the determinant in psi_det. idx_non_ref gives the indice of the determinant in psi_det.
`is_in_psi_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Psiref_Utils/psi_ref_utils.irp.f#L122>`_
True if the determinant ``det`` is in the wave function
`n_det_non_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Psiref_Utils/psi_ref_utils.irp.f#L21>`_ `n_det_non_ref <http://github.com/LCPQ/quantum_package/tree/master/src/Psiref_Utils/psi_ref_utils.irp.f#L21>`_
Set of determinants which are not part of the reference, defined from the application Set of determinants which are not part of the reference, defined from the application
of the reference bitmask on the determinants. of the reference bitmask on the determinants.

View File

@ -18,17 +18,20 @@ END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_non_ref, (N_int,2,psi_det_size) ] BEGIN_PROVIDER [ integer(bit_kind), psi_non_ref, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_non_ref_coef, (psi_det_size,n_states) ] &BEGIN_PROVIDER [ double precision, psi_non_ref_coef, (psi_det_size,n_states) ]
&BEGIN_PROVIDER [ integer, idx_non_ref, (psi_det_size) ] &BEGIN_PROVIDER [ integer, idx_non_ref, (psi_det_size) ]
&BEGIN_PROVIDER [ integer, idx_non_ref_rev, (psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_non_ref ] &BEGIN_PROVIDER [ integer, N_det_non_ref ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Set of determinants which are not part of the reference, defined from the application ! Set of determinants which are not part of the reference, defined from the application
! of the reference bitmask on the determinants. ! of the reference bitmask on the determinants.
! idx_non_ref gives the indice of the determinant in psi_det. ! idx_non_ref gives the indice of the determinant in psi_det.
! idx_non_ref_rev gives the reverse.
END_DOC END_DOC
integer :: i_non_ref,j,k integer :: i_non_ref,j,k
integer :: degree integer :: degree
logical :: in_ref logical :: in_ref
i_non_ref =0 i_non_ref =0
idx_non_ref_rev = 0
do k=1,N_det do k=1,N_det
in_ref = .False. in_ref = .False.
do j=1,N_det_ref do j=1,N_det_ref
@ -49,6 +52,7 @@ END_PROVIDER
psi_non_ref_coef(i_non_ref,j) = psi_coef(k,j) psi_non_ref_coef(i_non_ref,j) = psi_coef(k,j)
enddo enddo
idx_non_ref(i_non_ref) = k idx_non_ref(i_non_ref) = k
idx_non_ref_rev(k) = i_non_ref
endif endif
enddo enddo
N_det_non_ref = i_non_ref N_det_non_ref = i_non_ref
@ -119,5 +123,102 @@ END_PROVIDER
END_PROVIDER END_PROVIDER
logical function is_in_psi_ref(key,Nint)
use bitmasks
implicit none
BEGIN_DOC
! True if the determinant ``det`` is in the wave function
END_DOC
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key(Nint,2)
integer, external :: get_index_in_psi_ref_sorted_bit
!DIR$ FORCEINLINE
is_in_psi_ref = get_index_in_psi_ref_sorted_bit(key,Nint) > 0
end
integer function get_index_in_psi_ref_sorted_bit(key,Nint)
use bitmasks
BEGIN_DOC
! Returns the index of the determinant in the ``psi_ref_sorted_bit`` array
END_DOC
implicit none
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key(Nint,2)
integer :: i, ibegin, iend, istep, l
integer*8 :: det_ref, det_search
integer*8, external :: det_search_key
logical :: in_wavefunction
in_wavefunction = .False.
get_index_in_psi_ref_sorted_bit = 0
ibegin = 1
iend = N_det+1
!DIR$ FORCEINLINE
det_ref = det_search_key(key,Nint)
!DIR$ FORCEINLINE
det_search = det_search_key(psi_ref_sorted_bit(1,1,1),Nint)
istep = ishft(iend-ibegin,-1)
i=ibegin+istep
do while (istep > 0)
!DIR$ FORCEINLINE
det_search = det_search_key(psi_ref_sorted_bit(1,1,i),Nint)
if ( det_search > det_ref ) then
iend = i
else if ( det_search == det_ref ) then
exit
else
ibegin = i
endif
istep = ishft(iend-ibegin,-1)
i = ibegin + istep
end do
!DIR$ FORCEINLINE
do while (det_search_key(psi_ref_sorted_bit(1,1,i),Nint) == det_ref)
i = i-1
if (i == 0) then
exit
endif
enddo
i += 1
if (i > N_det) then
return
endif
!DIR$ FORCEINLINE
do while (det_search_key(psi_ref_sorted_bit(1,1,i),Nint) == det_ref)
if ( (key(1,1) /= psi_ref_sorted_bit(1,1,i)).or. &
(key(1,2) /= psi_ref_sorted_bit(1,2,i)) ) then
continue
else
in_wavefunction = .True.
!DIR$ IVDEP
!DIR$ LOOP COUNT MIN(3)
do l=2,Nint
if ( (key(l,1) /= psi_ref_sorted_bit(l,1,i)).or. &
(key(l,2) /= psi_ref_sorted_bit(l,2,i)) ) then
in_wavefunction = .False.
endif
enddo
if (in_wavefunction) then
get_index_in_psi_ref_sorted_bit = i
! exit
return
endif
endif
i += 1
if (i > N_det) then
! exit
return
endif
enddo
end

View File

@ -43,7 +43,7 @@ Documentation
.. Do not edit this section. It was auto-generated from the .. Do not edit this section. It was auto-generated from the
.. by the `update_README.py` script. .. by the `update_README.py` script.
`a_operator <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1097>`_ `a_operator <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1108>`_
Needed for diag_H_mat_elem Needed for diag_H_mat_elem
@ -55,7 +55,7 @@ Documentation
Max and min values of the coefficients Max and min values of the coefficients
`ac_operator <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1142>`_ `ac_operator <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1153>`_
Needed for diag_H_mat_elem Needed for diag_H_mat_elem
@ -141,7 +141,7 @@ Documentation
After calling this subroutine, N_det, psi_det and psi_coef need to be touched After calling this subroutine, N_det, psi_det and psi_coef need to be touched
`create_wf_of_psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L416>`_ `create_wf_of_psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L415>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants Matrix of wf coefficients. Outer product of alpha and beta determinants
@ -217,7 +217,7 @@ Documentation
det_coef det_coef
`det_connections <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1272>`_ `det_connections <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1283>`_
Build connection proxy between determinants Build connection proxy between determinants
@ -245,7 +245,7 @@ Documentation
Diagonalization algorithm (Davidson or Lapack) Diagonalization algorithm (Davidson or Lapack)
`diag_h_mat_elem <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1035>`_ `diag_h_mat_elem <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1046>`_
Computes <i|H|i> Computes <i|H|i>
@ -347,7 +347,7 @@ Documentation
Determinants are taken from the psi_det_sorted_ab array Determinants are taken from the psi_det_sorted_ab array
`generate_all_alpha_beta_det_products <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L471>`_ `generate_all_alpha_beta_det_products <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L469>`_
Create a wave function from all possible alpha x beta determinants Create a wave function from all possible alpha x beta determinants
@ -383,7 +383,7 @@ Documentation
Returns the excitation operator between two singly excited determinants and the phase Returns the excitation operator between two singly excited determinants and the phase
`get_occ_from_key <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1190>`_ `get_occ_from_key <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1201>`_
Returns a list of occupation numbers from a bitstring Returns a list of occupation numbers from a bitstring
@ -417,7 +417,7 @@ Documentation
Undocumented Undocumented
`h_u_0 <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1206>`_ `h_u_0 <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1217>`_
Computes v_0 = H|u_0> Computes v_0 = H|u_0>
.br .br
n : number of determinants n : number of determinants
@ -516,7 +516,7 @@ Documentation
Energy of the reference bitmask used in Slater rules Energy of the reference bitmask used in Slater rules
`n_con_int <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1264>`_ `n_con_int <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1275>`_
Number of integers to represent the connections between determinants Number of integers to represent the connections between determinants
@ -774,19 +774,19 @@ Documentation
psi_occ_pattern(:,2,j) = jth occ_pattern of the wave function : represent all the double occupation psi_occ_pattern(:,2,j) = jth occ_pattern of the wave function : represent all the double occupation
`psi_svd_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L511>`_ `psi_svd_alpha <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L509>`_
SVD wave function SVD wave function
`psi_svd_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L512>`_ `psi_svd_beta <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L510>`_
SVD wave function SVD wave function
`psi_svd_coefs <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L513>`_ `psi_svd_coefs <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L511>`_
SVD wave function SVD wave function
`psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L400>`_ `psi_svd_matrix <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/spindeterminants.irp.f#L399>`_
Matrix of wf coefficients. Outer product of alpha and beta determinants Matrix of wf coefficients. Outer product of alpha and beta determinants

View File

@ -33,13 +33,13 @@ end
logical function is_in_wavefunction(key,Nint,Ndet) logical function is_in_wavefunction(key,Nint)
use bitmasks use bitmasks
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! True if the determinant ``det`` is in the wave function ! True if the determinant ``det`` is in the wave function
END_DOC END_DOC
integer, intent(in) :: Nint, Ndet integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key(Nint,2) integer(bit_kind), intent(in) :: key(Nint,2)
integer, external :: get_index_in_psi_det_sorted_bit integer, external :: get_index_in_psi_det_sorted_bit
@ -60,9 +60,9 @@ integer function get_index_in_psi_det_sorted_bit(key,Nint)
integer :: i, ibegin, iend, istep, l integer :: i, ibegin, iend, istep, l
integer*8 :: det_ref, det_search integer*8 :: det_ref, det_search
integer*8, external :: det_search_key integer*8, external :: det_search_key
logical :: is_in_wavefunction logical :: in_wavefunction
is_in_wavefunction = .False. in_wavefunction = .False.
get_index_in_psi_det_sorted_bit = 0 get_index_in_psi_det_sorted_bit = 0
ibegin = 1 ibegin = 1
iend = N_det+1 iend = N_det+1
@ -107,16 +107,16 @@ integer function get_index_in_psi_det_sorted_bit(key,Nint)
(key(1,2) /= psi_det_sorted_bit(1,2,i)) ) then (key(1,2) /= psi_det_sorted_bit(1,2,i)) ) then
continue continue
else else
is_in_wavefunction = .True. in_wavefunction = .True.
!DIR$ IVDEP !DIR$ IVDEP
!DIR$ LOOP COUNT MIN(3) !DIR$ LOOP COUNT MIN(3)
do l=2,Nint do l=2,Nint
if ( (key(l,1) /= psi_det_sorted_bit(l,1,i)).or. & if ( (key(l,1) /= psi_det_sorted_bit(l,1,i)).or. &
(key(l,2) /= psi_det_sorted_bit(l,2,i)) ) then (key(l,2) /= psi_det_sorted_bit(l,2,i)) ) then
is_in_wavefunction = .False. in_wavefunction = .False.
endif endif
enddo enddo
if (is_in_wavefunction) then if (in_wavefunction) then
get_index_in_psi_det_sorted_bit = i get_index_in_psi_det_sorted_bit = i
! exit ! exit
return return
@ -131,7 +131,7 @@ integer function get_index_in_psi_det_sorted_bit(key,Nint)
enddo enddo
! DEBUG is_in_wf ! DEBUG is_in_wf
! if (is_in_wavefunction) then ! if (in_wavefunction) then
! degree = 1 ! degree = 1
! do i=1,N_det ! do i=1,N_det
! integer :: degree ! integer :: degree

View File

@ -292,7 +292,7 @@ subroutine make_s2_eigenfunction
endif endif
call occ_pattern_to_dets(psi_occ_pattern(1,1,i),d,s,elec_alpha_num,N_int) call occ_pattern_to_dets(psi_occ_pattern(1,1,i),d,s,elec_alpha_num,N_int)
do j=1,s do j=1,s
if (.not. is_in_wavefunction( d(1,1,j), N_int, N_det)) then if (.not. is_in_wavefunction(d(1,1,j), N_int) ) then
N_det_new += 1 N_det_new += 1
do k=1,N_int do k=1,N_int
det_buffer(k,1,N_det_new) = d(k,1,j) det_buffer(k,1,N_det_new) = d(k,1,j)

View File

@ -151,9 +151,9 @@ integer function get_index_in_psi_det_alpha_unique(key,Nint)
integer :: i, ibegin, iend, istep, l integer :: i, ibegin, iend, istep, l
integer*8 :: det_ref, det_search integer*8 :: det_ref, det_search
integer*8, external :: spin_det_search_key integer*8, external :: spin_det_search_key
logical :: is_in_wavefunction logical :: in_wavefunction
is_in_wavefunction = .False. in_wavefunction = .False.
get_index_in_psi_det_alpha_unique = 0 get_index_in_psi_det_alpha_unique = 0
ibegin = 1 ibegin = 1
iend = N_det_alpha_unique + 1 iend = N_det_alpha_unique + 1
@ -198,15 +198,15 @@ integer function get_index_in_psi_det_alpha_unique(key,Nint)
if (key(1) /= psi_det_alpha_unique(1,i)) then if (key(1) /= psi_det_alpha_unique(1,i)) then
continue continue
else else
is_in_wavefunction = .True. in_wavefunction = .True.
!DIR$ IVDEP !DIR$ IVDEP
!DIR$ LOOP COUNT MIN(3) !DIR$ LOOP COUNT MIN(3)
do l=2,Nint do l=2,Nint
if (key(l) /= psi_det_alpha_unique(l,i)) then if (key(l) /= psi_det_alpha_unique(l,i)) then
is_in_wavefunction = .False. in_wavefunction = .False.
endif endif
enddo enddo
if (is_in_wavefunction) then if (in_wavefunction) then
get_index_in_psi_det_alpha_unique = i get_index_in_psi_det_alpha_unique = i
return return
endif endif
@ -233,9 +233,9 @@ integer function get_index_in_psi_det_beta_unique(key,Nint)
integer :: i, ibegin, iend, istep, l integer :: i, ibegin, iend, istep, l
integer*8 :: det_ref, det_search integer*8 :: det_ref, det_search
integer*8, external :: spin_det_search_key integer*8, external :: spin_det_search_key
logical :: is_in_wavefunction logical :: in_wavefunction
is_in_wavefunction = .False. in_wavefunction = .False.
get_index_in_psi_det_beta_unique = 0 get_index_in_psi_det_beta_unique = 0
ibegin = 1 ibegin = 1
iend = N_det_beta_unique + 1 iend = N_det_beta_unique + 1
@ -279,15 +279,15 @@ integer function get_index_in_psi_det_beta_unique(key,Nint)
if (key(1) /= psi_det_beta_unique(1,i)) then if (key(1) /= psi_det_beta_unique(1,i)) then
continue continue
else else
is_in_wavefunction = .True. in_wavefunction = .True.
!DIR$ IVDEP !DIR$ IVDEP
!DIR$ LOOP COUNT MIN(3) !DIR$ LOOP COUNT MIN(3)
do l=2,Nint do l=2,Nint
if (key(l) /= psi_det_beta_unique(l,i)) then if (key(l) /= psi_det_beta_unique(l,i)) then
is_in_wavefunction = .False. in_wavefunction = .False.
endif endif
enddo enddo
if (is_in_wavefunction) then if (in_wavefunction) then
get_index_in_psi_det_beta_unique = i get_index_in_psi_det_beta_unique = i
return return
endif endif
@ -369,7 +369,6 @@ BEGIN_PROVIDER [ double precision, psi_svd_matrix_values, (N_det,N_states) ]
integer(bit_kind) :: tmp_det(N_int,2) integer(bit_kind) :: tmp_det(N_int,2)
integer :: idx integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit integer, external :: get_index_in_psi_det_sorted_bit
logical, external :: is_in_wavefunction
PROVIDE psi_coef_sorted_bit PROVIDE psi_coef_sorted_bit
@ -423,7 +422,6 @@ subroutine create_wf_of_psi_svd_matrix
integer(bit_kind) :: tmp_det(N_int,2) integer(bit_kind) :: tmp_det(N_int,2)
integer :: idx integer :: idx
integer, external :: get_index_in_psi_det_sorted_bit integer, external :: get_index_in_psi_det_sorted_bit
logical, external :: is_in_wavefunction
double precision :: norm(N_states) double precision :: norm(N_states)
call generate_all_alpha_beta_det_products call generate_all_alpha_beta_det_products
@ -494,7 +492,7 @@ subroutine generate_all_alpha_beta_det_products
tmp_det(k,1,l) = psi_det_alpha_unique(k,i) tmp_det(k,1,l) = psi_det_alpha_unique(k,i)
tmp_det(k,2,l) = psi_det_beta_unique (k,j) tmp_det(k,2,l) = psi_det_beta_unique (k,j)
enddo enddo
if (.not.is_in_wavefunction(tmp_det(1,1,l),N_int,N_det)) then if (.not.is_in_wavefunction(tmp_det(1,1,l),N_int)) then
l = l+1 l = l+1
endif endif
enddo enddo

View File

@ -106,8 +106,8 @@ Documentation
Output file for MRCC_CASSD Output file for MRCC_CASSD
`output_mrcc_utils <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L361>`_ `output_mrcc_utils_new <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L361>`_
Output file for MRCC_Utils Output file for MRCC_Utils_new
`output_nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L381>`_ `output_nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L381>`_