10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 20:34:58 +01:00

Merge branch 'develop' of github.com:QuantumPackage/qp2 into develop

This commit is contained in:
Anthony Scemama 2019-02-04 15:43:42 +01:00
commit 915217bc15
5 changed files with 27 additions and 29 deletions

View File

@ -36,7 +36,7 @@ END_PROVIDER
pt2_N_teeth = 1
else
pt2_minDetInFirstTeeth = min(5, N_det_generators)
do pt2_N_teeth=400,2,-1
do pt2_N_teeth=100,2,-1
if(testTeethBuilding(pt2_minDetInFirstTeeth, pt2_N_teeth)) exit
end do
end if
@ -61,17 +61,16 @@ logical function testTeethBuilding(minF, N)
allocate(tilde_w(N_det_generators), tilde_cW(0:N_det_generators))
do i=1,N_det_generators
tilde_w(i) = psi_coef_sorted_gen(i,pt2_stoch_istate)**2 !+ 1.d-20
enddo
double precision :: norm
norm = 0.d0
double precision :: norm
do i=N_det_generators,1,-1
norm += tilde_w(i)
tilde_w(i) = psi_coef_sorted_gen(i,pt2_stoch_istate) * &
psi_coef_sorted_gen(i,pt2_stoch_istate)
norm = norm + tilde_w(i)
enddo
tilde_w(:) = tilde_w(:) / norm
f = 1.d0/norm
tilde_w(:) = tilde_w(:) * f
tilde_cW(0) = -1.d0
do i=1,N_det_generators
@ -132,7 +131,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp psi_det_sorted
PROVIDE psi_det_hii N_generators_bitmask
if (s2_eig) then
if (h0_type == 'SOP') then
PROVIDE psi_occ_pattern_hii det_to_occ_pattern
endif

View File

@ -74,7 +74,7 @@ subroutine merge_selection_buffers(b1, b2)
type(selection_buffer), intent(inout) :: b2
integer(bit_kind), pointer :: detmp(:,:,:)
double precision, pointer :: val(:)
integer :: i, i1, i2, k, nmwen
integer :: i, i1, i2, k, nmwen, sze
if (b1%cur == 0) return
do while (b1%val(b1%cur) > b2%mini)
b1%cur = b1%cur-1
@ -85,9 +85,10 @@ subroutine merge_selection_buffers(b1, b2)
nmwen = min(b1%N, b1%cur+b2%cur)
double precision :: rss
double precision, external :: memory_of_double
rss = memory_of_double(size(b1%val)) + 2*N_int*memory_of_double(size(b1%det,3))
sze = max(size(b1%val), size(b2%val))
rss = memory_of_double(sze) + 2*N_int*memory_of_double(sze)
call check_mem(rss,irp_here)
allocate( val(size(b1%val)), detmp(N_int, 2, size(b1%det,3)) )
allocate(val(sze), detmp(N_int, 2, sze))
i1=1
i2=1
do i=1,nmwen

View File

@ -281,21 +281,28 @@ subroutine run_slave_main
print *, 'pt2_stoch_istate', pt2_stoch_istate
print *, 'state_average_weight', state_average_weight
print *, 'Number of threads', nproc_target
endif
if (.true.) then
PROVIDE psi_det_hii
if (s2_eig) then
if (h0_type == 'SOP') then
PROVIDE psi_occ_pattern_hii det_to_occ_pattern
endif
endif
PROVIDE global_selection_buffer
if (mpi_master) then
print *, 'Running PT2'
endif
!$OMP PARALLEL PRIVATE(i) NUM_THREADS(nproc_target+1)
i = omp_get_thread_num()
call run_pt2_slave(0,i,pt2_e0_denominator)
!$OMP END PARALLEL
FREE state_average_weight
print *, mpi_rank, ': PT2 done'
print *, '-------'
endif
FREE state_average_weight
print *, mpi_rank, ': PT2 done'
IRP_IF MPI
call MPI_BARRIER(MPI_COMM_WORLD, ierr)

View File

@ -22,4 +22,8 @@ doc: The selection process stops at a fixed correlation ratio (useful for gettin
interface: ezfio,provider,ocaml
default: 1.00
[h0_type]
type: character*(32)
doc: Type of denominator in PT2. [EN | SOP | HF]
interface: ezfio,provider,ocaml
default: EN

View File

@ -1,13 +0,0 @@
BEGIN_PROVIDER [ character*32,h0_type ]
implicit none
BEGIN_DOC
! Type of zeroth-order Hamiltonian
END_DOC
if (s2_eig) then
h0_type = 'SOP'
else
h0_type = 'EN'
endif
! h0_type = 'HF'
END_PROVIDER