Skip to content

Commit

Permalink
Fix state following when N_states_diag is too small
Browse files Browse the repository at this point in the history
  • Loading branch information
scemama committed Jul 31, 2024
1 parent edf3a27 commit 4d54672
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 45 deletions.
50 changes: 8 additions & 42 deletions src/davidson/diagonalization_hs2_dressed.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
state(l) = idx
enddo
! Check if all states are attributed. If not, exit and N_st_diag will be increased.
do l=1,N_st
if (state(l) == 0) then
return
endif
enddo
! tmp array before setting state_ok
ok = .False.
do l = 1, N_st
Expand Down Expand Up @@ -627,47 +634,6 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
! Swapped eigenvectors
prev_y = y
! if (state_following) then
!
! overlap = -1.d0
! do k=1,shift2
! do i=1,shift2
! overlap(k,i) = dabs(y(k,i))
! enddo
! enddo
! do k=1,N_st
! cmax = -1.d0
! do i=1,N_st
! if (overlap(i,k) > cmax) then
! cmax = overlap(i,k)
! order(k) = i
! endif
! enddo
! do i=1,N_st_diag
! overlap(order(k),i) = -1.d0
! enddo
! enddo
! overlap = y
! do k=1,N_st
! l = order(k)
! if (k /= l) then
! y(1:shift2,k) = overlap(1:shift2,l)
! endif
! enddo
! do k=1,N_st
! overlap(k,1) = lambda(k)
! overlap(k,2) = s2(k)
! enddo
! do k=1,N_st
! l = order(k)
! if (k /= l) then
! lambda(k) = overlap(l,1)
! s2(k) = overlap(l,2)
! endif
! enddo
!
! endif
! Express eigenvectors of h in the determinant basis
! --------------------------------------------------
Expand Down Expand Up @@ -703,7 +669,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
if ((itertot>1).and.(iter == 1)) then
!don't print
! Don't print
continue
else
write(*,'(1X,I3,1X,100(1X,F16.10,1X,F11.6,1X,ES11.3))') iter-1, to_print(1:3,1:N_st)
Expand Down
5 changes: 2 additions & 3 deletions src/davidson/diagonalize_ci.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,8 @@
print*,' Within the ',N_det,'determinants selected'
print*,' and the ',N_states_diag,'states requested'
print*,' We did not find only states with S^2 values close to ',expected_s2
print*,' We will then set the first N_states eigenvectors of the H matrix'
print*,' as the CI_eigenvectors'
print*,' You should consider more states and maybe ask for s2_eig to be .True. or just enlarge the CI space'
print*,' You should consider more states, or change s2_eig, or just enlarge the CI space'
print*,'!!!!!!!! WARNING !!!!!!!!!'
print*,''

do j=1,min(N_states_diag,N_det)
Expand Down

0 comments on commit 4d54672

Please sign in to comment.