10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-04 13:13:57 +01:00

Merge branch 'alpha_factory' of git://github.com/garniron/quantum_package into garniron-alpha_factory

This commit is contained in:
Anthony Scemama 2018-06-18 17:57:36 +02:00
commit 4e6e5b1c7e
8 changed files with 68 additions and 30 deletions

View File

@ -22,6 +22,9 @@ END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_generators, (N_int,2,psi_det_size) ] 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) ] &BEGIN_PROVIDER [ double precision, psi_coef_generators, (psi_det_size,N_states) ]
&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) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! For Single reference wave functions, the generator is the ! For Single reference wave functions, the generator is the
@ -30,19 +33,36 @@ END_PROVIDER
integer :: i, k, l, m integer :: i, k, l, m
logical :: good logical :: good
integer, external :: number_of_holes,number_of_particles integer, external :: number_of_holes,number_of_particles
integer, allocatable :: nongen(:)
integer :: inongen
inongen = 0
allocate(nongen(N_det))
m=0 m=0
do i=1,N_det do i=1,N_det
good = ( number_of_holes(psi_det_sorted(1,1,i)) ==0).and.(number_of_particles(psi_det_sorted(1,1,i))==0 ) good = ( number_of_holes(psi_det_sorted(1,1,i)) ==0).and.(number_of_particles(psi_det_sorted(1,1,i))==0 )
if (good) then if (good) then
m = m+1 m = m+1
psi_det_sorted_gen_order(i) = m
do k=1,N_int do k=1,N_int
psi_det_generators(k,1,m) = psi_det_sorted(k,1,i) psi_det_generators(k,1,m) = psi_det_sorted(k,1,i)
psi_det_generators(k,2,m) = psi_det_sorted(k,2,i) psi_det_generators(k,2,m) = psi_det_sorted(k,2,i)
enddo enddo
psi_coef_generators(m,:) = psi_coef_sorted(m,:) psi_coef_generators(m,:) = psi_coef_sorted(i,:)
else
inongen += 1
nongen(inongen) = i
endif endif
enddo enddo
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
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),:)
end do
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer, size_select_max] BEGIN_PROVIDER [ integer, size_select_max]

View File

@ -35,6 +35,24 @@ END_PROVIDER
END_PROVIDER END_PROVIDER
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) ]
implicit none
BEGIN_DOC
! For Single reference wave functions, the generator is the
! Hartree-Fock determinant
END_DOC
integer :: i, k
psi_det_sorted_gen = psi_det_sorted
psi_coef_sorted_gen = psi_coef_sorted
!do i=1,N_det_generators
psi_det_sorted_gen_order = psi_det_sorted_order
!end do
END_PROVIDER
BEGIN_PROVIDER [integer, degree_max_generators] BEGIN_PROVIDER [integer, degree_max_generators]
implicit none implicit none
BEGIN_DOC BEGIN_DOC

View File

@ -20,15 +20,15 @@ subroutine alpha_callback(delta_ij_loc, i_generator, subset,iproc)
end subroutine end subroutine
BEGIN_PROVIDER [ integer, psi_from_sorted, (N_det) ] BEGIN_PROVIDER [ integer, psi_from_sorted_gen, (N_det) ]
implicit none implicit none
integer :: i,inpsisor integer :: i,inpsisor
psi_from_sorted = 0 psi_from_sorted_gen = 0
do i=1,N_det do i=1,N_det
psi_from_sorted(psi_det_sorted_order(i)) = i psi_from_sorted_gen(psi_det_sorted_gen_order(i)) = i
inpsisor = psi_det_sorted_order(i) inpsisor = psi_det_sorted_gen_order(i)
if(inpsisor <= 0) stop "idx_non_ref_from_sorted" if(inpsisor <= 0) stop "idx_non_ref_from_sorted"
end do end do
END_PROVIDER END_PROVIDER
@ -100,7 +100,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
exc_degree(max(N_det_alpha_unique,N_det_beta_unique))) exc_degree(max(N_det_alpha_unique,N_det_beta_unique)))
!PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique !PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
!PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order !PROVIDE psi_bilinear_matrix_rows psi_det_sorted_gen_order psi_bilinear_matrix_order
!PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns !PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
!PROVIDE psi_bilinear_matrix_transp_order !PROVIDE psi_bilinear_matrix_transp_order
@ -117,7 +117,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
do l_a=psi_bilinear_matrix_columns_loc(j), psi_bilinear_matrix_columns_loc(j+1)-1 do l_a=psi_bilinear_matrix_columns_loc(j), psi_bilinear_matrix_columns_loc(j+1)-1
i = psi_bilinear_matrix_rows(l_a) i = psi_bilinear_matrix_rows(l_a)
if (nt + exc_degree(i) <= 4) then if (nt + exc_degree(i) <= 4) then
indices(k) = psi_det_sorted_order(psi_bilinear_matrix_order(l_a)) indices(k) = psi_det_sorted_gen_order(psi_bilinear_matrix_order(l_a))
k=k+1 k=k+1
endif endif
enddo enddo
@ -136,7 +136,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
i = psi_bilinear_matrix_transp_columns(l_a) i = psi_bilinear_matrix_transp_columns(l_a)
if (exc_degree(i) < 3) cycle if (exc_degree(i) < 3) cycle
if (nt + exc_degree(i) <= 4) then if (nt + exc_degree(i) <= 4) then
indices(k) = psi_det_sorted_order( & indices(k) = psi_det_sorted_gen_order( &
psi_bilinear_matrix_order( & psi_bilinear_matrix_order( &
psi_bilinear_matrix_transp_order(l_a))) psi_bilinear_matrix_transp_order(l_a)))
k=k+1 k=k+1
@ -160,15 +160,15 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
negMask(i,1) = not(psi_det_generators(i,1,i_generator)) negMask(i,1) = not(psi_det_generators(i,1,i_generator))
negMask(i,2) = not(psi_det_generators(i,2,i_generator)) negMask(i,2) = not(psi_det_generators(i,2,i_generator))
end do end do
if(psi_det_generators(1,1,i_generator) /= psi_det_sorted(1,1,i_generator)) stop "gen <> sorted" if(psi_det_generators(1,1,i_generator) /= psi_det_sorted_gen(1,1,i_generator)) stop "gen <> sorted"
do k=1,nmax do k=1,nmax
i = indices(k) i = indices(k)
mobMask(1,1) = iand(negMask(1,1), psi_det_sorted(1,1,i)) mobMask(1,1) = iand(negMask(1,1), psi_det_sorted_gen(1,1,i))
mobMask(1,2) = iand(negMask(1,2), psi_det_sorted(1,2,i)) mobMask(1,2) = iand(negMask(1,2), psi_det_sorted_gen(1,2,i))
nt = popcnt(mobMask(1, 1)) + popcnt(mobMask(1, 2)) nt = popcnt(mobMask(1, 1)) + popcnt(mobMask(1, 2))
do j=2,N_int do j=2,N_int
mobMask(j,1) = iand(negMask(j,1), psi_det_sorted(j,1,i)) mobMask(j,1) = iand(negMask(j,1), psi_det_sorted_gen(j,1,i))
mobMask(j,2) = iand(negMask(j,2), psi_det_sorted(j,2,i)) mobMask(j,2) = iand(negMask(j,2), psi_det_sorted_gen(j,2,i))
nt = nt + popcnt(mobMask(j, 1)) + popcnt(mobMask(j, 2)) nt = nt + popcnt(mobMask(j, 1)) + popcnt(mobMask(j, 2))
end do end do
@ -177,8 +177,8 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
preinteresting(0) += 1 preinteresting(0) += 1
preinteresting(preinteresting(0)) = i preinteresting(preinteresting(0)) = i
do j=1,N_int do j=1,N_int
preinteresting_det(j,1,preinteresting(0)) = psi_det_sorted(j,1,i) preinteresting_det(j,1,preinteresting(0)) = psi_det_sorted_gen(j,1,i)
preinteresting_det(j,2,preinteresting(0)) = psi_det_sorted(j,2,i) preinteresting_det(j,2,preinteresting(0)) = psi_det_sorted_gen(j,2,i)
enddo enddo
else if(nt <= 2) then else if(nt <= 2) then
prefullinteresting(0) += 1 prefullinteresting(0) += 1
@ -287,13 +287,13 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
do ii=1,prefullinteresting(0) do ii=1,prefullinteresting(0)
i = prefullinteresting(ii) i = prefullinteresting(ii)
nt = 0 nt = 0
mobMask(1,1) = iand(negMask(1,1), psi_det_sorted(1,1,i)) mobMask(1,1) = iand(negMask(1,1), psi_det_sorted_gen(1,1,i))
mobMask(1,2) = iand(negMask(1,2), psi_det_sorted(1,2,i)) mobMask(1,2) = iand(negMask(1,2), psi_det_sorted_gen(1,2,i))
nt = popcnt(mobMask(1, 1)) + popcnt(mobMask(1, 2)) nt = popcnt(mobMask(1, 1)) + popcnt(mobMask(1, 2))
if (nt > 2) cycle if (nt > 2) cycle
do j=N_int,2,-1 do j=N_int,2,-1
mobMask(j,1) = iand(negMask(j,1), psi_det_sorted(j,1,i)) mobMask(j,1) = iand(negMask(j,1), psi_det_sorted_gen(j,1,i))
mobMask(j,2) = iand(negMask(j,2), psi_det_sorted(j,2,i)) mobMask(j,2) = iand(negMask(j,2), psi_det_sorted_gen(j,2,i))
nt = nt+ popcnt(mobMask(j, 1)) + popcnt(mobMask(j, 2)) nt = nt+ popcnt(mobMask(j, 1)) + popcnt(mobMask(j, 2))
if (nt > 2) exit if (nt > 2) exit
end do end do
@ -301,11 +301,11 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
if(nt <= 2) then if(nt <= 2) then
fullinteresting(0) += 1 fullinteresting(0) += 1
fullinteresting(fullinteresting(0)) = i fullinteresting(fullinteresting(0)) = i
fullminilist(1,1,fullinteresting(0)) = psi_det_sorted(1,1,i) fullminilist(1,1,fullinteresting(0)) = psi_det_sorted_gen(1,1,i)
fullminilist(1,2,fullinteresting(0)) = psi_det_sorted(1,2,i) fullminilist(1,2,fullinteresting(0)) = psi_det_sorted_gen(1,2,i)
do j=2,N_int do j=2,N_int
fullminilist(j,1,fullinteresting(0)) = psi_det_sorted(j,1,i) fullminilist(j,1,fullinteresting(0)) = psi_det_sorted_gen(j,1,i)
fullminilist(j,2,fullinteresting(0)) = psi_det_sorted(j,2,i) fullminilist(j,2,fullinteresting(0)) = psi_det_sorted_gen(j,2,i)
enddo enddo
end if end if
end do end do
@ -390,7 +390,7 @@ subroutine alpha_callback_mask(delta_ij_loc, i_gen, sp, mask, bannedOrb, banned,
allocate(abuf(siz), labuf(N_det), putten(N_det), det_minilist(N_int, 2, N_det)) allocate(abuf(siz), labuf(N_det), putten(N_det), det_minilist(N_int, 2, N_det))
do i=1,siz do i=1,siz
abuf(i) = psi_from_sorted(rabuf(i)) abuf(i) = psi_from_sorted_gen(rabuf(i))
end do end do
putten = .false. putten = .false.

View File

@ -63,7 +63,7 @@ integer, external :: zmq_get_dvector, zmq_get_N_det_generators
TOUCH psi_energy dress_stoch_istate state_average_weight TOUCH psi_energy dress_stoch_istate state_average_weight
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order PROVIDE psi_bilinear_matrix_rows psi_det_sorted_gen_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order PROVIDE psi_bilinear_matrix_transp_order
!!$OMP PARALLEL PRIVATE(i) !!$OMP PARALLEL PRIVATE(i)

View File

@ -1 +1 @@
dress_zmq DavidsonDressed Selectors_full Generators_full dress_zmq DavidsonDressed Selectors_full Generators_CAS

View File

@ -5,7 +5,7 @@ program shifted_bk
END_DOC END_DOC
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order PROVIDE psi_bilinear_matrix_rows psi_det_sorted_gen_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order PROVIDE psi_bilinear_matrix_transp_order

View File

@ -225,7 +225,7 @@ subroutine dress_with_alpha_(Nstates,Ndet,Nint,delta_ij_loc,minilist, det_minili
BEGIN_DOC BEGIN_DOC
!delta_ij_loc(:,:,1) : dressing column for H !delta_ij_loc(:,:,1) : dressing column for H
!delta_ij_loc(:,:,2) : dressing column for S2 !delta_ij_loc(:,:,2) : dressing column for S2
!minilist : indices of determinants connected to alpha ( in psi_det_sorted ) !minilist : indices of determinants connected to alpha ( in psi_det )
!n_minilist : size of minilist !n_minilist : size of minilist
!alpha : alpha determinant !alpha : alpha determinant
END_DOC END_DOC
@ -284,7 +284,7 @@ subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minili
!delta_ij_loc(:,:,1) : dressing column for H !delta_ij_loc(:,:,1) : dressing column for H
!delta_ij_loc(:,:,2) : dressing column for S2 !delta_ij_loc(:,:,2) : dressing column for S2
!i_gen : generator index in psi_det_generators !i_gen : generator index in psi_det_generators
!minilist : indices of determinants connected to alpha ( in psi_det_sorted ) !minilist : indices of determinants connected to alpha ( in psi_det )
!n_minilist : size of minilist !n_minilist : size of minilist
!alpha : alpha determinant !alpha : alpha determinant
END_DOC END_DOC

View File

@ -5,7 +5,7 @@ program shifted_bk
END_DOC END_DOC
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order PROVIDE psi_bilinear_matrix_rows psi_det_sorted_gen_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order PROVIDE psi_bilinear_matrix_transp_order