diff --git a/scripts/generate_h_apply.py b/scripts/generate_h_apply.py index 9b589a3d..f945be76 100755 --- a/scripts/generate_h_apply.py +++ b/scripts/generate_h_apply.py @@ -95,7 +95,7 @@ class H_apply(object): s["size_max"] = str(1024*128) s["copy_buffer"] = "call copy_h_apply_buffer_to_wf" s["printout_now"] = """write(output_Dets,*) & - 100.*float(i_generator)/float(N_det_generators), '% in ', wall_2-wall_1, 's'""" + 100.*float(i_generator)/float(N_det_generators), '% in ', wall_1-wall_0, 's'""" self.data = s def __setitem__(self,key,value): @@ -194,7 +194,7 @@ class H_apply(object): write(output_Dets,'(I10, 4(2X, F9.6), 2X, F8.1)') & i_generator, norm_psi(k), delta_pt2(k), pt2(k), & pt2(k)/norm_psi(k), & - wall_2-wall_1 + wall_1-wall_0 pt2_old(k) = pt2(k) enddo """ diff --git a/src/CISD_selected/cisd_selection.irp.f b/src/CISD_selected/cisd_selection.irp.f index f63a2d84..5d0b8c3a 100644 --- a/src/CISD_selected/cisd_selection.irp.f +++ b/src/CISD_selected/cisd_selection.irp.f @@ -12,7 +12,13 @@ program cisd pt2 = 1.d0 perturbation = "epstein_nesbet" E_old(1) = HF_energy - do while (maxval(abs(pt2(1:N_st))) > 1.d-6) + call diagonalize_CI + do i = 1, N_st + print*,'state ',i + print *, 'E = ', CI_energy(i) + enddo + E_old = CI_energy + do while (maxval(abs(pt2(1:N_st))) > 1.d-4) print*,'----' print*,'' call H_apply_cisd_selection(perturbation,pt2, norm_pert, H_pert_diag, N_st) diff --git a/src/CIS_dressed/CIS_DT_lapack.irp.f b/src/CIS_dressed/CIS_DT_lapack.irp.f index 9d8ba522..a6863fa4 100644 --- a/src/CIS_dressed/CIS_DT_lapack.irp.f +++ b/src/CIS_dressed/CIS_DT_lapack.irp.f @@ -16,8 +16,8 @@ endif do i = 1,n_state_CIS print*,'' print*,'i = ',i - print*,'CIS = ',eigenvalues_CIS(i) - print*,'CIS(DdT)= ',eigenvalues_CIS_dress_D_dt(i) + print*,'CIS = ',eigenvalues_CIS(i)+ nuclear_repulsion + print*,'CIS(DdT)= ',eigenvalues_CIS_dress_D_dt(i)+ nuclear_repulsion print*,'s2(DdT) = ',s_2_CIS_dress_D_dt(i) print*,' = ',CIS_states_properties(1,i) print*,' = ',CIS_states_properties(2,i) diff --git a/src/CIS_dressed/CIS_providers.irp.f b/src/CIS_dressed/CIS_providers.irp.f index f4fc6266..3fa5fdb9 100644 --- a/src/CIS_dressed/CIS_providers.irp.f +++ b/src/CIS_dressed/CIS_providers.irp.f @@ -211,7 +211,14 @@ integer :: i_overlap,i,j,k allocate (delta_H_matrix_doub(size_psi_CIS,size_psi_CIS)) allocate(eigvalues(size_psi_CIS),eigvectors(size_psi_CIS,size_psi_CIS)) - do i = 1,n_state_CIS + eigenvalues_CIS_dress_D_dt(1) = eigenvalues_cis(1) + dress_T_discon_array_CIS(1) + eigenvectors_CIS_dress_D_dt(1,1) = 1.d0 + s_2_CIS_dress_D_dt = 0.d0 + print*,'eigenvalues_CIS_dress_D_dt(i)= ',eigenvalues_CIS_dress_D_dt(1) + nuclear_repulsion + do i = 2, size_psi_CIS + eigenvectors_CIS_dress_D_dt(i,1) = 0.d0 + enddo + do i = 2,n_state_CIS call dress_by_doubles(eigenvalues_CIS(i),coefs_CIS(1,i),delta_H_matrix_doub,size_psi_CIS) !dressing of the Doubles ! delta_H_matrix_doub = 0.d0 @@ -221,6 +228,9 @@ enddo delta_H_matrix_doub(j,j) += dress_T_discon_array_CIS(j) enddo + do j = 2, size_psi_CIS + delta_H_matrix_doub(1,j) = 0.d0 + enddo double precision :: accu accu = 0.d0 @@ -258,9 +268,9 @@ call get_s2_u0(psi_CIS,eigenvectors_CIS_dress_D_dt(1,i),size_psi_CIS,size_psi_CIS,s2) s_2_CIS_dress_D_dt(i) = s2 eigenvalues_CIS_dress_D_dt(i) = eigvalues(i_overlap) - print*,'eigenvalues_CIS_dress_D_dt(i)= ',eigenvalues_CIS_dress_D_dt(i) - print*,'accu = ',accu - print*,'eigenvalues_CIS = ',eigenvalues_CIS(i) + print*,'eigenvalues_CIS_dress_D_dt(i)= ',eigenvalues_CIS_dress_D_dt(i) + nuclear_repulsion + print*,'Perturbative = ',accu+ nuclear_repulsion + print*,'eigenvalues_CIS = ',eigenvalues_CIS(i)+ nuclear_repulsion enddo END_PROVIDER diff --git a/src/Dets/H_apply.irp.f b/src/Dets/H_apply.irp.f index 74a581d9..b72b42b5 100644 --- a/src/Dets/H_apply.irp.f +++ b/src/Dets/H_apply.irp.f @@ -23,7 +23,8 @@ BEGIN_PROVIDER [ logical, H_apply_buffer_allocated ] if (.not.associated(H_apply_buffer)) then allocate(H_apply_buffer(0:nproc-1)) iproc = 0 - !$OMP PARALLEL PRIVATE(iproc) DEFAULT(SHARED) + !$OMP PARALLEL PRIVATE(iproc) DEFAULT(NONE) + !$OMP SHARED(H_apply_buffer,N_int,sze,N_states) !$ iproc = omp_get_thread_num() H_apply_buffer(iproc)%N_det = 0 H_apply_buffer(iproc)%sze = sze diff --git a/src/Dets/H_apply_template.f b/src/Dets/H_apply_template.f index 9474b4f9..cbcd9b46 100644 --- a/src/Dets/H_apply_template.f +++ b/src/Dets/H_apply_template.f @@ -375,7 +375,7 @@ subroutine $subroutine($params_main) $decls_main integer :: i_generator, nmax - double precision :: wall_0, wall_1, wall_2 + double precision :: wall_0, wall_1 integer(omp_lock_kind) :: lck integer(bit_kind), allocatable :: mask(:,:,:) integer :: ispin, k @@ -384,13 +384,13 @@ subroutine $subroutine($params_main) PROVIDE psi_det_sorted_bit coef_hf_selector psi_det psi_coef H_apply_threshold ref_bitmask_energy nmax = ( N_det_generators/nproc ) *nproc - call wall_time(wall_1) + call wall_time(wall_0) !$ call omp_init_lock(lck) IRP_IF I_LIKE_BUGS !$OMP PARALLEL DEFAULT(SHARED) & - !$OMP PRIVATE(i_generator,wall_2,ispin,k,mask) + !$OMP PRIVATE(i_generator,wall_1,ispin,k,mask) allocate( mask(N_int,2,6) ) !$OMP DO SCHEDULE(dynamic,4) do i_generator=1,nmax @@ -435,10 +435,10 @@ IRP_IF I_LIKE_BUGS i_generator $params_post) endif !$ call omp_set_lock(lck) - call wall_time(wall_2) + call wall_time(wall_1) $printout_always - if (wall_2 - wall_0 > 2.d0) then - wall_0 = wall_2 + if (wall_1 - wall_0 > 2.d0) then + wall_0 = wall_1 $printout_now endif !$ call omp_unset_lock(lck) @@ -496,10 +496,10 @@ IRP_ENDIF mask(1,1,s_hole ), mask(1,1,s_part ), & i_generator $params_post) endif - call wall_time(wall_2) + call wall_time(wall_1) $printout_always - if (wall_2 - wall_0 > 2.d0) then - wall_0 = wall_2 + if (wall_1 - wall_0 > 2.d0) then + wall_0 = wall_1 $printout_now endif enddo diff --git a/src/Full_CI/H_apply.irp.f b/src/Full_CI/H_apply.irp.f index 0bf120c0..76c046ae 100644 --- a/src/Full_CI/H_apply.irp.f +++ b/src/Full_CI/H_apply.irp.f @@ -3,11 +3,11 @@ BEGIN_SHELL [ /usr/bin/env python ] from generate_h_apply import * s = H_apply("FCI") -s.set_selection_pt2("epstein_nesbet") +s.set_selection_pt2("epstein_nesbet_2x2") print s s = H_apply("FCI_PT2") -s.set_perturbation("epstein_nesbet") +s.set_perturbation("epstein_nesbet_2x2") print s END_SHELL diff --git a/src/Full_CI/full_ci.irp.f b/src/Full_CI/full_ci.irp.f index d1dbc2f5..7d586771 100644 --- a/src/Full_CI/full_ci.irp.f +++ b/src/Full_CI/full_ci.irp.f @@ -14,6 +14,10 @@ program cisd ! do while (maxval(abs(pt2(1:N_st))) > 1.d-4) do while (N_det < n_det_max_fci.and.maxval(abs(pt2(1:N_st))) > pt2_max) call H_apply_FCI(pt2, norm_pert, H_pert_diag, N_st) + if (N_det > n_det_max_fci) then + N_det = n_det_max_fci + touch N_det + endif call diagonalize_CI call save_wavefunction print *, 'N_det = ', N_det @@ -29,7 +33,7 @@ program cisd N_det = min(n_det_max_fci,N_det) if(do_pt2_end)then threshold_selectors = 1.d0 - threshold_generators = 0.99d0 + threshold_generators = 0.999d0 touch N_det psi_det psi_coef call diagonalize_CI call H_apply_FCI_PT2(pt2, norm_pert, H_pert_diag, N_st)