mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-24 21:41:46 +02:00
MRCC_selected
This commit is contained in:
parent
fb5432abe0
commit
82772b96c7
@ -1,5 +1,44 @@
|
|||||||
use bitmasks
|
use bitmasks
|
||||||
|
|
||||||
|
! BEGIN_PROVIDER [ integer(bit_kind), psi_ref, (N_int,2,psi_det_size) ]
|
||||||
|
!&BEGIN_PROVIDER [ double precision, psi_ref_coef, (psi_det_size,n_states) ]
|
||||||
|
!&BEGIN_PROVIDER [ integer, idx_ref, (psi_det_size) ]
|
||||||
|
!&BEGIN_PROVIDER [ integer, N_det_ref ]
|
||||||
|
! implicit none
|
||||||
|
! BEGIN_DOC
|
||||||
|
! ! Reference wave function, defined as determinants with amplitudes > 0.05
|
||||||
|
! ! idx_ref gives the indice of the ref determinant in psi_det.
|
||||||
|
! END_DOC
|
||||||
|
! integer :: i, k, l
|
||||||
|
! logical :: good
|
||||||
|
! double precision, parameter :: threshold=0.01d0
|
||||||
|
! double precision :: t(N_states)
|
||||||
|
! N_det_ref = 0
|
||||||
|
! do l = 1, N_states
|
||||||
|
! t(l) = threshold * abs_psi_coef_max(l)
|
||||||
|
! enddo
|
||||||
|
! do i=1,N_det
|
||||||
|
! good = .False.
|
||||||
|
! do l=1, N_states
|
||||||
|
! psi_ref_coef(i,l) = 0.d0
|
||||||
|
! good = good.or.(dabs(psi_coef(i,l)) > t(l))
|
||||||
|
! enddo
|
||||||
|
! if (good) then
|
||||||
|
! N_det_ref = N_det_ref+1
|
||||||
|
! do k=1,N_int
|
||||||
|
! psi_ref(k,1,N_det_ref) = psi_det(k,1,i)
|
||||||
|
! psi_ref(k,2,N_det_ref) = psi_det(k,2,i)
|
||||||
|
! enddo
|
||||||
|
! idx_ref(N_det_ref) = i
|
||||||
|
! do k=1,N_states
|
||||||
|
! psi_ref_coef(N_det_ref,k) = psi_coef(i,k)
|
||||||
|
! enddo
|
||||||
|
! endif
|
||||||
|
! enddo
|
||||||
|
! call write_int(output_determinants,N_det_ref, 'Number of determinants in the reference')
|
||||||
|
!
|
||||||
|
!END_PROVIDER
|
||||||
|
|
||||||
BEGIN_PROVIDER [ integer(bit_kind), psi_ref, (N_int,2,psi_det_size) ]
|
BEGIN_PROVIDER [ integer(bit_kind), psi_ref, (N_int,2,psi_det_size) ]
|
||||||
&BEGIN_PROVIDER [ double precision, psi_ref_coef, (psi_det_size,n_states) ]
|
&BEGIN_PROVIDER [ double precision, psi_ref_coef, (psi_det_size,n_states) ]
|
||||||
&BEGIN_PROVIDER [ integer, idx_ref, (psi_det_size) ]
|
&BEGIN_PROVIDER [ integer, idx_ref, (psi_det_size) ]
|
||||||
@ -10,30 +49,16 @@ use bitmasks
|
|||||||
! idx_ref gives the indice of the ref determinant in psi_det.
|
! idx_ref gives the indice of the ref determinant in psi_det.
|
||||||
END_DOC
|
END_DOC
|
||||||
integer :: i, k, l
|
integer :: i, k, l
|
||||||
logical :: good
|
double precision, parameter :: threshold=0.01d0
|
||||||
double precision, parameter :: threshold=0.05d0
|
|
||||||
double precision :: t(N_states)
|
call find_reference(threshold, N_det_ref, idx_ref)
|
||||||
N_det_ref = 0
|
do l=1,N_states
|
||||||
do l = 1, N_states
|
do i=1,N_det_ref
|
||||||
t(l) = threshold * abs_psi_coef_max(l)
|
psi_ref_coef(i,l) = psi_coef(idx_ref(i), l)
|
||||||
enddo
|
|
||||||
do i=1,N_det
|
|
||||||
good = .False.
|
|
||||||
do l=1, N_states
|
|
||||||
psi_ref_coef(i,l) = 0.d0
|
|
||||||
good = good.or.(dabs(psi_coef(i,l)) > t(l))
|
|
||||||
enddo
|
enddo
|
||||||
if (good) then
|
enddo
|
||||||
N_det_ref = N_det_ref+1
|
do i=1,N_det_ref
|
||||||
do k=1,N_int
|
psi_ref(:,:,i) = psi_det(:,:,idx_ref(i))
|
||||||
psi_ref(k,1,N_det_ref) = psi_det(k,1,i)
|
|
||||||
psi_ref(k,2,N_det_ref) = psi_det(k,2,i)
|
|
||||||
enddo
|
|
||||||
idx_ref(N_det_ref) = i
|
|
||||||
do k=1,N_states
|
|
||||||
psi_ref_coef(N_det_ref,k) = psi_coef(i,k)
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
enddo
|
enddo
|
||||||
call write_int(output_determinants,N_det_ref, 'Number of determinants in the reference')
|
call write_int(output_determinants,N_det_ref, 'Number of determinants in the reference')
|
||||||
|
|
||||||
|
@ -534,63 +534,9 @@ END_PROVIDER
|
|||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
! BEGIN_PROVIDER [ double precision, delta_cas, (N_det_ref, N_det_ref, N_states) ]
|
|
||||||
! use bitmasks
|
|
||||||
! implicit none
|
|
||||||
! integer :: i,j,k
|
|
||||||
! double precision :: Hjk, Hki, Hij, pre(N_det_ref), wall
|
|
||||||
! integer :: i_state, degree, npre, ipre(N_det_ref), npres(N_det_ref)
|
|
||||||
!
|
|
||||||
! ! provide lambda_mrcc
|
|
||||||
! npres = 0
|
|
||||||
! delta_cas = 0d0
|
|
||||||
! call wall_time(wall)
|
|
||||||
! print *, "dcas ", wall
|
|
||||||
! do i_state = 1, N_states
|
|
||||||
! !!$OMP PARALLEL DO default(none) schedule(dynamic) private(pre,npre,ipre,j,k,Hjk,Hki,degree) shared(npres,lambda_mrcc,i_state, N_det_non_ref,psi_ref, psi_non_ref,N_int,delta_cas,N_det_ref)
|
|
||||||
! do k=1,N_det_non_ref
|
|
||||||
! if(lambda_mrcc(i_state, k) == 0d0) cycle
|
|
||||||
! npre = 0
|
|
||||||
! do i=1,N_det_ref
|
|
||||||
! call i_h_j(psi_non_ref(1,1,k),psi_ref(1,1,i), N_int,Hki)
|
|
||||||
! if(Hki /= 0d0) then
|
|
||||||
! !!$OMP ATOMIC
|
|
||||||
! npres(i) += 1
|
|
||||||
! npre += 1
|
|
||||||
! ipre(npre) = i
|
|
||||||
! pre(npre) = Hki
|
|
||||||
! end if
|
|
||||||
! end do
|
|
||||||
!
|
|
||||||
!
|
|
||||||
! do i=1,npre
|
|
||||||
! do j=1,i
|
|
||||||
! !!$OMP ATOMIC
|
|
||||||
! delta_cas(ipre(i),ipre(j),i_state) += pre(i) * pre(j) * lambda_mrcc(i_state, k)
|
|
||||||
! end do
|
|
||||||
! end do
|
|
||||||
! end do
|
|
||||||
! !!$OMP END PARALLEL DO
|
|
||||||
! npre=0
|
|
||||||
! do i=1,N_det_ref
|
|
||||||
! npre += npres(i)
|
|
||||||
! end do
|
|
||||||
! !stop
|
|
||||||
! do i=1,N_det_ref
|
|
||||||
! do j=1,i
|
|
||||||
! delta_cas(j,i,i_state) = delta_cas(i,j,i_state)
|
|
||||||
! end do
|
|
||||||
! end do
|
|
||||||
! end do
|
|
||||||
!
|
|
||||||
! call wall_time(wall)
|
|
||||||
! print *, "dcas", wall
|
|
||||||
! ! stop
|
|
||||||
! END_PROVIDER
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, delta_ref, (N_det_ref, N_det_ref, N_states) ]
|
||||||
BEGIN_PROVIDER [ double precision, delta_cas, (N_det_ref, N_det_ref, N_states) ]
|
&BEGIN_PROVIDER [ double precision, delta_ref_s2, (N_det_ref, N_det_ref, N_states) ]
|
||||||
&BEGIN_PROVIDER [ double precision, delta_cas_s2, (N_det_ref, N_det_ref, N_states) ]
|
|
||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
integer :: i,j,k
|
integer :: i,j,k
|
||||||
@ -600,22 +546,22 @@ END_PROVIDER
|
|||||||
|
|
||||||
provide lambda_mrcc dIj
|
provide lambda_mrcc dIj
|
||||||
do i_state = 1, N_states
|
do i_state = 1, N_states
|
||||||
!$OMP PARALLEL DO default(none) schedule(dynamic) private(j,k,Sjk,Hjk,Hki,degree) shared(lambda_mrcc,i_state, N_det_non_ref,psi_ref, psi_non_ref,N_int,delta_cas,delta_cas_s2,N_det_ref,dij)
|
!$OMP PARALLEL DO default(none) schedule(dynamic) private(j,k,Sjk,Hjk,Hki,degree) shared(lambda_mrcc,i_state, N_det_non_ref,psi_ref, psi_non_ref,N_int,delta_ref,delta_ref_s2,N_det_ref,dij)
|
||||||
do i=1,N_det_ref
|
do i=1,N_det_ref
|
||||||
do j=1,i
|
do j=1,i
|
||||||
call get_excitation_degree(psi_ref(1,1,i), psi_ref(1,1,j), degree, N_int)
|
call get_excitation_degree(psi_ref(1,1,i), psi_ref(1,1,j), degree, N_int)
|
||||||
delta_cas(i,j,i_state) = 0d0
|
delta_ref(i,j,i_state) = 0d0
|
||||||
delta_cas_s2(i,j,i_state) = 0d0
|
delta_ref_s2(i,j,i_state) = 0d0
|
||||||
do k=1,N_det_non_ref
|
do k=1,N_det_non_ref
|
||||||
|
|
||||||
call i_h_j(psi_ref(1,1,j), psi_non_ref(1,1,k),N_int,Hjk)
|
call i_h_j(psi_ref(1,1,j), psi_non_ref(1,1,k),N_int,Hjk)
|
||||||
call get_s2(psi_ref(1,1,j), psi_non_ref(1,1,k),N_int,Sjk)
|
call get_s2(psi_ref(1,1,j), psi_non_ref(1,1,k),N_int,Sjk)
|
||||||
|
|
||||||
delta_cas(i,j,i_state) += Hjk * dij(i, k, i_state) ! * Hki * lambda_mrcc(i_state, k)
|
delta_ref(i,j,i_state) += Hjk * dij(i, k, i_state) ! * Hki * lambda_mrcc(i_state, k)
|
||||||
delta_cas_s2(i,j,i_state) += Sjk * dij(i, k, i_state) ! * Ski * lambda_mrcc(i_state, k)
|
delta_ref_s2(i,j,i_state) += Sjk * dij(i, k, i_state) ! * Ski * lambda_mrcc(i_state, k)
|
||||||
end do
|
end do
|
||||||
delta_cas(j,i,i_state) = delta_cas(i,j,i_state)
|
delta_ref(j,i,i_state) = delta_ref(i,j,i_state)
|
||||||
delta_cas_s2(j,i,i_state) = delta_cas_s2(i,j,i_state)
|
delta_ref_s2(j,i,i_state) = delta_ref_s2(i,j,i_state)
|
||||||
end do
|
end do
|
||||||
end do
|
end do
|
||||||
!$OMP END PARALLEL DO
|
!$OMP END PARALLEL DO
|
||||||
@ -739,7 +685,7 @@ end function
|
|||||||
!$OMP PARALLEL DO default(none) schedule(dynamic) shared(delta_mrcepa0_ij, delta_mrcepa0_ii, delta_mrcepa0_ij_s2, delta_mrcepa0_ii_s2) &
|
!$OMP PARALLEL DO default(none) schedule(dynamic) shared(delta_mrcepa0_ij, delta_mrcepa0_ii, delta_mrcepa0_ij_s2, delta_mrcepa0_ii_s2) &
|
||||||
!$OMP private(m,i,II,J,k,degree,myActive,made_hole,made_particle,hjk,contrib,contrib2,contrib_s2,contrib2_s2) &
|
!$OMP private(m,i,II,J,k,degree,myActive,made_hole,made_particle,hjk,contrib,contrib2,contrib_s2,contrib2_s2) &
|
||||||
!$OMP shared(active_sorb, psi_non_ref, psi_non_ref_coef, psi_ref, psi_ref_coef, cepa0_shortcut, det_cepa0_active) &
|
!$OMP shared(active_sorb, psi_non_ref, psi_non_ref_coef, psi_ref, psi_ref_coef, cepa0_shortcut, det_cepa0_active) &
|
||||||
!$OMP shared(N_det_ref, N_det_non_ref,N_int,det_cepa0_idx,lambda_mrcc,det_ref_active, delta_cas, delta_cas_s2) &
|
!$OMP shared(N_det_ref, N_det_non_ref,N_int,det_cepa0_idx,lambda_mrcc,det_ref_active, delta_ref, delta_ref_s2) &
|
||||||
!$OMP shared(notf,i_state, sortRef, sortRefIdx, dij)
|
!$OMP shared(notf,i_state, sortRef, sortRefIdx, dij)
|
||||||
do blok=1,cepa0_shortcut(0)
|
do blok=1,cepa0_shortcut(0)
|
||||||
do i=cepa0_shortcut(blok), cepa0_shortcut(blok+1)-1
|
do i=cepa0_shortcut(blok), cepa0_shortcut(blok+1)-1
|
||||||
@ -781,8 +727,8 @@ end function
|
|||||||
notf = notf+1
|
notf = notf+1
|
||||||
|
|
||||||
! call i_h_j(psi_non_ref(1,1,det_cepa0_idx(k)),psi_ref(1,1,J),N_int,HJk)
|
! call i_h_j(psi_non_ref(1,1,det_cepa0_idx(k)),psi_ref(1,1,J),N_int,HJk)
|
||||||
contrib = delta_cas(II, J, i_state) * dij(J, det_cepa0_idx(k), i_state)
|
contrib = delta_ref(II, J, i_state) * dij(J, det_cepa0_idx(k), i_state)
|
||||||
contrib_s2 = delta_cas_s2(II, J, i_state) * dij(J, det_cepa0_idx(k), i_state)
|
contrib_s2 = delta_ref_s2(II, J, i_state) * dij(J, det_cepa0_idx(k), i_state)
|
||||||
|
|
||||||
if(dabs(psi_ref_coef(J,i_state)).ge.1.d-3) then
|
if(dabs(psi_ref_coef(J,i_state)).ge.1.d-3) then
|
||||||
contrib2 = contrib / psi_ref_coef(J, i_state) * psi_non_ref_coef(det_cepa0_idx(i),i_state)
|
contrib2 = contrib / psi_ref_coef(J, i_state) * psi_non_ref_coef(det_cepa0_idx(i),i_state)
|
||||||
@ -828,7 +774,7 @@ END_PROVIDER
|
|||||||
|
|
||||||
integer :: II, blok
|
integer :: II, blok
|
||||||
|
|
||||||
provide delta_cas lambda_mrcc
|
provide delta_ref lambda_mrcc
|
||||||
allocate(idx_sorted_bit(N_det))
|
allocate(idx_sorted_bit(N_det))
|
||||||
idx_sorted_bit(:) = -1
|
idx_sorted_bit(:) = -1
|
||||||
do i=1,N_det_non_ref
|
do i=1,N_det_non_ref
|
||||||
|
@ -8,7 +8,6 @@ program mrsc2sub
|
|||||||
|
|
||||||
read_wf = .True.
|
read_wf = .True.
|
||||||
SOFT_TOUCH read_wf
|
SOFT_TOUCH read_wf
|
||||||
call print_cas_coefs
|
|
||||||
call set_generators_bitmasks_as_holes_and_particles
|
call set_generators_bitmasks_as_holes_and_particles
|
||||||
call run(N_states,energy)
|
call run(N_states,energy)
|
||||||
if(do_pt2_end)then
|
if(do_pt2_end)then
|
||||||
|
@ -60,16 +60,17 @@ subroutine run(N_st,energy)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
subroutine print_cas_coefs
|
subroutine print_ref_coefs
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: i,j
|
integer :: i,j
|
||||||
print *, 'CAS'
|
print *, 'Reference'
|
||||||
print *, '==='
|
print *, '========='
|
||||||
do i=1,N_det_cas
|
do i=1,N_det_ref
|
||||||
print *, (psi_cas_coef(i,j), j=1,N_states)
|
print *, (psi_ref_coef(i,j), j=1,N_states)
|
||||||
call debug_det(psi_cas(1,1,i),N_int)
|
call debug_det(psi_ref(1,1,i),N_int)
|
||||||
enddo
|
enddo
|
||||||
|
print *, ''
|
||||||
call write_double(6,ci_energy(1),"Initial CI energy")
|
call write_double(6,ci_energy(1),"Initial CI energy")
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -202,7 +203,7 @@ subroutine run_pt2(N_st,energy)
|
|||||||
|
|
||||||
print*,'Last iteration only to compute the PT2'
|
print*,'Last iteration only to compute the PT2'
|
||||||
|
|
||||||
N_det_generators = N_det_cas
|
N_det_generators = N_det_ref
|
||||||
N_det_selectors = N_det_non_ref
|
N_det_selectors = N_det_non_ref
|
||||||
|
|
||||||
do i=1,N_det_generators
|
do i=1,N_det_generators
|
||||||
|
@ -32,20 +32,20 @@ subroutine H_u_0_nstates(v_0,u_0,H_jj,n,keys_tmp,Nint,N_st,sze_8)
|
|||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Computes v_0 = H|u_0>
|
! Computes v_0 = H|u_0>
|
||||||
!
|
!
|
||||||
! n : number of determinants
|
! n : number of determinants
|
||||||
!
|
!
|
||||||
! H_jj : array of <j|H|j>
|
! H_jj : array of <j|H|j>
|
||||||
|
!
|
||||||
END_DOC
|
END_DOC
|
||||||
integer, intent(in) :: N_st,n,Nint, sze_8
|
integer, intent(in) :: N_st,n,Nint, sze_8
|
||||||
double precision, intent(out) :: v_0(sze_8,N_st)
|
double precision, intent(out) :: v_0(sze_8,N_st)
|
||||||
double precision, intent(in) :: u_0(sze_8,N_st)
|
double precision, intent(in) :: u_0(sze_8,N_st)
|
||||||
double precision, intent(in) :: H_jj(n)
|
double precision, intent(in) :: H_jj(n)
|
||||||
integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n)
|
integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n)
|
||||||
double precision :: hij
|
double precision :: hij,s2
|
||||||
double precision, allocatable :: vt(:,:)
|
double precision, allocatable :: vt(:,:), ut(:,:), st(:,:)
|
||||||
double precision, allocatable :: ut(:,:)
|
|
||||||
integer :: i,j,k,l, jj,ii
|
integer :: i,j,k,l, jj,ii
|
||||||
integer :: i0, j0
|
integer :: i0, j0
|
||||||
|
|
||||||
@ -57,77 +57,41 @@ subroutine H_u_0_nstates(v_0,u_0,H_jj,n,keys_tmp,Nint,N_st,sze_8)
|
|||||||
integer :: N_st_8
|
integer :: N_st_8
|
||||||
|
|
||||||
integer, external :: align_double
|
integer, external :: align_double
|
||||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: vt, ut
|
integer :: blockb, blockb2, istep
|
||||||
|
double precision :: ave_workload, workload, target_workload_inv
|
||||||
|
|
||||||
|
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: vt, ut, st
|
||||||
|
|
||||||
N_st_8 = align_double(N_st)
|
N_st_8 = align_double(N_st)
|
||||||
|
|
||||||
ASSERT (Nint > 0)
|
ASSERT (Nint > 0)
|
||||||
ASSERT (Nint == N_int)
|
ASSERT (Nint == N_int)
|
||||||
ASSERT (n>0)
|
ASSERT (n>0)
|
||||||
PROVIDE ref_bitmask_energy
|
PROVIDE ref_bitmask_energy
|
||||||
|
|
||||||
allocate (shortcut(0:n+1,2), sort_idx(n,2), sorted(Nint,n,2), version(Nint,n,2))
|
allocate (shortcut(0:n+1,2), sort_idx(n,2), sorted(Nint,n,2), version(Nint,n,2))
|
||||||
allocate(ut(N_st_8,n))
|
allocate( ut(N_st_8,n))
|
||||||
|
|
||||||
v_0 = 0.d0
|
v_0 = 0.d0
|
||||||
|
|
||||||
do i=1,n
|
|
||||||
do istate=1,N_st
|
|
||||||
ut(istate,i) = u_0(i,istate)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
call sort_dets_ab_v(keys_tmp, sorted(1,1,1), sort_idx(1,1), shortcut(0,1), version(1,1,1), n, Nint)
|
call sort_dets_ab_v(keys_tmp, sorted(1,1,1), sort_idx(1,1), shortcut(0,1), version(1,1,1), n, Nint)
|
||||||
call sort_dets_ba_v(keys_tmp, sorted(1,1,2), sort_idx(1,2), shortcut(0,2), version(1,1,2), n, Nint)
|
call sort_dets_ba_v(keys_tmp, sorted(1,1,2), sort_idx(1,2), shortcut(0,2), version(1,1,2), n, Nint)
|
||||||
|
|
||||||
!$OMP PARALLEL DEFAULT(NONE) &
|
!$OMP PARALLEL DEFAULT(NONE) &
|
||||||
!$OMP PRIVATE(i,hij,j,k,jj,vt,ii,sh,sh2,ni,exa,ext,org_i,org_j,endi,sorted_i,istate)&
|
!$OMP PRIVATE(i,hij,s2,j,k,jj,vt,st,ii,sh,sh2,ni,exa,ext,org_i,org_j,endi,sorted_i,istate)&
|
||||||
!$OMP SHARED(n,H_jj,keys_tmp,ut,Nint,v_0,sorted,shortcut,sort_idx,version,N_st,N_st_8)
|
!$OMP SHARED(n,keys_tmp,ut,Nint,u_0,v_0,sorted,shortcut,sort_idx,version,N_st,N_st_8)
|
||||||
allocate(vt(N_st_8,n))
|
allocate(vt(N_st_8,n),st(N_st_8,n))
|
||||||
Vt = 0.d0
|
Vt = 0.d0
|
||||||
|
St = 0.d0
|
||||||
!$OMP DO SCHEDULE(dynamic)
|
|
||||||
do sh=1,shortcut(0,1)
|
!$OMP DO
|
||||||
do sh2=1,shortcut(0,1)
|
do i=1,n
|
||||||
exa = popcnt(xor(version(1,sh,1), version(1,sh2,1)))
|
do istate=1,N_st
|
||||||
if(exa > 2) then
|
ut(istate,i) = u_0(sort_idx(i,2),istate)
|
||||||
cycle
|
|
||||||
end if
|
|
||||||
do ni=2,Nint
|
|
||||||
exa = exa + popcnt(xor(version(ni,sh,1), version(ni,sh2,1)))
|
|
||||||
end do
|
|
||||||
if(exa > 2) then
|
|
||||||
cycle
|
|
||||||
end if
|
|
||||||
|
|
||||||
do i=shortcut(sh,1),shortcut(sh+1,1)-1
|
|
||||||
org_i = sort_idx(i,1)
|
|
||||||
do ni=1,Nint
|
|
||||||
sorted_i(ni) = sorted(ni,i,1)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
jloop: do j=shortcut(sh2,1),shortcut(sh2+1,1)-1
|
|
||||||
org_j = sort_idx(j,1)
|
|
||||||
ext = exa + popcnt(xor(sorted_i(1), sorted(1,j,1)))
|
|
||||||
if(ext > 4) then
|
|
||||||
cycle jloop
|
|
||||||
endif
|
|
||||||
do ni=2,Nint
|
|
||||||
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1)))
|
|
||||||
if(ext > 4) then
|
|
||||||
cycle jloop
|
|
||||||
endif
|
|
||||||
end do
|
|
||||||
call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij)
|
|
||||||
do istate=1,N_st
|
|
||||||
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,org_j)
|
|
||||||
enddo
|
|
||||||
enddo jloop
|
|
||||||
enddo
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
!$OMP END DO NOWAIT
|
!$OMP END DO
|
||||||
|
|
||||||
!$OMP DO SCHEDULE(dynamic)
|
!$OMP DO SCHEDULE(dynamic)
|
||||||
do sh=1,shortcut(0,2)
|
do sh=1,shortcut(0,2)
|
||||||
do i=shortcut(sh,2),shortcut(sh+1,2)-1
|
do i=shortcut(sh,2),shortcut(sh+1,2)-1
|
||||||
@ -135,40 +99,164 @@ subroutine H_u_0_nstates(v_0,u_0,H_jj,n,keys_tmp,Nint,N_st,sze_8)
|
|||||||
do j=shortcut(sh,2),shortcut(sh+1,2)-1
|
do j=shortcut(sh,2),shortcut(sh+1,2)-1
|
||||||
org_j = sort_idx(j,2)
|
org_j = sort_idx(j,2)
|
||||||
ext = popcnt(xor(sorted(1,i,2), sorted(1,j,2)))
|
ext = popcnt(xor(sorted(1,i,2), sorted(1,j,2)))
|
||||||
|
if (ext > 4) cycle
|
||||||
do ni=2,Nint
|
do ni=2,Nint
|
||||||
ext = ext + popcnt(xor(sorted(ni,i,2), sorted(ni,j,2)))
|
ext = ext + popcnt(xor(sorted(ni,i,2), sorted(ni,j,2)))
|
||||||
|
if (ext > 4) exit
|
||||||
end do
|
end do
|
||||||
if(ext /= 4) then
|
if(ext == 4) then
|
||||||
cycle
|
call i_h_j (keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,hij)
|
||||||
endif
|
call get_s2(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,s2)
|
||||||
call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij)
|
do istate=1,n_st
|
||||||
do istate=1,N_st
|
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,j)
|
||||||
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,org_j)
|
st (istate,org_i) = st (istate,org_i) + s2*ut(istate,j)
|
||||||
enddo
|
enddo
|
||||||
|
end if
|
||||||
end do
|
end do
|
||||||
end do
|
end do
|
||||||
enddo
|
enddo
|
||||||
!$OMP END DO NOWAIT
|
!$OMP END DO
|
||||||
|
|
||||||
!$OMP CRITICAL
|
!$OMP DO
|
||||||
|
do i=1,n
|
||||||
|
do istate=1,N_st
|
||||||
|
ut(istate,i) = u_0(sort_idx(i,1),istate)
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
!$OMP END DO
|
||||||
|
|
||||||
|
!$OMP DO SCHEDULE(dynamic)
|
||||||
|
do sh=1,shortcut(0,1)
|
||||||
|
do sh2=1,shortcut(0,1)
|
||||||
|
if (sh==sh2) cycle
|
||||||
|
|
||||||
|
exa = 0
|
||||||
|
do ni=1,Nint
|
||||||
|
exa = exa + popcnt(xor(version(ni,sh,1), version(ni,sh2,1)))
|
||||||
|
end do
|
||||||
|
if(exa > 2) then
|
||||||
|
cycle
|
||||||
|
end if
|
||||||
|
|
||||||
|
do i=shortcut(sh,1),shortcut(sh+1,1)-1
|
||||||
|
org_i = sort_idx(i,1)
|
||||||
|
do ni=1,Nint
|
||||||
|
sorted_i(ni) = sorted(ni,i,1)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
do j=shortcut(sh2,1),shortcut(sh2+1,1)-1
|
||||||
|
ext = exa + popcnt(xor(sorted_i(1), sorted(1,j,1)))
|
||||||
|
if (ext > 4) cycle
|
||||||
|
do ni=2,Nint
|
||||||
|
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1)))
|
||||||
|
if (ext > 4) exit
|
||||||
|
end do
|
||||||
|
if(ext <= 4) then
|
||||||
|
org_j = sort_idx(j,1)
|
||||||
|
call i_h_j (keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,hij)
|
||||||
|
if (hij /= 0.d0) then
|
||||||
|
do istate=1,n_st
|
||||||
|
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
if (ext /= 2) then
|
||||||
|
call get_s2(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,s2)
|
||||||
|
if (s2 /= 0.d0) then
|
||||||
|
do istate=1,n_st
|
||||||
|
st (istate,org_i) = st (istate,org_i) + s2*ut(istate,j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
|
||||||
|
exa = 0
|
||||||
|
|
||||||
|
do i=shortcut(sh,1),shortcut(sh+1,1)-1
|
||||||
|
org_i = sort_idx(i,1)
|
||||||
|
do ni=1,Nint
|
||||||
|
sorted_i(ni) = sorted(ni,i,1)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
do j=shortcut(sh,1),i-1
|
||||||
|
ext = exa + popcnt(xor(sorted_i(1), sorted(1,j,1)))
|
||||||
|
if (ext > 4) cycle
|
||||||
|
do ni=2,Nint
|
||||||
|
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1)))
|
||||||
|
if (ext > 4) exit
|
||||||
|
end do
|
||||||
|
if(ext <= 4) then
|
||||||
|
org_j = sort_idx(j,1)
|
||||||
|
call i_h_j (keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,hij)
|
||||||
|
if (hij /= 0.d0) then
|
||||||
|
do istate=1,n_st
|
||||||
|
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
if (ext /= 2) then
|
||||||
|
call get_s2(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,s2)
|
||||||
|
if (s2 /= 0.d0) then
|
||||||
|
do istate=1,n_st
|
||||||
|
st (istate,org_i) = st (istate,org_i) + s2*ut(istate,j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
|
||||||
|
do j=i+1,shortcut(sh+1,1)-1
|
||||||
|
if (i==j) cycle
|
||||||
|
ext = exa + popcnt(xor(sorted_i(1), sorted(1,j,1)))
|
||||||
|
if (ext > 4) cycle
|
||||||
|
do ni=2,Nint
|
||||||
|
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1)))
|
||||||
|
if (ext > 4) exit
|
||||||
|
end do
|
||||||
|
if(ext <= 4) then
|
||||||
|
org_j = sort_idx(j,1)
|
||||||
|
call i_h_j (keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,hij)
|
||||||
|
if (hij /= 0.d0) then
|
||||||
|
do istate=1,n_st
|
||||||
|
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
if (ext /= 2) then
|
||||||
|
call get_s2(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),nint,s2)
|
||||||
|
if (s2 /= 0.d0) then
|
||||||
|
do istate=1,n_st
|
||||||
|
st (istate,org_i) = st (istate,org_i) + s2*ut(istate,j)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
!$OMP END DO
|
||||||
|
|
||||||
|
!$OMP CRITICAL (u0Hu0)
|
||||||
do istate=1,N_st
|
do istate=1,N_st
|
||||||
do i=n,1,-1
|
do i=1,n
|
||||||
v_0(i,istate) = v_0(i,istate) + vt(istate,i)
|
v_0(i,istate) = v_0(i,istate) + vt(istate,i)
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
!$OMP END CRITICAL
|
!$OMP END CRITICAL (u0Hu0)
|
||||||
|
|
||||||
deallocate(vt)
|
deallocate(vt,st)
|
||||||
!$OMP END PARALLEL
|
!$OMP END PARALLEL
|
||||||
|
|
||||||
do istate=1,N_st
|
do istate=1,N_st
|
||||||
do i=1,n
|
do i=1,n
|
||||||
v_0(i,istate) += H_jj(i) * u_0(i,istate)
|
v_0(i,istate) = v_0(i,istate) + H_jj(i) * u_0(i,istate)
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
deallocate (shortcut, sort_idx, sorted, version, ut)
|
deallocate (shortcut, sort_idx, sorted, version, ut)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, psi_energy, (N_states) ]
|
BEGIN_PROVIDER [ double precision, psi_energy, (N_states) ]
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
|
@ -19,6 +19,15 @@ subroutine build_fock_tmp(fock_diag_tmp,det_ref,Nint)
|
|||||||
fock_diag_tmp = 0.d0
|
fock_diag_tmp = 0.d0
|
||||||
E0 = 0.d0
|
E0 = 0.d0
|
||||||
|
|
||||||
|
if (Ne(1) /= elec_alpha_num) then
|
||||||
|
print *, 'Error in build_fock_tmp (alpha)', Ne(1), Ne(2)
|
||||||
|
stop -1
|
||||||
|
endif
|
||||||
|
if (Ne(2) /= elec_beta_num) then
|
||||||
|
print *, 'Error in build_fock_tmp (beta)', Ne(1), Ne(2)
|
||||||
|
stop -1
|
||||||
|
endif
|
||||||
|
|
||||||
! Occupied MOs
|
! Occupied MOs
|
||||||
do ii=1,elec_alpha_num
|
do ii=1,elec_alpha_num
|
||||||
i = occ(ii,1)
|
i = occ(ii,1)
|
||||||
|
Loading…
Reference in New Issue
Block a user