10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 13:53:49 +01:00
quantum_package/plugins/Selectors_CASSD/selectors.irp.f

57 lines
1.6 KiB
Fortran
Raw Normal View History

2016-11-14 17:49:22 +01:00
use bitmasks
BEGIN_PROVIDER [ integer, N_det_selectors]
implicit none
BEGIN_DOC
! For Single reference wave functions, the number of selectors is 1 : the
! Hartree-Fock determinant
END_DOC
N_det_selectors = N_det
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
! Determinants on which we apply <i|H|psi> for perturbation.
2018-02-28 16:12:46 +01:00
! The selectors are equivalent to Selectors_full, but in a different
! order. The Generators_CAS determinants appear first, then all the
! others.
2016-11-14 17:49:22 +01:00
END_DOC
integer :: i, k, l, m
logical :: good
2018-02-28 16:12:46 +01:00
integer, external :: number_of_holes,number_of_particles
2016-11-14 17:49:22 +01:00
2017-05-31 01:23:38 +02:00
do i=1,N_det_generators
2016-11-14 17:49:22 +01:00
do k=1,N_int
2017-05-31 01:23:38 +02:00
psi_selectors(k,1,i) = psi_det_generators(k,1,i)
psi_selectors(k,2,i) = psi_det_generators(k,2,i)
2016-11-14 17:49:22 +01:00
enddo
enddo
do k=1,N_states
2017-05-31 01:23:38 +02:00
do i=1,N_det_generators
psi_selectors_coef(i,k) = psi_coef_generators(i,k)
2016-11-14 17:49:22 +01:00
enddo
enddo
2017-05-31 01:23:38 +02:00
m=N_det_generators
do i=1,N_det
2018-02-28 16:12:46 +01:00
good = ( number_of_holes(psi_det_sorted(1,1,i)) ==0).and.(number_of_particles(psi_det_sorted(1,1,i))==0 )
2017-05-31 01:23:38 +02:00
if (.not.good) then
m = m+1
do k=1,N_int
psi_selectors(k,1,m) = psi_det_sorted(k,1,i)
psi_selectors(k,2,m) = psi_det_sorted(k,2,i)
enddo
psi_selectors_coef(m,:) = psi_coef_sorted(i,:)
endif
enddo
if (N_det /= m) then
print *, N_det, m
2018-02-28 16:12:46 +01:00
stop 'Selectors_CASSD : N_det /= m'
2017-05-31 01:23:38 +02:00
endif
2016-11-14 17:49:22 +01:00
END_PROVIDER