10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-05 05:33:56 +01:00
quantum_package/plugins/Generators_CAS/generators.irp.f

84 lines
2.6 KiB
Fortran
Raw Normal View History

2015-03-02 13:58:00 +01:00
use bitmasks
BEGIN_PROVIDER [ integer, N_det_generators ]
implicit none
BEGIN_DOC
! Number of generator detetrminants
END_DOC
integer :: i,k,l
logical :: good
2018-02-28 15:28:34 +01:00
integer, external :: number_of_holes,number_of_particles
2018-01-05 18:15:34 +01:00
call write_time(6)
2015-03-02 13:58:00 +01:00
N_det_generators = 0
do i=1,N_det
2018-02-28 15:28:34 +01:00
good = ( number_of_holes(psi_det_sorted(1,1,i)) ==0).and.(number_of_particles(psi_det_sorted(1,1,i))==0 )
2015-03-02 13:58:00 +01:00
if (good) then
N_det_generators += 1
endif
enddo
N_det_generators = max(N_det_generators,1)
2018-01-05 18:15:34 +01:00
call write_int(6,N_det_generators,'Number of generators')
2015-03-02 13:58:00 +01:00
END_PROVIDER
2015-04-02 11:40:16 +02:00
BEGIN_PROVIDER [ integer(bit_kind), psi_det_generators, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_generators, (psi_det_size,N_states) ]
2018-05-25 17:40:27 +02:00
&BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_gen, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted_gen, (psi_det_size,N_states) ]
&BEGIN_PROVIDER [ integer, psi_det_sorted_gen_order, (psi_det_size) ]
2015-03-02 13:58:00 +01:00
implicit none
BEGIN_DOC
! For Single reference wave functions, the generator is the
! Hartree-Fock determinant
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
2018-05-25 17:40:27 +02:00
integer, allocatable :: nongen(:)
integer :: inongen
inongen = 0
allocate(nongen(N_det))
2015-03-02 13:58:00 +01:00
m=0
do i=1,N_det
2018-02-28 15:28:34 +01:00
good = ( number_of_holes(psi_det_sorted(1,1,i)) ==0).and.(number_of_particles(psi_det_sorted(1,1,i))==0 )
2015-03-02 13:58:00 +01:00
if (good) then
m = m+1
2018-05-25 17:40:27 +02:00
psi_det_sorted_gen_order(i) = m
2015-03-02 13:58:00 +01:00
do k=1,N_int
2017-05-23 19:30:51 +02:00
psi_det_generators(k,1,m) = psi_det_sorted(k,1,i)
psi_det_generators(k,2,m) = psi_det_sorted(k,2,i)
2015-03-02 13:58:00 +01:00
enddo
2018-05-25 17:40:27 +02:00
psi_coef_generators(m,:) = psi_coef_sorted(i,:)
else
inongen += 1
nongen(inongen) = i
2015-03-02 13:58:00 +01:00
endif
enddo
2018-05-25 17:40:27 +02:00
psi_det_sorted_gen(:,:,:N_det_generators) = psi_det_generators(:,:,:N_det_generators)
psi_coef_sorted_gen(:N_det_generators, :) = psi_coef_generators(:N_det_generators, :)
do i=1,inongen
psi_det_sorted_gen_order(nongen(i)) = N_det_generators+i
2018-06-12 14:44:32 +02:00
psi_det_sorted_gen(:,:,N_det_generators+i) = psi_det_sorted(:,:,nongen(i))
psi_coef_sorted_gen(N_det_generators+i, :) = psi_coef_sorted(nongen(i),:)
2018-05-25 17:40:27 +02:00
end do
2015-03-02 13:58:00 +01:00
END_PROVIDER
BEGIN_PROVIDER [ integer, size_select_max]
implicit none
BEGIN_DOC
! Size of the select_max array
END_DOC
size_select_max = 10000
END_PROVIDER
BEGIN_PROVIDER [ double precision, select_max, (size_select_max) ]
implicit none
BEGIN_DOC
! Memo to skip useless selectors
END_DOC
select_max = huge(1.d0)
END_PROVIDER