10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-26 14:23:43 +01:00
quantum_package/plugins/shiftedbk/shifted_bk_routines.irp.f

89 lines
2.6 KiB
Fortran
Raw Normal View History

2018-03-26 12:06:18 +02:00
BEGIN_PROVIDER [ double precision, fock_diag_tmp_, (2,mo_tot_num+1,Nproc) ]
&BEGIN_PROVIDER [ double precision, a_h_i, (N_det, Nproc) ]
&BEGIN_PROVIDER [ double precision, a_s2_i, (N_det, Nproc) ]
implicit none
integer :: i
2018-09-26 16:39:57 +02:00
fock_diag_tmp_(:,:,:) = 0.d0
a_h_i = 0d0
a_s2_i = 0d0
END_PROVIDER
2018-03-21 12:06:26 +01:00
2018-04-04 11:32:27 +02:00
subroutine generator_start(i_gen, iproc, interesting)
2018-04-04 11:32:27 +02:00
implicit none
integer, intent(in) :: i_gen, iproc
logical, intent(inout) :: interesting
2018-04-04 11:32:27 +02:00
integer :: i
interesting = .true.
2018-04-04 11:32:27 +02:00
call build_fock_tmp(fock_diag_tmp_(1,1,iproc),psi_det_generators(1,1,i_gen),N_int)
end subroutine
2018-03-26 12:06:18 +02:00
2018-09-26 16:39:57 +02:00
subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minilist, det_minilist, n_minilist, alpha, iproc)
2018-03-23 11:06:52 +01:00
use bitmasks
implicit none
2018-03-26 12:06:18 +02:00
BEGIN_DOC
!delta_ij_loc(:,:,1) : dressing column for H
!delta_ij_loc(:,:,2) : dressing column for S2
2018-09-26 16:39:57 +02:00
!i_gen : generator index in psi_det_generators
2018-05-25 17:40:27 +02:00
!minilist : indices of determinants connected to alpha ( in psi_det )
2018-03-26 12:06:18 +02:00
!n_minilist : size of minilist
!alpha : alpha determinant
END_DOC
2018-09-26 16:39:57 +02:00
integer, intent(in) :: Nint, Ndet, Nstates, n_minilist, iproc, i_gen
2018-03-26 12:06:18 +02:00
integer(bit_kind), intent(in) :: alpha(Nint,2), det_minilist(Nint, 2, n_minilist)
integer,intent(in) :: minilist(n_minilist)
double precision, intent(inout) :: delta_ij_loc(Nstates,N_det,2)
2018-03-23 11:06:52 +01:00
double precision :: hij, sij
2018-03-26 12:06:18 +02:00
double precision, external :: diag_H_mat_elem_fock
2018-09-26 16:39:57 +02:00
double precision :: haa, contrib, c_alpha(N_states)
double precision :: de, a_h_psi(N_states)
2018-03-26 12:06:18 +02:00
double precision :: hdress, sdress
2018-09-26 16:39:57 +02:00
integer :: i, l_sd
2018-03-26 12:06:18 +02:00
2018-09-26 16:39:57 +02:00
haa = diag_H_mat_elem_fock(psi_det_generators(1,1,i_gen),alpha,fock_diag_tmp_(1,1,iproc),N_int)
2018-03-26 12:06:18 +02:00
a_h_psi = 0d0
do l_sd=1,n_minilist
call i_h_j_s2(alpha,det_minilist(1,1,l_sd),N_int,hij, sij)
a_h_i(l_sd, iproc) = hij
a_s2_i(l_sd, iproc) = sij
do i=1,Nstates
a_h_psi(i) += hij * psi_coef(minilist(l_sd), i)
end do
end do
contrib = 0d0
2018-03-26 12:06:18 +02:00
do i=1,Nstates
2018-05-07 15:21:28 +02:00
de = dress_E0_denominator(i) - haa
2018-03-26 12:06:18 +02:00
if(DABS(de) < 1D-5) cycle
2018-04-10 14:25:28 +02:00
c_alpha(i) = a_h_psi(i) / de
contrib = min(contrib, c_alpha(i) * a_h_psi(i))
2018-03-26 12:06:18 +02:00
do l_sd=1,n_minilist
2018-04-10 14:25:28 +02:00
hdress = c_alpha(i) * a_h_i(l_sd, iproc)
sdress = c_alpha(i) * a_s2_i(l_sd, iproc)
2018-03-26 12:06:18 +02:00
delta_ij_loc(i, minilist(l_sd), 1) += hdress
delta_ij_loc(i, minilist(l_sd), 2) += sdress
end do
end do
2018-03-21 12:06:26 +01:00
end subroutine
2018-03-26 12:06:18 +02:00
BEGIN_PROVIDER [ logical, initialize_E0_denominator ]
2018-09-26 16:39:57 +02:00
implicit none
BEGIN_DOC
! If true, initialize pt2_E0_denominator
END_DOC
initialize_E0_denominator = .True.
2018-03-26 12:06:18 +02:00
END_PROVIDER