Skip to content

Commit 4d54672

Browse files
committed
Fix state following when N_states_diag is too small
1 parent edf3a27 commit 4d54672

File tree

2 files changed

+10
-45
lines changed

2 files changed

+10
-45
lines changed

src/davidson/diagonalization_hs2_dressed.irp.f

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
594594
state(l) = idx
595595
enddo
596596
597+
! Check if all states are attributed. If not, exit and N_st_diag will be increased.
598+
do l=1,N_st
599+
if (state(l) == 0) then
600+
return
601+
endif
602+
enddo
603+
597604
! tmp array before setting state_ok
598605
ok = .False.
599606
do l = 1, N_st
@@ -627,47 +634,6 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
627634
! Swapped eigenvectors
628635
prev_y = y
629636
630-
! if (state_following) then
631-
!
632-
! overlap = -1.d0
633-
! do k=1,shift2
634-
! do i=1,shift2
635-
! overlap(k,i) = dabs(y(k,i))
636-
! enddo
637-
! enddo
638-
! do k=1,N_st
639-
! cmax = -1.d0
640-
! do i=1,N_st
641-
! if (overlap(i,k) > cmax) then
642-
! cmax = overlap(i,k)
643-
! order(k) = i
644-
! endif
645-
! enddo
646-
! do i=1,N_st_diag
647-
! overlap(order(k),i) = -1.d0
648-
! enddo
649-
! enddo
650-
! overlap = y
651-
! do k=1,N_st
652-
! l = order(k)
653-
! if (k /= l) then
654-
! y(1:shift2,k) = overlap(1:shift2,l)
655-
! endif
656-
! enddo
657-
! do k=1,N_st
658-
! overlap(k,1) = lambda(k)
659-
! overlap(k,2) = s2(k)
660-
! enddo
661-
! do k=1,N_st
662-
! l = order(k)
663-
! if (k /= l) then
664-
! lambda(k) = overlap(l,1)
665-
! s2(k) = overlap(l,2)
666-
! endif
667-
! enddo
668-
!
669-
! endif
670-
671637
672638
! Express eigenvectors of h in the determinant basis
673639
! --------------------------------------------------
@@ -703,7 +669,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
703669
704670
705671
if ((itertot>1).and.(iter == 1)) then
706-
!don't print
672+
! Don't print
707673
continue
708674
else
709675
write(*,'(1X,I3,1X,100(1X,F16.10,1X,F11.6,1X,ES11.3))') iter-1, to_print(1:3,1:N_st)

src/davidson/diagonalize_ci.irp.f

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,8 @@
282282
print*,' Within the ',N_det,'determinants selected'
283283
print*,' and the ',N_states_diag,'states requested'
284284
print*,' We did not find only states with S^2 values close to ',expected_s2
285-
print*,' We will then set the first N_states eigenvectors of the H matrix'
286-
print*,' as the CI_eigenvectors'
287-
print*,' You should consider more states and maybe ask for s2_eig to be .True. or just enlarge the CI space'
285+
print*,' You should consider more states, or change s2_eig, or just enlarge the CI space'
286+
print*,'!!!!!!!! WARNING !!!!!!!!!'
288287
print*,''
289288

290289
do j=1,min(N_states_diag,N_det)

0 commit comments

Comments
 (0)