10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-07-05 10:56:04 +02:00

the alpha/beta single work

This commit is contained in:
Emmanuel Giner 2019-07-04 16:43:08 +02:00
parent 919662ee0b
commit 59aaf3806d
2 changed files with 163 additions and 120 deletions

View File

@ -353,7 +353,11 @@ subroutine orb_range_two_rdm_state_av_openmp_work_$N_int(big_array,dim1,norb,lis
enddo enddo
if(alpha_beta.or.spin_trace.or.alpha_alpha)then if(alpha_beta.or.spin_trace.or.alpha_alpha)then
! increment the alpha/beta part for single excitations ! increment the alpha/beta part for single excitations
!!!! call orb_range_off_diagonal_single_to_two_rdm_ab_dm(tmp_det, tmp_det2,c_average,big_array,dim1,orb_bitmask,list_orb_reverse,ispin) if (nkeys+norb .ge. size(values)) then
call update_keys_values(keys,values,size(values),nkeys,dim1,big_array)
nkeys = 0
endif
call orb_range_off_diag_single_to_two_rdm_ab_dm_buffer(tmp_det, tmp_det2,c_average,list_orb_reverse,ispin,sze_buff,nkeys,keys,values)
! increment the alpha/alpha part for single excitations ! increment the alpha/alpha part for single excitations
!!!! call orb_range_off_diagonal_single_to_two_rdm_aa_dm(tmp_det,tmp_det2,c_average,big_array,dim1,orb_bitmask,list_orb_reverse,ispin) !!!! call orb_range_off_diagonal_single_to_two_rdm_aa_dm(tmp_det,tmp_det2,c_average,big_array,dim1,orb_bitmask,list_orb_reverse,ispin)
endif endif
@ -445,7 +449,11 @@ subroutine orb_range_two_rdm_state_av_openmp_work_$N_int(big_array,dim1,norb,lis
enddo enddo
if(alpha_beta.or.spin_trace.or.beta_beta)then if(alpha_beta.or.spin_trace.or.beta_beta)then
! increment the alpha/beta part for single excitations ! increment the alpha/beta part for single excitations
!!!! call orb_range_off_diagonal_single_to_two_rdm_ab_dm(tmp_det, tmp_det2,c_average,big_array,dim1,orb_bitmask,list_orb_reverse,ispin) if (nkeys+norb .ge. size(values)) then
call update_keys_values(keys,values,size(values),nkeys,dim1,big_array)
nkeys = 0
endif
call orb_range_off_diag_single_to_two_rdm_ab_dm_buffer(tmp_det, tmp_det2,c_average,list_orb_reverse,ispin,sze_buff,nkeys,keys,values)
! increment the beta /beta part for single excitations ! increment the beta /beta part for single excitations
!!!! call orb_range_off_diagonal_single_to_two_rdm_bb_dm(tmp_det, tmp_det2,c_average,big_array,dim1,orb_bitmask,list_orb_reverse,ispin) !!!! call orb_range_off_diagonal_single_to_two_rdm_bb_dm(tmp_det, tmp_det2,c_average,big_array,dim1,orb_bitmask,list_orb_reverse,ispin)
endif endif

View File

@ -255,124 +255,159 @@
endif endif
end end
! subroutine orb_range_off_diagonal_single_to_two_rdm_ab_dm(det_1,det_2,c_1,gorb_bitmask,list_orb_reverse,ispin) subroutine orb_range_off_diag_single_to_two_rdm_ab_dm_buffer(det_1,det_2,c_1,list_orb_reverse,ispin,sze_buff,nkeys,keys,values)
! use bitmasks use bitmasks
! BEGIN_DOC BEGIN_DOC
!! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for
!! !
!! a given couple of determinant det_1, det_2 being a SINGLE excitation with respect to one another ! a given couple of determinant det_1, det_2 being a SINGLE excitation with respect to one another
!! !
!! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1
!! !
!! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation
!! !
!! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals
!! !
!! ispin determines which spin-spin component of the two-rdm you will update ! ispin determines which spin-spin component of the two-rdm you will update
!! !
!! ispin == 1 :: alpha/ alpha ! ispin == 1 :: alpha/ alpha
!! ispin == 2 :: beta / beta ! ispin == 2 :: beta / beta
!! ispin == 3 :: alpha/ beta ! ispin == 3 :: alpha/ beta
!! ispin == 4 :: spin traced <=> total two-rdm ! ispin == 4 :: spin traced <=> total two-rdm
!! !
!! here, only ispin == 3 or 4 will do something ! here, only ispin == 3 or 4 will do something
! END_DOC END_DOC
! implicit none implicit none
! integer, intent(in) :: dim1,ispin integer, intent(in) :: ispin,sze_buff
! double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1) integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2)
! integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) integer, intent(in) :: list_orb_reverse(mo_num)
! integer(bit_kind), intent(in) :: orb_bitmask(N_int) double precision, intent(in) :: c_1
! integer, intent(in) :: list_orb_reverse(mo_num) double precision, intent(out) :: values(sze_buff)
! double precision, intent(in) :: c_1 integer , intent(out) :: keys(4,sze_buff)
! integer , intent(inout):: nkeys
! integer :: occ(N_int*bit_kind_size,2)
! integer :: n_occ_ab(2) integer :: occ(N_int*bit_kind_size,2)
! integer :: i,j,h1,h2,istate,p1 integer :: n_occ_ab(2)
! integer :: exc(0:2,2,2) integer :: i,j,h1,h2,istate,p1
! double precision :: phase integer :: exc(0:2,2,2)
! double precision :: phase
! logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace
! logical :: is_integer_in_string logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace
! alpha_alpha = .False. logical :: is_integer_in_string
! beta_beta = .False. alpha_alpha = .False.
! alpha_beta = .False. beta_beta = .False.
! spin_trace = .False. alpha_beta = .False.
! if( ispin == 1)then spin_trace = .False.
! alpha_alpha = .True. if( ispin == 1)then
! else if(ispin == 2)then alpha_alpha = .True.
! beta_beta = .True. else if(ispin == 2)then
! else if(ispin == 3)then beta_beta = .True.
! alpha_beta = .True. else if(ispin == 3)then
! else if(ispin == 4)then alpha_beta = .True.
! spin_trace = .True. else if(ispin == 4)then
! endif spin_trace = .True.
! endif
! call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int)
! call get_single_excitation(det_1,det_2,exc,phase,N_int) call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int)
! if(alpha_beta)then call get_single_excitation(det_1,det_2,exc,phase,N_int)
! if (exc(0,1,1) == 1) then if(alpha_beta)then
! ! Mono alpha if (exc(0,1,1) == 1) then
! h1 = exc(1,1,1) ! Mono alpha
! if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return h1 = exc(1,1,1)
! h1 = list_orb_reverse(h1) if(list_orb_reverse(h1).lt.0)return
! p1 = exc(1,2,1) h1 = list_orb_reverse(h1)
! if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return p1 = exc(1,2,1)
! p1 = list_orb_reverse(p1) if(list_orb_reverse(p1).lt.0)return
! do i = 1, n_occ_ab(2) p1 = list_orb_reverse(p1)
! h2 = occ(i,2) do i = 1, n_occ_ab(2)
! if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle h2 = occ(i,2)
! h2 = list_orb_reverse(h2) if(list_orb_reverse(h2).lt.0)return
! big_array(h1,h2,p1,h2) += c_1 * phase h2 = list_orb_reverse(h2)
! enddo nkeys += 1
! else values(nkeys) = c_1 * phase
! ! Mono beta keys(1,nkeys) = h1
! h1 = exc(1,1,2) keys(2,nkeys) = h2
! if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return keys(3,nkeys) = p1
! h1 = list_orb_reverse(h1) keys(4,nkeys) = h2
! p1 = exc(1,2,2) enddo
! if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return else
! p1 = list_orb_reverse(p1) ! Mono beta
! do i = 1, n_occ_ab(1) h1 = exc(1,1,2)
! h2 = occ(i,1) if(list_orb_reverse(h1).lt.0)return
! if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle h1 = list_orb_reverse(h1)
! h2 = list_orb_reverse(h2) p1 = exc(1,2,2)
! big_array(h2,h1,h2,p1) += c_1 * phase if(list_orb_reverse(p1).lt.0)return
! enddo p1 = list_orb_reverse(p1)
! endif do i = 1, n_occ_ab(1)
! else if(spin_trace)then h2 = occ(i,1)
! if (exc(0,1,1) == 1) then if(list_orb_reverse(h2).lt.0)return
! ! Mono alpha h2 = list_orb_reverse(h2)
! h1 = exc(1,1,1) nkeys += 1
! if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return values(nkeys) = c_1 * phase
! h1 = list_orb_reverse(h1) keys(1,nkeys) = h1
! p1 = exc(1,2,1) keys(2,nkeys) = h2
! if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return keys(3,nkeys) = p1
! p1 = list_orb_reverse(p1) keys(4,nkeys) = h2
! do i = 1, n_occ_ab(2) enddo
! h2 = occ(i,2) endif
! if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle else if(spin_trace)then
! h2 = list_orb_reverse(h2) if (exc(0,1,1) == 1) then
! big_array(h1,h2,p1,h2) += 0.5d0 * c_1 * phase ! Mono alpha
! big_array(h2,h1,h2,p1) += 0.5d0 * c_1 * phase h1 = exc(1,1,1)
! enddo if(list_orb_reverse(h1).lt.0)return
! else h1 = list_orb_reverse(h1)
! ! Mono beta p1 = exc(1,2,1)
! h1 = exc(1,1,2) if(list_orb_reverse(p1).lt.0)return
! if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return p1 = list_orb_reverse(p1)
! h1 = list_orb_reverse(h1) do i = 1, n_occ_ab(2)
! p1 = exc(1,2,2) h2 = occ(i,2)
! if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return if(list_orb_reverse(h2).lt.0)return
! p1 = list_orb_reverse(p1) h2 = list_orb_reverse(h2)
! do i = 1, n_occ_ab(1) nkeys += 1
! h2 = occ(i,1) values(nkeys) = 0.5d0 * c_1 * phase
! if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle keys(1,nkeys) = h1
! h2 = list_orb_reverse(h2) keys(2,nkeys) = h2
! big_array(h1,h2,p1,h2) += 0.5d0 * c_1 * phase keys(3,nkeys) = p1
! big_array(h2,h1,h2,p1) += 0.5d0 * c_1 * phase keys(4,nkeys) = h2
! enddo nkeys += 1
! endif values(nkeys) = 0.5d0 * c_1 * phase
! endif keys(1,nkeys) = h2
! end keys(2,nkeys) = h1
keys(3,nkeys) = h2
keys(4,nkeys) = p1
enddo
else
! Mono beta
h1 = exc(1,1,2)
if(list_orb_reverse(h1).lt.0)return
h1 = list_orb_reverse(h1)
p1 = exc(1,2,2)
if(list_orb_reverse(p1).lt.0)return
p1 = list_orb_reverse(p1)
!print*,'****************'
!print*,'****************'
!print*,'h1,p1',h1,p1
do i = 1, n_occ_ab(1)
h2 = occ(i,1)
if(list_orb_reverse(h2).lt.0)return
h2 = list_orb_reverse(h2)
! print*,'h2 = ',h2
nkeys += 1
values(nkeys) = 0.5d0 * c_1 * phase
keys(1,nkeys) = h1
keys(2,nkeys) = h2
keys(3,nkeys) = p1
keys(4,nkeys) = h2
nkeys += 1
values(nkeys) = 0.5d0 * c_1 * phase
keys(1,nkeys) = h2
keys(2,nkeys) = h1
keys(3,nkeys) = h2
keys(4,nkeys) = p1
enddo
endif
endif
end
! subroutine orb_range_off_diagonal_single_to_two_rdm_aa_dm(det_1,det_2,c_1,gorb_bitmask,list_orb_reverse,ispin) ! subroutine orb_range_off_diagonal_single_to_two_rdm_aa_dm(det_1,det_2,c_1,gorb_bitmask,list_orb_reverse,ispin)
! BEGIN_DOC ! BEGIN_DOC