anchor.diff:          if (ihpsi_current(k) == 0.d0) then
             ihpsi_current(k) = 1.d-32
           endif
  -        lambda_mrcc(k,i) = min(1.d-32,psi_non_ref_coef(i,k)/ihpsi_current(k) )
  +        lambda_mrcc(k,i) = min(-1.d-32,psi_non_ref_coef(i,k)/ihpsi_current(k) )
           lambda_pert = 1.d0 / (psi_ref_energy_diagonalized(k)-hii)
           if (lambda_pert / lambda_mrcc(k,i)  < 0.5d0) then
             i_pert_count += 1
  
positive.code:      enddo
    enddo
    lambda_mrcc_pt2_old(0) = N_lambda_mrcc_pt2
    
    print*,'N_det_non_ref = ',N_det_non_ref
    print*,'Number of ignored determinants = ',i_pert_count
  
negative.code:   double precision               :: ihpsi_current(N_states)
    integer :: i_pert_count
    double precision :: hii, lambda_pert
    integer                        :: N_lambda_mrcc_pt2, N_lambda_mrcc_pt3
    double precision, parameter :: x = 2.d0
    double precision :: nurm 
    i_pert_count = 0
    lambda_mrcc_old = 0.d0
    N_lambda_mrcc_pt2 = 0
    N_lambda_mrcc_pt3 = 0
    lambda_mrcc_pt2_old(0) = 0
    lambda_mrcc_pt3_old(0) = 0
    if(N_states > 1) stop "old lambda N_states == 1"
    nurm = 0d0
    do i=1,N_det_ref
      nurm += psi_ref_coef(i,1)**2
    end do
  
     do i=1,N_det_non_ref
       call i_h_psi(psi_non_ref(1,1,i), psi_ref, psi_ref_coef, N_int, N_det_ref, &
                    size(psi_ref_coef,1), N_states,ihpsi_current)
  