diff --git a/src/CAS_SD/cas_sd.irp.f b/src/CAS_SD/cas_sd.irp.f index 0b34e7bd..e28334b2 100644 --- a/src/CAS_SD/cas_sd.irp.f +++ b/src/CAS_SD/cas_sd.irp.f @@ -1,6 +1,7 @@ program full_ci implicit none integer :: i,k + integer :: N_det_old double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:) @@ -9,6 +10,7 @@ program full_ci allocate (pt2(N_st), norm_pert(N_st),H_pert_diag(N_st)) character*(64) :: perturbation + N_det_old = 0 pt2 = 1.d0 diag_algorithm = "Lapack" if (N_det > n_det_max_cas_sd) then @@ -29,6 +31,7 @@ program full_ci endif do while (N_det < n_det_max_cas_sd.and.maxval(abs(pt2(1:N_st))) > pt2_max) + N_det_old = N_det call H_apply_CAS_SD(pt2, norm_pert, H_pert_diag, N_st) PROVIDE psi_coef @@ -53,10 +56,11 @@ program full_ci if (abort_all) then exit endif + if (N_det == N_det_old) then + exit + endif enddo - ! Check that it is a CAS-SD - logical :: in_cas integer :: exc_max, degree_min exc_max = 0 print *, 'CAS determinants : ', N_det_generators diff --git a/src/CAS_SD/cas_sd_selected.irp.f b/src/CAS_SD/cas_sd_selected.irp.f index 86cac969..c3abadf4 100644 --- a/src/CAS_SD/cas_sd_selected.irp.f +++ b/src/CAS_SD/cas_sd_selected.irp.f @@ -50,14 +50,30 @@ program full_ci print *, 'E = ', CI_energy print *, 'E+PT2 = ', CI_energy+pt2 print *, '-----' - call ezfio_set_full_ci_energy(CI_energy) + call ezfio_set_cas_sd_energy(CI_energy(1)) if (abort_all) then exit endif enddo + call diagonalize_CI + + if(do_pt2_end)then + print*,'Last iteration only to compute the PT2' + threshold_selectors = 1.d0 + threshold_generators = 0.999d0 + call H_apply_CAS_SD_PT2(pt2, norm_pert, H_pert_diag, N_st) + + print *, 'Final step' + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_cas_sd_energy_pt2(CI_energy(1)+pt2(1)) + endif + - ! Check that it is a CAS-SD - logical :: in_cas integer :: exc_max, degree_min exc_max = 0 print *, 'CAS determinants : ', N_det_cas @@ -70,18 +86,4 @@ program full_ci print *, '' enddo print *, 'Max excitation degree in the CAS :', exc_max - do i=1,N_det - in_cas = .False. - degree_min = 1000 - do k=1,N_det_cas - call get_excitation_degree(psi_cas(1,1,k),psi_det(1,1,i),degree,N_int) - degree_min = min(degree_min,degree) - enddo - if (degree_min > 2) then - print *, 'Error : This is not a CAS-SD : ' - print *, 'Excited determinant:', degree_min - call debug_det(psi_det(1,1,k),N_int) - stop - endif - enddo end diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 4b8c0472..e9307357 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -40,15 +40,11 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`copy_h_apply_buffer_to_wf `_ - Copies the H_apply buffer to psi_coef. You need to touch psi_det, psi_coef and N_det - after calling this function. +`copy_h_apply_buffer_to_wf `_ + Copies the H_apply buffer to psi_coef. After calling this subroutine, N_det, psi_det and psi_coef need to be touched -`debug_unicity_of_determinants `_ - This subroutine checks that there are no repetitions in the wave function - -`fill_h_apply_buffer_no_selection `_ +`fill_h_apply_buffer_no_selection `_ Fill the H_apply buffer with determiants for CISD `h_apply_buffer_allocated `_ @@ -59,8 +55,12 @@ Documentation Buffer of determinants/coefficients/perturbative energy for H_apply. Uninitialized. Filled by H_apply subroutines. +`remove_duplicates_in_psi_det `_ + Removes duplicate determinants in the wave function. + `resize_h_apply_buffer `_ - Undocumented + Resizes the H_apply buffer of proc iproc. The buffer lock should + be set before calling this function. `cisd_sc2 `_ CISD+SC2 method :: take off all the disconnected terms of a CISD (selected or not) diff --git a/src/Determinants/diagonalize_CI.irp.f b/src/Determinants/diagonalize_CI.irp.f index c651ab96..7c017956 100644 --- a/src/Determinants/diagonalize_CI.irp.f +++ b/src/Determinants/diagonalize_CI.irp.f @@ -83,7 +83,7 @@ END_PROVIDER endif enddo else - do j=1,N_det + do j=1,N_states_diag call get_s2_u0(psi_det,eigenvectors(1,j),N_det,N_det,s2) do i=1,N_det CI_eigenvectors(i,j) = eigenvectors(i,j) diff --git a/src/Determinants/diagonalize_CI_mono.irp.f b/src/Determinants/diagonalize_CI_mono.irp.f index ad54e430..3f9b94ec 100644 --- a/src/Determinants/diagonalize_CI_mono.irp.f +++ b/src/Determinants/diagonalize_CI_mono.irp.f @@ -53,7 +53,7 @@ endif enddo else - do j=1,N_det + do j=1,N_states_diag call get_s2_u0(psi_det,eigenvectors(1,j),N_det,N_det,s2) if(dabs(eigenvectors(1,j)).gt.0.9d0)then i_state += 1 diff --git a/src/MRCC/mrcc_utils.irp.f b/src/MRCC/mrcc_utils.irp.f index 3c250155..611a70be 100644 --- a/src/MRCC/mrcc_utils.irp.f +++ b/src/MRCC/mrcc_utils.irp.f @@ -126,7 +126,7 @@ END_PROVIDER endif enddo else - do j=1,N_det + do j=1,N_states_diag call get_s2_u0(psi_det,eigenvectors(1,j),N_det,N_det,s2) i_state += 1 do i=1,N_det