10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-13 17:43:55 +01:00
quantum_package/plugins/Selectors_full/selectors.irp.f

80 lines
2.1 KiB
Fortran
Raw Normal View History

2014-05-27 17:30:44 +02:00
use bitmasks
BEGIN_PROVIDER [ integer, psi_selectors_size ]
implicit none
psi_selectors_size = psi_det_size
END_PROVIDER
2014-06-02 15:18:45 +02:00
2014-05-27 17:30:44 +02:00
BEGIN_PROVIDER [ integer, N_det_selectors]
2016-09-27 09:28:34 +02:00
implicit none
BEGIN_DOC
! For Single reference wave functions, the number of selectors is 1 : the
! Hartree-Fock determinant
END_DOC
integer :: i
double precision :: norm, norm_max
call write_time(output_determinants)
N_det_selectors = N_det
2016-09-27 09:28:34 +02:00
if (threshold_generators < 1.d0) then
norm = 0.d0
do i=1,N_det
norm = norm + psi_average_norm_contrib_sorted(i)
if (norm > threshold_selectors) then
2016-11-02 21:46:12 +01:00
N_det_selectors = i
2016-09-27 09:28:34 +02:00
exit
endif
enddo
2016-10-02 23:12:17 +02:00
N_det_selectors = max(N_det_selectors,N_det_generators)
2016-09-27 09:28:34 +02:00
endif
call write_int(output_determinants,N_det_selectors,'Number of selectors')
2014-05-27 17:30:44 +02:00
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_selectors, (N_int,2,psi_selectors_size) ]
&BEGIN_PROVIDER [ double precision, psi_selectors_coef, (psi_selectors_size,N_states) ]
implicit none
BEGIN_DOC
2014-06-02 15:18:45 +02:00
! Determinants on which we apply <i|H|psi> for perturbation.
2014-05-27 17:30:44 +02:00
END_DOC
integer :: i,k
do i=1,N_det_selectors
do k=1,N_int
2014-06-02 15:18:45 +02:00
psi_selectors(k,1,i) = psi_det_sorted(k,1,i)
psi_selectors(k,2,i) = psi_det_sorted(k,2,i)
2014-05-27 17:30:44 +02:00
enddo
enddo
do k=1,N_states
do i=1,N_det_selectors
2014-06-02 15:18:45 +02:00
psi_selectors_coef(i,k) = psi_coef_sorted(i,k)
2014-05-27 17:30:44 +02:00
enddo
enddo
END_PROVIDER
2016-08-01 23:08:22 +02:00
BEGIN_PROVIDER [ double precision, psi_selectors_coef_transp, (N_states,psi_selectors_size) ]
implicit none
BEGIN_DOC
! Transposed psi_selectors
END_DOC
integer :: i,k
do i=1,N_det_selectors
do k=1,N_states
psi_selectors_coef_transp(k,i) = psi_selectors_coef(i,k)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, psi_selectors_diag_h_mat, (psi_selectors_size) ]
2015-03-19 21:14:52 +01:00
implicit none
BEGIN_DOC
! Diagonal elements of the H matrix for each selectors
END_DOC
integer :: i
double precision :: diag_H_mat_elem
do i = 1, N_det_selectors
psi_selectors_diag_h_mat(i) = diag_H_mat_elem(psi_selectors(1,1,i),N_int)
enddo
2016-08-01 23:08:22 +02:00
END_PROVIDER
2015-03-19 21:14:52 +01:00
2014-11-28 19:50:48 +01:00