diff --git a/src/cipsi/pt2_stoch_routines.irp.f b/src/cipsi/pt2_stoch_routines.irp.f index 0ca69bf9..069bcfd9 100644 --- a/src/cipsi/pt2_stoch_routines.irp.f +++ b/src/cipsi/pt2_stoch_routines.irp.f @@ -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 diff --git a/src/cipsi/selection_buffer.irp.f b/src/cipsi/selection_buffer.irp.f index 2dda924f..aa3be942 100644 --- a/src/cipsi/selection_buffer.irp.f +++ b/src/cipsi/selection_buffer.irp.f @@ -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 diff --git a/src/cipsi/slave_cipsi.irp.f b/src/cipsi/slave_cipsi.irp.f index 74b3df99..034adc6f 100644 --- a/src/cipsi/slave_cipsi.irp.f +++ b/src/cipsi/slave_cipsi.irp.f @@ -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) diff --git a/src/perturbation/EZFIO.cfg b/src/perturbation/EZFIO.cfg index ab9cfc1a..b90a8961 100644 --- a/src/perturbation/EZFIO.cfg +++ b/src/perturbation/EZFIO.cfg @@ -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 diff --git a/src/perturbation/h0_type.irp.f b/src/perturbation/h0_type.irp.f deleted file mode 100644 index 7dd58c2c..00000000 --- a/src/perturbation/h0_type.irp.f +++ /dev/null @@ -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 -