anchor.diff:      PROVIDE  psi_det
       PROVIDE  psi_det_sorted
   
  +    if (N_det == N_det_max) then
  +      threshold_davidson = threshold_davidson_in
  +      SOFT_TOUCH threshold_davidson
  +    endif
       call diagonalize_CI
       call save_wavefunction
       
  
positive.code:   double precision, allocatable  :: pt2(:)
    integer                        :: degree
    integer                        :: n_det_before, to_select
    
    allocate (pt2(N_states))
    
    pt2 = 1.d0
    diag_algorithm = "Lapack"
    
    if (N_det > N_det_max) then
      call diagonalize_CI
  
negative.code:   
    do while ( (N_det < N_det_max) .and. (maxval(abs(pt2(1:N_states))) > pt2_max) )
      n_det_before = N_det
      to_select = 3*N_det
      to_select = max(1024-to_select, to_select)
      to_select = min(to_select, N_det_max-n_det_before)
      call ZMQ_selection(to_select, pt2)
      
  