9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-09 06:53:38 +01:00
qp2/plugins/local/slater_tc/slater_tc_opt.irp.f

229 lines
5.7 KiB
Fortran
Raw Normal View History

2023-07-02 15:29:21 +02:00
2023-06-04 09:19:34 +02:00
! ---
subroutine provide_all_three_ints_bi_ortho()
BEGIN_DOC
2023-09-20 15:16:10 +02:00
! routine that provides all necessary three-electron integrals
2023-06-04 09:19:34 +02:00
END_DOC
implicit none
2024-03-01 13:37:46 +01:00
double precision :: t1, t2
2023-09-20 15:16:10 +02:00
PROVIDE ao_two_e_integrals_in_map
2023-06-04 09:19:34 +02:00
2024-03-01 13:37:46 +01:00
print *, ' start provide_all_three_ints_bi_ortho'
call wall_time(t1)
2023-06-04 09:19:34 +02:00
if(three_body_h_tc) then
if(three_e_3_idx_term) then
PROVIDE three_e_3_idx_direct_bi_ort three_e_3_idx_cycle_1_bi_ort three_e_3_idx_cycle_2_bi_ort
PROVIDE three_e_3_idx_exch23_bi_ort three_e_3_idx_exch13_bi_ort three_e_3_idx_exch12_bi_ort
endif
if(three_e_4_idx_term) then
2023-09-20 15:16:10 +02:00
PROVIDE three_e_4_idx_direct_bi_ort three_e_4_idx_cycle_1_bi_ort three_e_4_idx_exch23_bi_ort three_e_4_idx_exch13_bi_ort
2023-06-04 09:19:34 +02:00
endif
2023-09-15 11:37:11 +02:00
if(pure_three_body_h_tc)then
provide three_body_ints_bi_ort
endif
2023-06-04 09:19:34 +02:00
2023-06-04 09:58:29 +02:00
if(.not. double_normal_ord .and. three_e_5_idx_term) then
2023-09-20 15:16:10 +02:00
PROVIDE three_e_5_idx_direct_bi_ort
2023-06-04 09:19:34 +02:00
elseif(double_normal_ord .and. (.not. three_e_5_idx_term)) then
PROVIDE normal_two_body_bi_orth
endif
2023-07-02 15:29:21 +02:00
endif
2023-06-04 09:19:34 +02:00
2024-03-01 13:37:46 +01:00
call wall_time(t2)
print *, ' end provide_all_three_ints_bi_ortho after (min) = ', (t2-t1)/60.d0
2023-07-02 15:29:21 +02:00
return
end
2023-06-04 09:19:34 +02:00
! ---
2023-02-07 17:07:49 +01:00
subroutine htilde_mu_mat_opt_bi_ortho_tot(key_j, key_i, Nint, htot)
2023-09-12 20:43:54 +02:00
implicit none
2023-02-07 17:07:49 +01:00
BEGIN_DOC
!
2023-06-29 18:31:48 +02:00
! <key_j |H_tilde | key_i> where |key_j> is developed on the LEFT basis and |key_i> is developed on the RIGHT basis
2023-02-07 17:07:49 +01:00
!!
2023-09-20 15:16:10 +02:00
! Returns the total matrix element
2023-02-07 17:07:49 +01:00
!! WARNING !!
2023-09-20 15:16:10 +02:00
!
2023-02-07 17:07:49 +01:00
! Non hermitian !!
!
END_DOC
use bitmasks
2023-07-02 21:49:25 +02:00
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key_i(Nint,2), key_j(Nint,2)
double precision, intent(out) :: htot
2023-09-16 00:28:18 +02:00
double precision :: hmono, htwoe, hthree
2023-07-02 21:49:25 +02:00
call htilde_mu_mat_opt_bi_ortho(key_j, key_i, Nint, hmono, htwoe, hthree, htot)
2023-02-07 17:07:49 +01:00
end
2023-07-02 21:49:25 +02:00
! ---
2023-02-07 17:07:49 +01:00
subroutine htilde_mu_mat_opt_bi_ortho(key_j, key_i, Nint, hmono, htwoe, hthree, htot)
2023-07-02 21:49:25 +02:00
2023-02-07 17:07:49 +01:00
BEGIN_DOC
!
2023-06-29 18:31:48 +02:00
! <key_j |H_tilde | key_i> where |key_j> is developed on the LEFT basis and |key_i> is developed on the RIGHT basis
2023-02-07 17:07:49 +01:00
!!
2023-09-20 15:16:10 +02:00
! Returns the detail of the matrix element in terms of single, two and three electron contribution.
2023-02-07 17:07:49 +01:00
!! WARNING !!
2023-09-20 15:16:10 +02:00
!
2023-02-07 17:07:49 +01:00
! Non hermitian !!
!
END_DOC
use bitmasks
implicit none
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key_i(Nint,2), key_j(Nint,2)
double precision, intent(out) :: hmono, htwoe, hthree, htot
2024-03-01 13:37:46 +01:00
2023-09-20 15:16:10 +02:00
integer :: degree
2023-02-07 17:07:49 +01:00
2024-03-01 13:37:46 +01:00
PROVIDE pure_three_body_h_tc
2023-02-07 17:07:49 +01:00
hmono = 0.d0
htwoe = 0.d0
htot = 0.d0
2023-09-12 20:43:54 +02:00
hthree = 0.d0
2023-02-07 17:07:49 +01:00
call get_excitation_degree(key_i, key_j, degree, Nint)
2023-09-16 00:28:18 +02:00
if(.not.pure_three_body_h_tc) then
if(degree .gt. 2) return
2023-09-20 15:16:10 +02:00
2023-09-16 00:28:18 +02:00
if(degree == 0) then
call diag_htilde_mu_mat_fock_bi_ortho (Nint, key_i, hmono, htwoe, hthree, htot)
else if (degree == 1) then
2024-03-01 13:37:46 +01:00
call single_htilde_mu_mat_fock_bi_ortho(Nint, key_j, key_i, hmono, htwoe, hthree, htot)
2023-09-16 00:28:18 +02:00
else if(degree == 2) then
call double_htilde_mu_mat_fock_bi_ortho(Nint, key_j, key_i, hmono, htwoe, hthree, htot)
endif
2023-09-20 15:16:10 +02:00
else
2023-09-16 00:28:18 +02:00
if(degree .gt. 3) return
if(degree == 0) then
call diag_htilde_mu_mat_fock_bi_ortho (Nint, key_i, hmono, htwoe, hthree, htot)
else if (degree == 1) then
2024-03-01 13:37:46 +01:00
call single_htilde_mu_mat_fock_bi_ortho(Nint, key_j, key_i, hmono, htwoe, hthree, htot)
2023-09-16 00:28:18 +02:00
else if(degree == 2) then
call double_htilde_mu_mat_fock_bi_ortho(Nint, key_j, key_i, hmono, htwoe, hthree, htot)
else
call triple_htilde_mu_mat_fock_bi_ortho(Nint, key_j, key_i, hmono, htwoe, hthree, htot)
endif
2023-02-07 17:07:49 +01:00
endif
if(degree==0) then
htot += nuclear_repulsion
endif
2023-09-20 15:16:10 +02:00
2023-02-07 17:07:49 +01:00
end
! ---
subroutine htilde_mu_mat_opt_bi_ortho_no_3e(key_j, key_i, Nint, htot)
BEGIN_DOC
!
2023-06-29 18:31:48 +02:00
! <key_j |H_tilde | key_i> where |key_j> is developed on the LEFT basis and |key_i> is developed on the RIGHT basis
2023-02-07 17:07:49 +01:00
!!
2023-09-20 15:16:10 +02:00
! Returns the detail of the matrix element WITHOUT ANY CONTRIBUTION FROM THE THREE ELECTRON TERMS
2023-02-07 17:07:49 +01:00
!! WARNING !!
2023-09-20 15:16:10 +02:00
!
2023-02-07 17:07:49 +01:00
! Non hermitian !!
!
END_DOC
use bitmasks
implicit none
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key_i(Nint,2), key_j(Nint,2)
double precision, intent(out) :: htot
2023-09-20 15:16:10 +02:00
integer :: degree
2023-02-07 17:07:49 +01:00
2024-03-01 13:37:46 +01:00
htot = 0.d0
2023-02-07 17:07:49 +01:00
call get_excitation_degree(key_i, key_j, degree, Nint)
if(degree.gt.2) return
2024-03-01 13:37:46 +01:00
if(degree == 0) then
2023-02-07 17:07:49 +01:00
call diag_htilde_mu_mat_fock_bi_ortho_no_3e(Nint, key_i,htot)
2024-03-01 13:37:46 +01:00
else if (degree == 1) then
2023-02-07 17:07:49 +01:00
call single_htilde_mu_mat_fock_bi_ortho_no_3e(Nint,key_j, key_i , htot)
2024-03-01 13:37:46 +01:00
else if(degree == 2) then
2023-02-07 17:07:49 +01:00
call double_htilde_mu_mat_fock_bi_ortho_no_3e(Nint, key_j, key_i, htot)
endif
if(degree==0) then
htot += nuclear_repulsion
endif
2023-09-20 15:16:10 +02:00
2023-02-07 17:07:49 +01:00
end
! ---
2023-09-16 00:28:18 +02:00
2024-05-07 20:52:10 +02:00
subroutine htilde_mu_mat_opt_bi_ortho_no_3e_both(key_j, key_i, Nint, hji,hij)
2024-05-07 20:32:48 +02:00
BEGIN_DOC
!
! <key_j |H_tilde | key_i> where |key_j> is developed on the LEFT basis and |key_i> is developed on the RIGHT basis
!!
! Returns the detail of the matrix element WITHOUT ANY CONTRIBUTION FROM THE THREE ELECTRON TERMS
!! WARNING !!
!
! Non hermitian !!
!
END_DOC
use bitmasks
implicit none
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: key_i(Nint,2), key_j(Nint,2)
2024-05-07 20:52:10 +02:00
double precision, intent(out) :: hji,hij
2024-05-07 20:32:48 +02:00
integer :: degree
2024-05-07 20:52:10 +02:00
hji = 0.d0
hij = 0.d0
2024-05-07 20:32:48 +02:00
call get_excitation_degree(key_i, key_j, degree, Nint)
if(degree.gt.2) return
if(degree == 0) then
2024-05-07 20:52:10 +02:00
call diag_htilde_mu_mat_fock_bi_ortho_no_3e(Nint, key_i,hji)
hij = hji
2024-05-07 20:32:48 +02:00
else if (degree == 1) then
2024-05-07 20:52:10 +02:00
call single_htilde_mu_mat_fock_bi_ortho_no_3e_both(Nint,key_j, key_i , hji,hij)
2024-05-07 20:32:48 +02:00
else if(degree == 2) then
2024-05-07 20:52:10 +02:00
call double_htilde_mu_mat_fock_bi_ortho_no_3e_both(Nint, key_j, key_i, hji,hij)
2024-05-07 20:32:48 +02:00
endif
if(degree==0) then
2024-05-07 20:52:10 +02:00
hji += nuclear_repulsion
hij += nuclear_repulsion
2024-05-07 20:32:48 +02:00
endif
end
! ---